Skip to content

Commit 68b4885

Browse files
author
per ploug
committed
initial change
1 parent 49a374d commit 68b4885

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3074
-262
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
angular.module("umbraco.directives")
2+
.directive('umbBody', function(){
3+
return {
4+
restrict: 'E',
5+
replace: true,
6+
transclude: 'true',
7+
templateUrl: 'views/directives/html/umb-body.html'
8+
};
9+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
angular.module("umbraco.directives")
2+
.directive('umbFooter', function(){
3+
return {
4+
restrict: 'E',
5+
replace: true,
6+
transclude: 'true',
7+
templateUrl: 'views/directives/html/umb-footer.html'
8+
};
9+
});

src/Umbraco.Web.UI.Client/src/common/directives/html/umbheader.directive.js

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,6 @@ angular.module("umbraco.directives")
44
restrict: 'E',
55
replace: true,
66
transclude: 'true',
7-
templateUrl: 'views/directives/umb-header.html',
8-
//create a new isolated scope assigning a tabs property from the attribute 'tabs'
9-
//which is bound to the parent scope property passed in
10-
scope: {
11-
tabs: "="
12-
},
13-
link: function (scope, iElement, iAttrs) {
14-
15-
var maxTabs = 4;
16-
17-
function collectFromDom(activeTab){
18-
var $panes = $('div.tab-content');
19-
20-
angular.forEach($panes.find('.tab-pane'), function (pane, index) {
21-
var $this = angular.element(pane);
22-
23-
var id = $this.attr("rel");
24-
var label = $this.attr("label");
25-
var tab = {id: id, label: label, active: false};
26-
if(!activeTab){
27-
tab.active = true;
28-
activeTab = tab;
29-
}
30-
31-
if ($this.attr("rel") === String(activeTab.id)) {
32-
$this.addClass('active');
33-
}
34-
else {
35-
$this.removeClass('active');
36-
}
37-
38-
if(label){
39-
scope.visibleTabs.push(tab);
40-
}
41-
42-
});
43-
}
44-
45-
scope.showTabs = iAttrs.tabs ? true : false;
46-
scope.visibleTabs = [];
47-
scope.overflownTabs = [];
48-
49-
$timeout(function () {
50-
collectFromDom(undefined);
51-
}, 500);
52-
53-
//when the tabs change, we need to hack the planet a bit and force the first tab content to be active,
54-
//unfortunately twitter bootstrap tabs is not playing perfectly with angular.
55-
scope.$watch("tabs", function (newValue, oldValue) {
56-
57-
angular.forEach(newValue, function(val, index){
58-
var tab = {id: val.id, label: val.label};
59-
scope.visibleTabs.push(tab);
60-
});
61-
62-
//don't process if we cannot or have already done so
63-
if (!newValue) {return;}
64-
if (!newValue.length || newValue.length === 0){return;}
65-
66-
var activeTab = _.find(newValue, function (item) {
67-
return item.active;
68-
});
69-
70-
//we need to do a timeout here so that the current sync operation can complete
71-
// and update the UI, then this will fire and the UI elements will be available.
72-
$timeout(function () {
73-
collectFromDom(activeTab);
74-
}, 500);
75-
76-
});
77-
}
7+
templateUrl: 'views/directives/html/umb-header.html'
788
};
799
});

src/Umbraco.Web.UI.Client/src/common/directives/html/umbtabview.directive.js

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,81 @@
44
* @restrict E
55
**/
66
angular.module("umbraco.directives")
7-
.directive('umbTabView', function($timeout, $log){
7+
.directive('umbTabView', function($timeout, $log, $parse){
88
return {
99
restrict: 'E',
1010
replace: true,
1111
transclude: 'true',
12-
templateUrl: 'views/directives/umb-tab-view.html'
12+
templateUrl: 'views/directives/umb-tab-view.html',
13+
scope: {
14+
tabs: "="
15+
},
16+
link: function (scope, iElement, iAttrs) {
17+
18+
var maxTabs = 4;
19+
function collectFromDom(activeTab){
20+
var $panes = $('div.tab-content');
21+
22+
angular.forEach($panes.find('.tab-pane'), function (pane, index) {
23+
var $this = angular.element(pane);
24+
25+
var id = $this.attr("rel");
26+
var label = $this.attr("label");
27+
28+
var tab = {id: id, label: label, active: false};
29+
if(!activeTab){
30+
tab.active = true;
31+
activeTab = tab;
32+
}
33+
34+
if ($this.attr("rel") === String(activeTab.id)) {
35+
$this.addClass('active');
36+
}
37+
else {
38+
$this.removeClass('active');
39+
}
40+
41+
if(label){
42+
scope.visibleTabs.push(tab);
43+
}
44+
});
45+
46+
}
47+
48+
scope.showTabs = iAttrs.tabs ? true : false;
49+
scope.visibleTabs = [];
50+
scope.overflownTabs = [];
51+
52+
$timeout(function () {
53+
collectFromDom(undefined);
54+
}, 500);
55+
56+
57+
//when the tabs change, we need to hack the planet a bit and force the first tab content to be active,
58+
//unfortunately twitter bootstrap tabs is not playing perfectly with angular.
59+
scope.$watch("tabs", function (newValue, oldValue) {
60+
angular.forEach(newValue, function(val, index){
61+
var tab = {id: val.id, label: val.label};
62+
scope.visibleTabs.push(tab);
63+
});
64+
65+
66+
//don't process if we cannot or have already done so
67+
if (!newValue) {return;}
68+
69+
if (!newValue.length || newValue.length === 0){return;}
70+
71+
var activeTab = _.find(newValue, function (item) {
72+
return item.active;
73+
});
74+
75+
//we need to do a timeout here so that the current sync operation can complete
76+
// and update the UI, then this will fire and the UI elements will be available.
77+
$timeout(function () {
78+
collectFromDom(activeTab);
79+
}, 500);
80+
81+
});
82+
}
1383
};
1484
});

src/Umbraco.Web.UI.Client/src/common/directives/utill/detectfold.directive.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@ angular.module("umbraco.directives.html")
99
restrict: 'A',
1010
link: function (scope, el, attrs) {
1111

12+
var cl = "umb-editor-buttons";
13+
1214
var state = false,
13-
parent = $(".umb-panel-body"),
14-
winHeight = $(window).height(),
15-
calculate = _.throttle(function(){
16-
if(el && el.is(":visible") && !el.hasClass("umb-bottom-bar")){
15+
parent = $(".tab-content"),
16+
winHeight = $(window).height();
17+
18+
if(!parent){
19+
parent = $(".umb-body");
20+
}
21+
22+
var calculate = _.throttle(function(){
23+
if(el && el.is(":visible") && !el.hasClass(cl)){
1724
//var parent = el.parent();
1825
var hasOverflow = parent.innerHeight() < parent[0].scrollHeight;
1926
//var belowFold = (el.offset().top + el.height()) > winHeight;
2027
if(hasOverflow){
21-
el.addClass("umb-bottom-bar");
28+
el.addClass(cl);
2229
}
2330
}
2431
return state;
@@ -27,16 +34,16 @@ angular.module("umbraco.directives.html")
2734
scope.$watch(calculate, function(newVal, oldVal) {
2835
if(newVal !== oldVal){
2936
if(newVal){
30-
el.addClass("umb-bottom-bar");
37+
el.addClass(cl);
3138
}else{
32-
el.removeClass("umb-bottom-bar");
39+
el.removeClass(cl);
3340
}
3441
}
3542
});
3643

3744
$(window).bind("resize", function () {
3845
winHeight = $(window).height();
39-
el.removeClass("umb-bottom-bar");
46+
el.removeClass(cl);
4047
state = false;
4148
calculate();
4249
});

src/Umbraco.Web.UI.Client/src/less/belle.less

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
@import "forms.less";
7070
@import "modals.less";
7171
@import "tree.less";
72-
@import "panel.less";
72+
@import "editor.less";
7373
@import "sections.less";
7474
@import "main.less";
7575
@import "listview.less";
@@ -79,6 +79,9 @@
7979
@import "helveticons.less";
8080
@import "dragdrop.less";
8181

82+
@import "tabview.less";
83+
84+
8285
//used for property editors
8386
@import "property-editors.less";
8487

0 commit comments

Comments
 (0)