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