Get rid of idGenerator service
Use built-in $id value instead. Change-Id: Ifed0b3a145a83d95bb129c335751d7fb954f98ea
This commit is contained in:
parent
5b8f8dff14
commit
405b15f6f0
@ -1,7 +1,7 @@
|
|||||||
<div class="section">
|
<div class="section">
|
||||||
<div class="three-columns">
|
<div class="three-columns">
|
||||||
<div class="both-columns">
|
<div class="both-columns">
|
||||||
<h5><a data-toggle="collapse" data-target="#{$ id $}" href="#">{$ title $}</a></h5>
|
<h5><a data-toggle="collapse" data-target="#elem-{$ $id $}" href="#">{$ title $}</a></h5>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="additive" class="add-btn button-column">
|
<div ng-show="additive" class="add-btn button-column">
|
||||||
<button class="btn btn-default btn-sm pull-right"><i class="fa fa-plus"></i></button>
|
<button class="btn btn-default btn-sm pull-right"><i class="fa fa-plus"></i></button>
|
||||||
@ -10,6 +10,6 @@
|
|||||||
<i class="fa fa-times-circle pull-right"></i>
|
<i class="fa fa-times-circle pull-right"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="{$ id $}" class="collapse in" ng-transclude>
|
<div id="elem-{$ $id $}" class="collapse in" ng-transclude>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -1,10 +1,10 @@
|
|||||||
<div class="panel panel-default merlin-panel">
|
<div class="panel panel-default merlin-panel">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<a data-toggle="collapse" data-target="#{$ id $}" href="#">{$ title $}</a>
|
<a data-toggle="collapse" data-target="#elem-{$ $id $}" href="#">{$ title $}</a>
|
||||||
<i ng-show="removable" class="fa fa-times-circle pull-right"></i></h4>
|
<i ng-show="removable" class="fa fa-times-circle pull-right"></i></h4>
|
||||||
</div>
|
</div>
|
||||||
<div id="{$ id $}" class="panel-collapse collapse in">
|
<div id="elem-{$ $id $}" class="panel-collapse collapse in">
|
||||||
<div class="panel-body" ng-transclude>
|
<div class="panel-body" ng-transclude>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<div class="three-columns" ng-repeat="(key, value) in item[spec.name] track by key">
|
<div class="three-columns" ng-repeat="(key, value) in item[spec.name] track by key">
|
||||||
<div class="left-column">
|
<div class="left-column">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{$ id $}.{$ key $}">
|
<label for="elem-{$ $id $}.{$ key $}">
|
||||||
<editable value="key" label="New Name"></editable>
|
<editable value="key" label="New Name"></editable>
|
||||||
</label>
|
</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" ng-model="value">
|
<input id="elem-{$ $id $}.{$ key $}" type="text" class="form-control" ng-model="value">
|
||||||
<i class="fa fa-minus-circle input-group-addon"></i>
|
<i class="fa fa-minus-circle input-group-addon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<div class="three-columns">
|
<div class="three-columns">
|
||||||
<div class="left-column">
|
<div class="left-column">
|
||||||
<div class="form-group" ng-repeat="(key, item) in item[spec.name] track by key">
|
<div class="form-group" ng-repeat="(key, item) in item[spec.name] track by key">
|
||||||
<label for="{$ id $}.{$ key $}">{$ item.title || makeTitle(item.name) $}</label>
|
<label for="elem-{$ $id $}.{$ key $}">{$ item.title || makeTitle(item.name) $}</label>
|
||||||
<input type="text" class="form-control" id="{$ id $}.{$ key $}" ng-model="item.value">
|
<input type="text" class="form-control" id="elem-{$ $id $}.{$ key $}" ng-model="item.value">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{$ id $}">{$ spec.title || makeTitle(spec.name) $}</label>
|
<label for="elem-{$ $id $}">{$ spec.title || makeTitle(spec.name) $}</label>
|
||||||
<input type="text" class="form-control" id="{$ id $}" ng-model="item[spec.name]">
|
<input type="text" class="form-control" id="elem-{$ $id $}" ng-model="item[spec.name]">
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
ng-class="{dictionary: subItem.type == 'dictionary', list: subItem.type == 'list'}">
|
ng-class="{dictionary: subItem.type == 'dictionary', list: subItem.type == 'list'}">
|
||||||
<div class="left-column">
|
<div class="left-column">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{$ id $}.$index">Key Type</label>
|
<label for="elem-{$ $id $}.$index">Key Type</label>
|
||||||
<select id="{$ id $}.$index" class="form-control" ng-model="subItem.type">
|
<select id="elem-{$ $id $}.$index" class="form-control">
|
||||||
<option ng-repeat="value in ['string', 'list', 'dictionary']"
|
<option ng-repeat="value in ['string', 'list', 'dictionary']"
|
||||||
value="{$ value $}" ng-selected="subItem.type == value">{$ makeTitle(value) $}</option>
|
value="{$ value $}" ng-selected="subItem.type == value">{$ makeTitle(value) $}</option>
|
||||||
</select>
|
</select>
|
||||||
@ -25,11 +25,11 @@
|
|||||||
<div ng-hide="$first" class="left-column"></div>
|
<div ng-hide="$first" class="left-column"></div>
|
||||||
<div class="right-column">
|
<div class="right-column">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{$ id $}.{$ key $}">
|
<label for="elem-{$ $id $}.{$ key $}">
|
||||||
<editable value="key" label="New Name"></editable>
|
<editable value="key" label="New Name"></editable>
|
||||||
</label>
|
</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" ng-model="value">
|
<input id="elem-{$ $id $}.{$ key $}" type="text" class="form-control" ng-model="value">
|
||||||
<i class="fa fa-minus-circle input-group-addon"></i>
|
<i class="fa fa-minus-circle input-group-addon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,9 +5,7 @@
|
|||||||
(function() {
|
(function() {
|
||||||
angular.module('hz')
|
angular.module('hz')
|
||||||
|
|
||||||
.controller('workbookCtrl', function($scope, idGenerator) {
|
.controller('workbookCtrl', function($scope) {
|
||||||
$scope.idGenerator = idGenerator;
|
|
||||||
|
|
||||||
$scope.data = {
|
$scope.data = {
|
||||||
actions: [{
|
actions: [{
|
||||||
id: 'action1',
|
id: 'action1',
|
||||||
|
@ -60,14 +60,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('action', function() {
|
.directive('collapsiblePanel', function($parse, defaultSetter) {
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
scope: {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
.directive('collapsiblePanel', function($parse, idGenerator, defaultSetter) {
|
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: '/static/mistral/js/angular-templates/collapsible-panel.html',
|
templateUrl: '/static/mistral/js/angular-templates/collapsible-panel.html',
|
||||||
@ -80,7 +73,6 @@
|
|||||||
defaultSetter(attrs, 'removable', false);
|
defaultSetter(attrs, 'removable', false);
|
||||||
return {
|
return {
|
||||||
post: function(scope, element, attrs) {
|
post: function(scope, element, attrs) {
|
||||||
scope.id = idGenerator();
|
|
||||||
disableClickDefaultBehaviour(element);
|
disableClickDefaultBehaviour(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +80,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('collapsibleGroup', function($parse, idGenerator, defaultSetter) {
|
.directive('collapsibleGroup', function($parse, defaultSetter) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: '/static/mistral/js/angular-templates/collapsible-group.html',
|
templateUrl: '/static/mistral/js/angular-templates/collapsible-group.html',
|
||||||
@ -103,7 +95,6 @@
|
|||||||
defaultSetter(attrs, 'additive', false);
|
defaultSetter(attrs, 'additive', false);
|
||||||
return {
|
return {
|
||||||
post: function(scope, element) {
|
post: function(scope, element) {
|
||||||
scope.id = idGenerator();
|
|
||||||
disableClickDefaultBehaviour(element);
|
disableClickDefaultBehaviour(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,12 +102,11 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('typedField', function($http, $templateCache, $compile, idGenerator) {
|
.directive('typedField', function($http, $templateCache, $compile) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: true,
|
scope: true,
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
scope.id = idGenerator();
|
|
||||||
$http.get(
|
$http.get(
|
||||||
'/static/mistral/js/angular-templates/fields/' + scope.spec.type + '.html',
|
'/static/mistral/js/angular-templates/fields/' + scope.spec.type + '.html',
|
||||||
{cache: $templateCache}).success(function(templateContent) {
|
{cache: $templateCache}).success(function(templateContent) {
|
||||||
@ -126,5 +116,4 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -4,13 +4,6 @@
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
angular.module('hz')
|
angular.module('hz')
|
||||||
.factory('idGenerator', function() {
|
|
||||||
var id = 0;
|
|
||||||
return function() {
|
|
||||||
id++;
|
|
||||||
return 'elem-id-'+id;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
.factory('defaultSetter', function($parse) {
|
.factory('defaultSetter', function($parse) {
|
||||||
return function(attrs, attrName, defaultValue) {
|
return function(attrs, attrName, defaultValue) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user