Browse Source

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
changes/87/190587/5
Vlad Okhrimenko 4 years ago
parent
commit
7c09eb5fb5

+ 0
- 10
merlin/static/merlin/js/merlin.directives.js View File

@@ -4,14 +4,6 @@
4 4
 (function() {
5 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 7
   angular.module('merlin')
16 8
     .directive('editable', function() {
17 9
       return {
@@ -86,7 +78,6 @@
86 78
         link: function(scope, element, attrs) {
87 79
           scope.removable = $parse(attrs.removable)();
88 80
           scope.isCollapsed = false;
89
-          disableClickDefaultBehaviour(element);
90 81
         }
91 82
       }
92 83
     })
@@ -101,7 +92,6 @@
101 92
           onRemove: '&'
102 93
         },
103 94
         link: function(scope, element, attrs) {
104
-          disableClickDefaultBehaviour(element);
105 95
           scope.isCollapsed = false;
106 96
           if ( attrs.onAdd && attrs.additive !== 'false' ) {
107 97
             scope.additive = true;

+ 7
- 2
merlin/static/merlin/js/merlin.filters.js View File

@@ -22,13 +22,16 @@
22 22
           if ( angular.isArray(itemsOrContainer) && !itemsOrContainer.length ) {
23 23
             return null;
24 24
           }
25
-          this.id = utils.getNewId();
26 25
           if ( angular.isArray(itemsOrContainer) ) {
27 26
             this.items = itemsOrContainer;
27
+            this.id = itemsOrContainer.reduce(function(prevId, item) {
28
+              return item.uid() + prevId;
29
+            }, '');
28 30
           } else {
29 31
             this._barricadeContainer = itemsOrContainer;
30 32
             this._barricadeId = id;
31 33
             var barricadeObj = itemsOrContainer.getByID(id);
34
+            this.id = barricadeObj.uid();
32 35
             this.items = barricadeObj.getKeys().map(function(key) {
33 36
               return utils.enhanceItemWithID(barricadeObj.get(key), key);
34 37
             });
@@ -90,6 +93,8 @@
90 93
             item.getIDs().forEach(function(id) {
91 94
               hash += item.getByID(id).uid();
92 95
             });
96
+          } else {
97
+            hash += item.uid();
93 98
           }
94 99
         });
95 100
         return hash;
@@ -114,7 +119,7 @@
114 119
       return _.memoize(function(panel) {
115 120
         var rowProto = {
116 121
             create: function(items) {
117
-              this.id = utils.getNewId();
122
+              this.id = items[0].uid();
118 123
               this.index = items.row;
119 124
               this.items = items.slice();
120 125
               return this;

+ 2
- 2
merlin/static/merlin/templates/collapsible-group.html View File

@@ -1,7 +1,7 @@
1 1
 <div class="section">
2 2
   <div class="section-heading three-columns">
3 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 5
         <i class="fa" ng-class="isCollapsed ? 'fa-plus-square-o' : 'fa-minus-square-o'"></i></a>
6 6
         <editable ng-if="removable" ng-model="group.title"
7 7
                   ng-model-options="{getterSetter: true}"></editable>
@@ -13,7 +13,7 @@
13 13
         <i class="fa fa-plus"></i></button>
14 14
     </div>
15 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 17
         <i class="fa fa-times-circle pull-right"></i></a>
18 18
     </div>
19 19
   </div>

+ 2
- 2
merlin/static/merlin/templates/collapsible-panel.html View File

@@ -1,10 +1,10 @@
1 1
 <div class="panel panel-default merlin-panel">
2 2
   <div class="panel-heading" ng-show="panel.title()">
3 3
     <h4 class="panel-title">
4
-      <a ng-click="isCollapsed = !isCollapsed" href="#">
4
+      <a ng-click="isCollapsed = !isCollapsed" href="">
5 5
         <i class="fa fa-lg" ng-class="isCollapsed ? 'fa-caret-right' : 'fa-caret-down'"></i></a>
6 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 8
         <i class="fa fa-times-circle pull-right"></i></a>
9 9
     </h4>
10 10
   </div>

+ 1
- 1
merlin/static/merlin/templates/editable.html View File

@@ -1,7 +1,7 @@
1 1
 <span class="width-detector" style="display:none"></span>
2 2
 <span ng-show="!isEdited">
3 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 5
 </span>
6 6
 <span ng-show="isEdited">
7 7
   <input type="text" ng-model="editableValue" show-focus="isEdited">

Loading…
Cancel
Save