From 680f3fc9de84ff85c66a5c95cbf4487551039093 Mon Sep 17 00:00:00 2001 From: Shaopeng Zhang Date: Mon, 9 Nov 2015 15:32:23 -0500 Subject: [PATCH 1/6] add hideprev and hideafter to spliterbar add `hideprev` and `hideafter` attributes to uiLayoutContainer to control hide "prev" or "after" icon of the following spliterbar. --- src/ui-layout.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui-layout.js b/src/ui-layout.js index b0b8e82..8da4b50 100644 --- a/src/ui-layout.js +++ b/src/ui-layout.js @@ -784,6 +784,8 @@ angular.module('ui.layout', []) pre: function(scope, element, attrs, ctrl) { scope.container = LayoutContainer.Container(); scope.container.element = element; + scope.hideprev = element.attr("hideprev") !== undefined + scope.hideafter = element.attr("hideafter") !== undefined ctrl.addContainer(scope.container); @@ -808,7 +810,7 @@ angular.module('ui.layout', []) var parent = element.parent(); var children = parent.children(); var index = ctrl.indexOfElement(element); - var splitbar = angular.element('
'); + var splitbar = angular.element('
'); if(0 < index && !ctrl.hasSplitbarBefore(scope.container)) { angular.element(children[index-1]).after(splitbar); $compile(splitbar)(scope); From 2fd153c94f41809214e67d08912fa245321a1001 Mon Sep 17 00:00:00 2001 From: Shaopeng Zhang Date: Mon, 9 Nov 2015 15:45:23 -0500 Subject: [PATCH 2/6] Update ui-layout.js --- src/ui-layout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui-layout.js b/src/ui-layout.js index 8da4b50..f197fa2 100644 --- a/src/ui-layout.js +++ b/src/ui-layout.js @@ -784,8 +784,8 @@ angular.module('ui.layout', []) pre: function(scope, element, attrs, ctrl) { scope.container = LayoutContainer.Container(); scope.container.element = element; - scope.hideprev = element.attr("hideprev") !== undefined - scope.hideafter = element.attr("hideafter") !== undefined + scope.hideprev = element.attr("hideprev") !== undefined; + scope.hideafter = element.attr("hideafter") !== undefined; ctrl.addContainer(scope.container); From a2484930a7a7effd6f9df67a78f4e14c88e1b96d Mon Sep 17 00:00:00 2001 From: Shaopeng Zhang Date: Mon, 9 Nov 2015 15:50:29 -0500 Subject: [PATCH 3/6] Update ui-layout.js --- src/ui-layout.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui-layout.js b/src/ui-layout.js index f197fa2..38c7c62 100644 --- a/src/ui-layout.js +++ b/src/ui-layout.js @@ -810,7 +810,8 @@ angular.module('ui.layout', []) var parent = element.parent(); var children = parent.children(); var index = ctrl.indexOfElement(element); - var splitbar = angular.element('
'); + var splitbar = angular.element('
+
'); if(0 < index && !ctrl.hasSplitbarBefore(scope.container)) { angular.element(children[index-1]).after(splitbar); $compile(splitbar)(scope); From e3e4b418bb8ff0c045dc2e9be69d8ba5c8e9c230 Mon Sep 17 00:00:00 2001 From: Shaopeng Zhang Date: Mon, 9 Nov 2015 16:01:31 -0500 Subject: [PATCH 4/6] Update ui-layout.js --- src/ui-layout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui-layout.js b/src/ui-layout.js index 38c7c62..14c44c3 100644 --- a/src/ui-layout.js +++ b/src/ui-layout.js @@ -810,8 +810,8 @@ angular.module('ui.layout', []) var parent = element.parent(); var children = parent.children(); var index = ctrl.indexOfElement(element); - var splitbar = angular.element('
-
'); + var splitbar = angular.element('
' + + '
'); if(0 < index && !ctrl.hasSplitbarBefore(scope.container)) { angular.element(children[index-1]).after(splitbar); $compile(splitbar)(scope); From 332248462900f8e5d9bd645600ad2bf02da9fa57 Mon Sep 17 00:00:00 2001 From: Shaopeng Zhang Date: Sat, 14 Nov 2015 11:11:33 -0500 Subject: [PATCH 5/6] add splitbar attribute to uiLayoutContainer to control prev and next button. ```
``` --- src/ui-layout.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ui-layout.js b/src/ui-layout.js index 14c44c3..f5cacbc 100644 --- a/src/ui-layout.js +++ b/src/ui-layout.js @@ -784,8 +784,9 @@ angular.module('ui.layout', []) pre: function(scope, element, attrs, ctrl) { scope.container = LayoutContainer.Container(); scope.container.element = element; - scope.hideprev = element.attr("hideprev") !== undefined; - scope.hideafter = element.attr("hideafter") !== undefined; + var splitbarOpts = angular.extend({}, scope.$eval(attrs.splitbar)); + scope.prevButton = splitbarOpts && splitbarOpts.prevButton !== undefined ? splitbarOpts.prevButton : true; + scope.nextButton = splitbarOpts && splitbarOpts.nextButton !== undefined ? splitbarOpts.nextButton : true; ctrl.addContainer(scope.container); @@ -798,6 +799,7 @@ angular.module('ui.layout', []) if(!element.hasClass('stretch')) element.addClass('stretch'); if(!element.hasClass('ui-layout-container')) element.addClass('ui-layout-container'); + scope.$watch('container.size', function(newValue) { element.css(ctrl.sizeProperties.sizeProperty, newValue + 'px'); }); @@ -810,8 +812,9 @@ angular.module('ui.layout', []) var parent = element.parent(); var children = parent.children(); var index = ctrl.indexOfElement(element); - var splitbar = angular.element('
' - + '
'); + var splitbar = angular.element('
' + + '
'); + if(0 < index && !ctrl.hasSplitbarBefore(scope.container)) { angular.element(children[index-1]).after(splitbar); $compile(splitbar)(scope); From 39f2810b0c715f8407987f06cfdeccf9e3fde557 Mon Sep 17 00:00:00 2001 From: Shaopeng Zhang Date: Sun, 15 Nov 2015 09:21:46 -0500 Subject: [PATCH 6/6] modified readme. --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 9964c3c..36361d5 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,21 @@ percentage ``` +### splitbar + +Type: `Ojbect` + +A Javascript object to control the display or previous button and next button. + +`prevButton`: Boolean (Default: true). +`nextButton`: Boolean (Deafutl: true). + + +``` +
+ +``` + ## Events Events are broadcast on the scope where ui-layout is attached. This means they are available to any controller inside of a ui-layout container.