summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Okhrimenko <vokhrimenko@mirantis.com>2015-06-11 14:15:26 +0300
committerVlad Okhrimenko <vokhrimenko@mirantis.com>2015-06-15 18:24:30 +0300
commit7c09eb5fb5d8cb2dcc84148fe8d0c53b16dc6d85 (patch)
tree39b88dd26a51fbf9338db11e27840d50e232bef2
parentf0023b100f19a21b8fe78970ae23080ea76dbffe (diff)
No need to use disableDefaultClickBehaviour
removed `#` from `href-tag`. Fixed scroll to top. Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com> Change-Id: I04bb343b0a4365c437d0f4625cb7a7c3ed7dc740 closes-bug: #1459342 closes-bug: #1448546
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Timur Sufiev <tsufiev@mirantis.com> Workflow+1: Timur Sufiev <tsufiev@mirantis.com> Submitted-by: Jenkins Submitted-at: Tue, 16 Jun 2015 17:14:24 +0000 Reviewed-on: https://review.openstack.org/190587 Project: stackforge/merlin Branch: refs/heads/master
-rw-r--r--merlin/static/merlin/js/merlin.directives.js10
-rw-r--r--merlin/static/merlin/js/merlin.filters.js9
-rw-r--r--merlin/static/merlin/templates/collapsible-group.html4
-rw-r--r--merlin/static/merlin/templates/collapsible-panel.html4
-rw-r--r--merlin/static/merlin/templates/editable.html2
5 files changed, 12 insertions, 17 deletions
diff --git a/merlin/static/merlin/js/merlin.directives.js b/merlin/static/merlin/js/merlin.directives.js
index 8d53ca8..5f0f306 100644
--- a/merlin/static/merlin/js/merlin.directives.js
+++ b/merlin/static/merlin/js/merlin.directives.js
@@ -4,14 +4,6 @@
4(function() { 4(function() {
5 'use strict'; 5 'use strict';
6 6
7 function disableClickDefaultBehaviour(element) {
8 element.find('a[ng-click]')
9 .on('click', function(e) {
10 e.preventDefault();
11 return true;
12 });
13 }
14
15 angular.module('merlin') 7 angular.module('merlin')
16 .directive('editable', function() { 8 .directive('editable', function() {
17 return { 9 return {
@@ -86,7 +78,6 @@
86 link: function(scope, element, attrs) { 78 link: function(scope, element, attrs) {
87 scope.removable = $parse(attrs.removable)(); 79 scope.removable = $parse(attrs.removable)();
88 scope.isCollapsed = false; 80 scope.isCollapsed = false;
89 disableClickDefaultBehaviour(element);
90 } 81 }
91 } 82 }
92 }) 83 })
@@ -101,7 +92,6 @@
101 onRemove: '&' 92 onRemove: '&'
102 }, 93 },
103 link: function(scope, element, attrs) { 94 link: function(scope, element, attrs) {
104 disableClickDefaultBehaviour(element);
105 scope.isCollapsed = false; 95 scope.isCollapsed = false;
106 if ( attrs.onAdd && attrs.additive !== 'false' ) { 96 if ( attrs.onAdd && attrs.additive !== 'false' ) {
107 scope.additive = true; 97 scope.additive = true;
diff --git a/merlin/static/merlin/js/merlin.filters.js b/merlin/static/merlin/js/merlin.filters.js
index 06fc8d4..aa26486 100644
--- a/merlin/static/merlin/js/merlin.filters.js
+++ b/merlin/static/merlin/js/merlin.filters.js
@@ -22,13 +22,16 @@
22 if ( angular.isArray(itemsOrContainer) && !itemsOrContainer.length ) { 22 if ( angular.isArray(itemsOrContainer) && !itemsOrContainer.length ) {
23 return null; 23 return null;
24 } 24 }
25 this.id = utils.getNewId();
26 if ( angular.isArray(itemsOrContainer) ) { 25 if ( angular.isArray(itemsOrContainer) ) {
27 this.items = itemsOrContainer; 26 this.items = itemsOrContainer;
27 this.id = itemsOrContainer.reduce(function(prevId, item) {
28 return item.uid() + prevId;
29 }, '');
28 } else { 30 } else {
29 this._barricadeContainer = itemsOrContainer; 31 this._barricadeContainer = itemsOrContainer;
30 this._barricadeId = id; 32 this._barricadeId = id;
31 var barricadeObj = itemsOrContainer.getByID(id); 33 var barricadeObj = itemsOrContainer.getByID(id);
34 this.id = barricadeObj.uid();
32 this.items = barricadeObj.getKeys().map(function(key) { 35 this.items = barricadeObj.getKeys().map(function(key) {
33 return utils.enhanceItemWithID(barricadeObj.get(key), key); 36 return utils.enhanceItemWithID(barricadeObj.get(key), key);
34 }); 37 });
@@ -90,6 +93,8 @@
90 item.getIDs().forEach(function(id) { 93 item.getIDs().forEach(function(id) {
91 hash += item.getByID(id).uid(); 94 hash += item.getByID(id).uid();
92 }); 95 });
96 } else {
97 hash += item.uid();
93 } 98 }
94 }); 99 });
95 return hash; 100 return hash;
@@ -114,7 +119,7 @@
114 return _.memoize(function(panel) { 119 return _.memoize(function(panel) {
115 var rowProto = { 120 var rowProto = {
116 create: function(items) { 121 create: function(items) {
117 this.id = utils.getNewId(); 122 this.id = items[0].uid();
118 this.index = items.row; 123 this.index = items.row;
119 this.items = items.slice(); 124 this.items = items.slice();
120 return this; 125 return this;
diff --git a/merlin/static/merlin/templates/collapsible-group.html b/merlin/static/merlin/templates/collapsible-group.html
index 95fcc25..a67b04a 100644
--- a/merlin/static/merlin/templates/collapsible-group.html
+++ b/merlin/static/merlin/templates/collapsible-group.html
@@ -1,7 +1,7 @@
1<div class="section"> 1<div class="section">
2 <div class="section-heading three-columns"> 2 <div class="section-heading three-columns">
3 <div class="both-columns"> 3 <div class="both-columns">
4 <h5><a ng-click="isCollapsed = !isCollapsed" class="collapse-entries" href="#"> 4 <h5><a ng-click="isCollapsed = !isCollapsed" class="collapse-entries" href="">
5 <i class="fa" ng-class="isCollapsed ? 'fa-plus-square-o' : 'fa-minus-square-o'"></i></a> 5 <i class="fa" ng-class="isCollapsed ? 'fa-plus-square-o' : 'fa-minus-square-o'"></i></a>
6 <editable ng-if="removable" ng-model="group.title" 6 <editable ng-if="removable" ng-model="group.title"
7 ng-model-options="{getterSetter: true}"></editable> 7 ng-model-options="{getterSetter: true}"></editable>
@@ -13,7 +13,7 @@
13 <i class="fa fa-plus"></i></button> 13 <i class="fa fa-plus"></i></button>
14 </div> 14 </div>
15 <div ng-if="removable" class="add-btn button-column remove-entry"> 15 <div ng-if="removable" class="add-btn button-column remove-entry">
16 <a href="#" ng-click="onRemove()"> 16 <a href="" ng-click="onRemove()">
17 <i class="fa fa-times-circle pull-right"></i></a> 17 <i class="fa fa-times-circle pull-right"></i></a>
18 </div> 18 </div>
19 </div> 19 </div>
diff --git a/merlin/static/merlin/templates/collapsible-panel.html b/merlin/static/merlin/templates/collapsible-panel.html
index 06429d8..df21a5a 100644
--- a/merlin/static/merlin/templates/collapsible-panel.html
+++ b/merlin/static/merlin/templates/collapsible-panel.html
@@ -1,10 +1,10 @@
1<div class="panel panel-default merlin-panel"> 1<div class="panel panel-default merlin-panel">
2 <div class="panel-heading" ng-show="panel.title()"> 2 <div class="panel-heading" ng-show="panel.title()">
3 <h4 class="panel-title"> 3 <h4 class="panel-title">
4 <a ng-click="isCollapsed = !isCollapsed" href="#"> 4 <a ng-click="isCollapsed = !isCollapsed" href="">
5 <i class="fa fa-lg" ng-class="isCollapsed ? 'fa-caret-right' : 'fa-caret-down'"></i></a> 5 <i class="fa fa-lg" ng-class="isCollapsed ? 'fa-caret-right' : 'fa-caret-down'"></i></a>
6 <editable ng-model="panel.title" ng-model-options="{getterSetter: true}"></editable> 6 <editable ng-model="panel.title" ng-model-options="{getterSetter: true}"></editable>
7 <a href="#" ng-show="panel.removable" ng-click="panel.remove()"> 7 <a href="" ng-show="panel.removable" ng-click="panel.remove()">
8 <i class="fa fa-times-circle pull-right"></i></a> 8 <i class="fa fa-times-circle pull-right"></i></a>
9 </h4> 9 </h4>
10 </div> 10 </div>
diff --git a/merlin/static/merlin/templates/editable.html b/merlin/static/merlin/templates/editable.html
index 7d8dd91..82405e7 100644
--- a/merlin/static/merlin/templates/editable.html
+++ b/merlin/static/merlin/templates/editable.html
@@ -1,7 +1,7 @@
1<span class="width-detector" style="display:none"></span> 1<span class="width-detector" style="display:none"></span>
2<span ng-show="!isEdited"> 2<span ng-show="!isEdited">
3 <span ng-bind="editableValue"></span> 3 <span ng-bind="editableValue"></span>
4 <a ng-click="isEdited = true" href="#"><i class="fa fa-pencil"></i></a> 4 <a ng-click="isEdited = true" href=""><i class="fa fa-pencil"></i></a>
5</span> 5</span>
6<span ng-show="isEdited"> 6<span ng-show="isEdited">
7 <input type="text" ng-model="editableValue" show-focus="isEdited"> 7 <input type="text" ng-model="editableValue" show-focus="isEdited">