bastion 3.3.6 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12794d0712a757cd81bce19294ac444dc7e20356
4
- data.tar.gz: ed8170194c3c93d63299a808f5943be843983a27
3
+ metadata.gz: 03081e476151e165781aa38ec6557ff0d088b39d
4
+ data.tar.gz: 65e2a101239aef579da8e3e88f67109662b1f5da
5
5
  SHA512:
6
- metadata.gz: 34bed473e8ccf71a7d303f03f6019edc335e94230ae242b414da34804e7f1b3cc50d30472a0516ff33f0af59128f01a3d5e2b7a922f2ee0fc4500b27317383f5
7
- data.tar.gz: b85b42a966143b65a3569eced0fc2a78989fc1c7a4450b7a52daa8764165d5254a040e6f772bb992bbdc688e47d0691fd8338d3a9b74c3985e30e2482fdb548f
6
+ metadata.gz: a336997f67ca28421ce01f352e5dfbf81cc1fce36d48fc4429aea9af34b027ff0491d1fac9ae5130617d523a7b549958913eed2a829e57fa09976311e3ed7bf7
7
+ data.tar.gz: 85151185287ab0908b7b7ccbc5a1ece638f7084e15271d448a832dda377a210f13e0c2aaba8405960183b46136cacd5bbfe69aa5518a8c81547b99bd9e86b367
@@ -9,6 +9,7 @@
9
9
  //= require "bastion/ngInfiniteScroll/ng-infinite-scroll.js"
10
10
  //= require "bastion/angular-gettext/angular-gettext"
11
11
  //= require "bastion/angular-blocks/angular-blocks"
12
+ //= require "bastion/angular-breadcrumb/angular-breadcrumb"
12
13
  //= require_tree "../../../../vendor/assets/javascripts/bastion/angular-bootstrap"
13
14
  //= require "bastion/angular-animate/angular-animate"
14
15
  //= require "angular-rails-templates"
@@ -6,7 +6,7 @@
6
6
  * Base module that defines the Katello module namespace and includes any thirdparty
7
7
  * modules used by the application.
8
8
  */
9
- angular.module('Bastion', []);
9
+ angular.module('Bastion', ['ncy-angular-breadcrumb']);
10
10
 
11
11
  /**
12
12
  * @ngdoc config
@@ -16,7 +16,6 @@
16
16
  angular.module('Bastion.components')
17
17
  .directive('bstEdit', function () {
18
18
  return {
19
- replace: true,
20
19
  controller: 'BstEditController',
21
20
  templateUrl: 'components/views/bst-edit.html'
22
21
  };
@@ -169,7 +168,6 @@ angular.module('Bastion.components')
169
168
  }])
170
169
  .directive('bstEditText', function () {
171
170
  return {
172
- replace: true,
173
171
  scope: {
174
172
  model: '=bstEditText',
175
173
  readonly: '=',
@@ -183,7 +181,6 @@ angular.module('Bastion.components')
183
181
  })
184
182
  .directive('bstEditTextarea', function () {
185
183
  return {
186
- replace: true,
187
184
  scope: {
188
185
  model: '=bstEditTextarea',
189
186
  readonly: '=',
@@ -195,7 +192,6 @@ angular.module('Bastion.components')
195
192
  })
196
193
  .directive('bstEditNumber', function () {
197
194
  return {
198
- replace: true,
199
195
  scope: {
200
196
  model: '=bstEditNumber',
201
197
  readonly: '=',
@@ -211,7 +207,6 @@ angular.module('Bastion.components')
211
207
  })
212
208
  .directive('bstEditCheckbox', function () {
213
209
  return {
214
- replace: true,
215
210
  scope: {
216
211
  model: '=bstEditCheckbox',
217
212
  readonly: '=',
@@ -225,7 +220,6 @@ angular.module('Bastion.components')
225
220
  })
226
221
  .directive('bstEditCustom', function () {
227
222
  return {
228
- replace: true,
229
223
  transclude: true,
230
224
  templateUrl: 'components/views/bst-edit-custom.html',
231
225
  scope: {
@@ -242,7 +236,6 @@ angular.module('Bastion.components')
242
236
  })
243
237
  .directive('bstEditSelect', function () {
244
238
  return {
245
- replace: true,
246
239
  scope: {
247
240
  model: '=bstEditSelect',
248
241
  displayValueDefault: '=displayValueDefault',
@@ -267,7 +260,6 @@ angular.module('Bastion.components')
267
260
  })
268
261
  .directive('bstEditMultiselect', function () {
269
262
  return {
270
- replace: true,
271
263
  templateUrl: 'components/views/bst-edit-multiselect.html',
272
264
  scope: {
273
265
  model: '=bstEditMultiselect',
@@ -139,7 +139,7 @@ angular.module('Bastion.components')
139
139
  }
140
140
 
141
141
  return function (scope, element, attrs, bstTableController) {
142
- if (angular.isDefined(tAttrs.rowSelect)) {
142
+ if (angular.isDefined(tAttrs.rowSelect) && angular.isDefined(scope.table)) {
143
143
  scope.table.rowSelect = true;
144
144
  } else if (angular.isDefined(tAttrs.rowChoice)) {
145
145
  scope.table.rowChoice = true;
@@ -1,8 +1,8 @@
1
1
  <div class="bst-edit">
2
2
  <div class="value" ng-class="{ 'editable' : !readonly }" ng-click="edit()" ng-hide="editMode || workingMode">
3
- <span class="fr">
4
- <i class="fa fa-edit inline-icon" ng-hide="editMode || readonly"></i>
5
- <i class="fa fa-remove inline-icon" ng-click="delete($event)" ng-show="deletable && !editMode && !readonly"></i>
3
+ <span class="fr" ng-hide="editMode || readonly">
4
+ <i class="fa fa-edit inline-icon"></i>
5
+ <i class="fa fa-remove inline-icon" ng-click="delete($event)" ng-show="deletable"></i>
6
6
  </span>
7
7
  <span class="editable-value">{{ displayValue }}</span>
8
8
  </div>
@@ -0,0 +1,28 @@
1
+ <div class="loading-mask fa-3x" ng-show="page.loading">
2
+ <i class="fa fa-spinner fa-spin"></i>
3
+ {{ "Loading..." | translate }}
4
+ </div>
5
+
6
+ <div class="row header-bar">
7
+ <div class="col-sm-10">
8
+ <span data-block="header"></span>
9
+ </div>
10
+
11
+ <div class="fr">
12
+ <span data-block="item-actions"></span>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="row">
17
+ <div class="col-sm-12">
18
+ <div ncy-breadcrumb></div>
19
+ </div>
20
+ </div>
21
+
22
+ <div class="row">
23
+ <div class="col-sm-12">
24
+ <div ng-hide="page && (page.loading || page.error)">
25
+ <span data-block="content"></span>
26
+ </div>
27
+ </div>
28
+ </div>
@@ -0,0 +1,94 @@
1
+ <section>
2
+
3
+ <div bst-global-notification></div>
4
+
5
+ <div class="row header-bar">
6
+ <h2 class="col-sm-10">
7
+ <span data-block="header">
8
+ REPLACE ME
9
+ </span>
10
+ </h2>
11
+ <div class="fr">
12
+ <span data-block="item-actions"></span>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="row header-bar">
17
+ <div class="row">
18
+ <div class="col-sm-12">
19
+ <div data-block="search-filter"></div>
20
+ </div>
21
+ </div>
22
+
23
+ <div class="col-sm-3">
24
+ <div class="input-group input-group">
25
+ <input type="text"
26
+ class="form-control"
27
+ placeholder="{{ 'Filter...' | translate }}"
28
+ bst-on-enter="table.search(table.searchTerm)"
29
+ ng-model="table.searchTerm"
30
+ ng-trim="false"
31
+ typeahead="item.label for item in table.autocomplete($viewValue)"
32
+ typeahead-empty
33
+ typeahead-template-url="components/views/autocomplete-scoped-search.html"/>
34
+ <span class="input-group-btn">
35
+ <button class="btn btn-default"
36
+ type="button"
37
+ ng-click='table.search("") && (table.searchCompleted = false)'
38
+ ng-show="table.searchCompleted && table.searchTerm">
39
+ <i class="fa fa-times"></i>
40
+ </button>
41
+ <button ng-click="table.search(table.searchTerm)" class="btn btn-default" type="button">
42
+ <i class="fa fa-search"></i>
43
+ <span translate>Search</span>
44
+ </button>
45
+ <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
46
+ <i class="fa fa-caret-down"></i>
47
+ </button>
48
+ <ul bst-bookmark controller-name="controllerName" query="table.searchTerm" class="dropdown-menu pull-right"></ul>
49
+ </span>
50
+ </div>
51
+ </div>
52
+
53
+ <div class="col-sm-3">
54
+ <span translate>Showing {{ table.rows.length }} of {{ table.resource.subtotal }} ({{ table.resource.total }} Total)</span>
55
+ </div>
56
+
57
+ <div class="fr">
58
+ <div class="fl">
59
+ <div data-block="list-actions"></div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <div class="row header-bar">
65
+ <div class="fr">
66
+ <span translate>{{ table.numSelected }} Selected</span>
67
+ </div>
68
+ <div class="col-sm-5">
69
+ <span data-block="filters"></span>
70
+ </div>
71
+ </div>
72
+
73
+ <div class="row nutupane" bst-table="table" nutupane-table>
74
+ <div class="loading-mask" ng-show="table.refreshing" >
75
+ <i class="fa fa-spinner fa-spin"></i>
76
+ <span>{{ "Loading..." | translate }}</span>
77
+ </div>
78
+
79
+ <p bst-alert="info" ng-show="table.rows.length === 0 && !table.working && !table.searchTerm && !table.searchCompleted">
80
+ <span data-block="no-rows-message"></span>
81
+ </p>
82
+ <p bst-alert="info" ng-show="table.rows.length === 0 && !table.working && (table.searchTerm || table.searchCompleted)">
83
+ <span data-block="no-search-results-message"></span>
84
+ </p>
85
+
86
+ <div ng-show="table.rows.length > 0" bst-container-scroll data="table.rows">
87
+ <div infinite-scroll="table.nextPage()" infinite-scroll-container="'.container-scroll-wrapper'"
88
+ infinite-scroll-listen-for-event="nutupane:loaded">
89
+ <div data-block="table"></div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+
94
+ </section>
@@ -0,0 +1,10 @@
1
+ <div class="row">
2
+ <section class="col-sm-5">
3
+ <div data-block="left-column"></div>
4
+ </section>
5
+
6
+ <section class="col-sm-5 col-sm-offset-1">
7
+ <div data-block="right-column"></div>
8
+ </section>
9
+ </div>
10
+
@@ -7,6 +7,7 @@
7
7
  @import "mixins";
8
8
  @import "variables";
9
9
  @import "nutupane";
10
+ @import "components";
10
11
  @import "overrides";
11
12
  @import "helpers";
12
13
  @import "./forms";
@@ -20,13 +21,6 @@
20
21
  overflow: hidden;
21
22
  }
22
23
 
23
- .container-fluid {
24
- margin-right: auto;
25
- margin-left: auto;
26
- padding-left: 15px;
27
- padding-right: 15px;
28
- }
29
-
30
24
  a {
31
25
  cursor: pointer;
32
26
  }
@@ -0,0 +1,28 @@
1
+ .header-bar {
2
+ background: rgb(250, 250, 250);
3
+ padding: 10px 15px 10px 0;
4
+ border-bottom: 1px solid rgb(230, 230, 230);
5
+
6
+ h2 {
7
+ margin: 5px 0 0 0;
8
+ }
9
+ }
10
+
11
+ .dl-horizontal.dl-horizontal-left {
12
+ dt {
13
+ overflow: visible;
14
+ text-align: left;
15
+ text-overflow: clip;
16
+ white-space: pre-wrap;
17
+ width: 125px;
18
+ }
19
+
20
+ dt:after {
21
+ content: ':';
22
+ }
23
+
24
+ dd {
25
+ margin-left: 200px;
26
+ word-wrap: break-word;
27
+ }
28
+ }
@@ -37,5 +37,5 @@
37
37
  }
38
38
 
39
39
  .editable-value {
40
- white-space: pre;
40
+ white-space: pre-line;
41
41
  }
@@ -56,6 +56,7 @@ ul {
56
56
  }
57
57
  }
58
58
 
59
- .row {
60
- margin-right: -7px;
61
- }
59
+ .dropdown-menu li .disabled {
60
+ @extend .text-muted;
61
+ padding: 1px 10px;
62
+ }
@@ -33,3 +33,4 @@ pre {
33
33
  .alert {
34
34
  word-wrap: break-word;
35
35
  }
36
+
@@ -1,7 +1,7 @@
1
1
  <% content_for(:content) do %>
2
2
  <div class="article maincontent bastion" data-no-turbolink="true">
3
3
  <section class="container-fluid">
4
- <div class="row" ui-view></div>
4
+ <div ui-view></div>
5
5
  </section>
6
6
  </div>
7
7
  <% end %>
data/bower.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "es5-shim": "~2.0.8",
8
8
  "angular": "=1.5.5",
9
9
  "angular-bootstrap": "0.10.0",
10
- "angular": "=1.5.5",
10
+ "angular-breadcrumb": "=0.4.1",
11
11
  "angular-sanitize": "=1.5.5",
12
12
  "angular-resource": "=1.5.5",
13
13
  "angular-route": "=1.5.5",
@@ -61,6 +61,9 @@
61
61
  "ui-bootstrap-tpls.js"
62
62
  ]
63
63
  },
64
+ "angular-breadcrumb": {
65
+ "javascripts/bastion/angular-breadcrumb": "dist/angular-breadcrumb.js"
66
+ },
64
67
  "angular-animate": {
65
68
  "javascripts/bastion/angular-animate": "angular-animate.js"
66
69
  },
@@ -1,3 +1,3 @@
1
1
  module Bastion
2
- VERSION = "3.3.6"
2
+ VERSION = "3.4.0"
3
3
  end
@@ -0,0 +1,369 @@
1
+ /*! angular-breadcrumb - v0.4.0-dev-2015-08-07
2
+ * http://ncuillery.github.io/angular-breadcrumb
3
+ * Copyright (c) 2015 Nicolas Cuillery; Licensed MIT */
4
+
5
+ (function (window, angular, undefined) {
6
+ 'use strict';
7
+
8
+ function isAOlderThanB(scopeA, scopeB) {
9
+ if(angular.equals(scopeA.length, scopeB.length)) {
10
+ return scopeA > scopeB;
11
+ } else {
12
+ return scopeA.length > scopeB.length;
13
+ }
14
+ }
15
+
16
+ function parseStateRef(ref) {
17
+ var parsed = ref.replace(/\n/g, " ").match(/^([^(]+?)\s*(\((.*)\))?$/);
18
+ if (!parsed || parsed.length !== 4) { throw new Error("Invalid state ref '" + ref + "'"); }
19
+ return { state: parsed[1], paramExpr: parsed[3] || null };
20
+ }
21
+
22
+ function $Breadcrumb() {
23
+
24
+ var $$options = {
25
+ prefixStateName: null,
26
+ template: 'bootstrap3',
27
+ templateUrl: null,
28
+ includeAbstract : false
29
+ };
30
+
31
+ this.setOptions = function(options) {
32
+ angular.extend($$options, options);
33
+ };
34
+
35
+ this.$get = ['$state', '$stateParams', '$rootScope', function($state, $stateParams, $rootScope) {
36
+
37
+ var $lastViewScope = $rootScope;
38
+
39
+ // Early catch of $viewContentLoaded event
40
+ $rootScope.$on('$viewContentLoaded', function (event) {
41
+ // With nested views, the event occur several times, in "wrong" order
42
+ if(!event.targetScope.ncyBreadcrumbIgnore &&
43
+ isAOlderThanB(event.targetScope.$id, $lastViewScope.$id)) {
44
+ $lastViewScope = event.targetScope;
45
+ }
46
+ });
47
+
48
+ // Get the parent state
49
+ var $$parentState = function(state) {
50
+ // Check if state has explicit parent OR we try guess parent from its name
51
+ var parent = state.parent || (/^(.+)\.[^.]+$/.exec(state.name) || [])[1];
52
+ var isObjectParent = typeof parent === "object";
53
+ // if parent is a object reference, then extract the name
54
+ return isObjectParent ? parent.name : parent;
55
+ };
56
+
57
+ // Add the state in the chain if not already in and if not abstract
58
+ var $$addStateInChain = function(chain, stateRef) {
59
+ var conf,
60
+ parentParams,
61
+ ref = parseStateRef(stateRef),
62
+ force = false,
63
+ skip = false;
64
+
65
+ for(var i=0, l=chain.length; i<l; i+=1) {
66
+ if (chain[i].name === ref.state) {
67
+ return;
68
+ }
69
+ }
70
+
71
+ conf = $state.get(ref.state);
72
+ // Get breadcrumb options
73
+ if(conf.ncyBreadcrumb) {
74
+ if(conf.ncyBreadcrumb.force){ force = true; }
75
+ if(conf.ncyBreadcrumb.skip){ skip = true; }
76
+ }
77
+ if((!conf.abstract || $$options.includeAbstract || force) && !skip) {
78
+ if(ref.paramExpr) {
79
+ parentParams = $lastViewScope.$eval(ref.paramExpr);
80
+ }
81
+
82
+ conf.ncyBreadcrumbLink = $state.href(ref.state, parentParams || $stateParams || {});
83
+ chain.unshift(conf);
84
+ }
85
+ };
86
+
87
+ // Get the state for the parent step in the breadcrumb
88
+ var $$breadcrumbParentState = function(stateRef) {
89
+ var ref = parseStateRef(stateRef),
90
+ conf = $state.get(ref.state);
91
+
92
+ if(conf.ncyBreadcrumb && conf.ncyBreadcrumb.parent) {
93
+ // Handle the "parent" property of the breadcrumb, override the parent/child relation of the state
94
+ var isFunction = typeof conf.ncyBreadcrumb.parent === 'function';
95
+ var parentStateRef = isFunction ? conf.ncyBreadcrumb.parent($lastViewScope) : conf.ncyBreadcrumb.parent;
96
+ if(parentStateRef) {
97
+ return parentStateRef;
98
+ }
99
+ }
100
+
101
+ return $$parentState(conf);
102
+ };
103
+
104
+ return {
105
+
106
+ getTemplate: function(templates) {
107
+ if($$options.templateUrl) {
108
+ // templateUrl takes precedence over template
109
+ return null;
110
+ } else if(templates[$$options.template]) {
111
+ // Predefined templates (bootstrap, ...)
112
+ return templates[$$options.template];
113
+ } else {
114
+ return $$options.template;
115
+ }
116
+ },
117
+
118
+ getTemplateUrl: function() {
119
+ return $$options.templateUrl;
120
+ },
121
+
122
+ getStatesChain: function(exitOnFirst) { // Deliberately undocumented param, see getLastStep
123
+ var chain = [];
124
+
125
+ // From current state to the root
126
+ for(var stateRef = $state.$current.self.name; stateRef; stateRef=$$breadcrumbParentState(stateRef)) {
127
+ $$addStateInChain(chain, stateRef);
128
+ if(exitOnFirst && chain.length) {
129
+ return chain;
130
+ }
131
+ }
132
+
133
+ // Prefix state treatment
134
+ if($$options.prefixStateName) {
135
+ $$addStateInChain(chain, $$options.prefixStateName);
136
+ }
137
+
138
+ return chain;
139
+ },
140
+
141
+ getLastStep: function() {
142
+ var chain = this.getStatesChain(true);
143
+ return chain.length ? chain[0] : undefined;
144
+ },
145
+
146
+ $getLastViewScope: function() {
147
+ return $lastViewScope;
148
+ }
149
+ };
150
+ }];
151
+ }
152
+
153
+ var getExpression = function(interpolationFunction) {
154
+ if(interpolationFunction.expressions) {
155
+ return interpolationFunction.expressions;
156
+ } else {
157
+ var expressions = [];
158
+ angular.forEach(interpolationFunction.parts, function(part) {
159
+ if(angular.isFunction(part)) {
160
+ expressions.push(part.exp);
161
+ }
162
+ });
163
+ return expressions;
164
+ }
165
+ };
166
+
167
+ var registerWatchers = function(labelWatcherArray, interpolationFunction, viewScope, step) {
168
+ angular.forEach(getExpression(interpolationFunction), function(expression) {
169
+ var watcher = viewScope.$watch(expression, function() {
170
+ step.ncyBreadcrumbLabel = interpolationFunction(viewScope);
171
+ });
172
+ labelWatcherArray.push(watcher);
173
+ });
174
+
175
+ };
176
+
177
+ var deregisterWatchers = function(labelWatcherArray) {
178
+ angular.forEach(labelWatcherArray, function(deregisterWatch) {
179
+ deregisterWatch();
180
+ });
181
+ };
182
+
183
+ function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
184
+ var $$templates = {
185
+ bootstrap2: '<ul class="breadcrumb">' +
186
+ '<li ng-repeat="step in steps" ng-switch="$last || !!step.abstract" ng-class="{active: $last}">' +
187
+ '<a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a>' +
188
+ '<span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span>' +
189
+ '<span class="divider" ng-hide="$last">/</span>' +
190
+ '</li>' +
191
+ '</ul>',
192
+ bootstrap3: '<ol class="breadcrumb">' +
193
+ '<li ng-repeat="step in steps" ng-class="{active: $last}" ng-switch="$last || !!step.abstract">' +
194
+ '<a ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}">{{step.ncyBreadcrumbLabel}}</a>' +
195
+ '<span ng-switch-when="true">{{step.ncyBreadcrumbLabel}}</span>' +
196
+ '</li>' +
197
+ '</ol>'
198
+ };
199
+
200
+ return {
201
+ restrict: 'AE',
202
+ replace: true,
203
+ scope: {},
204
+ template: $breadcrumb.getTemplate($$templates),
205
+ templateUrl: $breadcrumb.getTemplateUrl(),
206
+ link: {
207
+ post: function postLink(scope) {
208
+ var labelWatchers = [];
209
+
210
+ var renderBreadcrumb = function() {
211
+ deregisterWatchers(labelWatchers);
212
+ labelWatchers = [];
213
+
214
+ var viewScope = $breadcrumb.$getLastViewScope();
215
+ scope.steps = $breadcrumb.getStatesChain();
216
+ angular.forEach(scope.steps, function (step) {
217
+ if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
218
+ var parseLabel = $interpolate(step.ncyBreadcrumb.label);
219
+ step.ncyBreadcrumbLabel = parseLabel(viewScope);
220
+ // Watcher for further viewScope updates
221
+ registerWatchers(labelWatchers, parseLabel, viewScope, step);
222
+ } else {
223
+ step.ncyBreadcrumbLabel = step.name;
224
+ }
225
+ });
226
+ };
227
+
228
+ $rootScope.$on('$viewContentLoaded', function (event) {
229
+ if(!event.targetScope.ncyBreadcrumbIgnore) {
230
+ renderBreadcrumb();
231
+ }
232
+ });
233
+
234
+ // View(s) may be already loaded while the directive's linking
235
+ renderBreadcrumb();
236
+ }
237
+ }
238
+ };
239
+ }
240
+ BreadcrumbDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
241
+
242
+ function BreadcrumbLastDirective($interpolate, $breadcrumb, $rootScope) {
243
+
244
+ return {
245
+ restrict: 'A',
246
+ scope: {},
247
+ template: '{{ncyBreadcrumbLabel}}',
248
+ compile: function(cElement, cAttrs) {
249
+
250
+ // Override the default template if ncyBreadcrumbLast has a value
251
+ var template = cElement.attr(cAttrs.$attr.ncyBreadcrumbLast);
252
+ if(template) {
253
+ cElement.html(template);
254
+ }
255
+
256
+ return {
257
+ post: function postLink(scope) {
258
+ var labelWatchers = [];
259
+
260
+ var renderLabel = function() {
261
+ deregisterWatchers(labelWatchers);
262
+ labelWatchers = [];
263
+
264
+ var viewScope = $breadcrumb.$getLastViewScope();
265
+ var lastStep = $breadcrumb.getLastStep();
266
+ if(lastStep) {
267
+ scope.ncyBreadcrumbLink = lastStep.ncyBreadcrumbLink;
268
+ if (lastStep.ncyBreadcrumb && lastStep.ncyBreadcrumb.label) {
269
+ var parseLabel = $interpolate(lastStep.ncyBreadcrumb.label);
270
+ scope.ncyBreadcrumbLabel = parseLabel(viewScope);
271
+ // Watcher for further viewScope updates
272
+ // Tricky last arg: the last step is the entire scope of the directive !
273
+ registerWatchers(labelWatchers, parseLabel, viewScope, scope);
274
+ } else {
275
+ scope.ncyBreadcrumbLabel = lastStep.name;
276
+ }
277
+ }
278
+ };
279
+
280
+ $rootScope.$on('$viewContentLoaded', function (event) {
281
+ if(!event.targetScope.ncyBreadcrumbIgnore) {
282
+ renderLabel();
283
+ }
284
+ });
285
+
286
+ // View(s) may be already loaded while the directive's linking
287
+ renderLabel();
288
+ }
289
+ };
290
+
291
+ }
292
+ };
293
+ }
294
+ BreadcrumbLastDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
295
+
296
+ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
297
+
298
+ return {
299
+ restrict: 'A',
300
+ scope: {},
301
+ template: '{{ncyBreadcrumbChain}}',
302
+
303
+ compile: function(cElement, cAttrs) {
304
+ // Override the default template if ncyBreadcrumbText has a value
305
+ var template = cElement.attr(cAttrs.$attr.ncyBreadcrumbText);
306
+ if(template) {
307
+ cElement.html(template);
308
+ }
309
+
310
+ var separator = cElement.attr(cAttrs.$attr.ncyBreadcrumbTextSeparator) || ' / ';
311
+
312
+ return {
313
+ post: function postLink(scope) {
314
+ var labelWatchers = [];
315
+
316
+ var registerWatchersText = function(labelWatcherArray, interpolationFunction, viewScope) {
317
+ angular.forEach(getExpression(interpolationFunction), function(expression) {
318
+ var watcher = viewScope.$watch(expression, function(newValue, oldValue) {
319
+ if (newValue !== oldValue) {
320
+ renderLabel();
321
+ }
322
+ });
323
+ labelWatcherArray.push(watcher);
324
+ });
325
+ };
326
+
327
+ var renderLabel = function() {
328
+ deregisterWatchers(labelWatchers);
329
+ labelWatchers = [];
330
+
331
+ var viewScope = $breadcrumb.$getLastViewScope();
332
+ var steps = $breadcrumb.getStatesChain();
333
+ var combinedLabels = [];
334
+ angular.forEach(steps, function (step) {
335
+ if (step.ncyBreadcrumb && step.ncyBreadcrumb.label) {
336
+ var parseLabel = $interpolate(step.ncyBreadcrumb.label);
337
+ combinedLabels.push(parseLabel(viewScope));
338
+ // Watcher for further viewScope updates
339
+ registerWatchersText(labelWatchers, parseLabel, viewScope);
340
+ } else {
341
+ combinedLabels.push(step.name);
342
+ }
343
+ });
344
+
345
+ scope.ncyBreadcrumbChain = combinedLabels.join(separator);
346
+ };
347
+
348
+ $rootScope.$on('$viewContentLoaded', function (event) {
349
+ if(!event.targetScope.ncyBreadcrumbIgnore) {
350
+ renderLabel();
351
+ }
352
+ });
353
+
354
+ // View(s) may be already loaded while the directive's linking
355
+ renderLabel();
356
+ }
357
+ };
358
+
359
+ }
360
+ };
361
+ }
362
+ BreadcrumbTextDirective.$inject = ['$interpolate', '$breadcrumb', '$rootScope'];
363
+
364
+ angular.module('ncy-angular-breadcrumb', ['ui.router.state'])
365
+ .provider('$breadcrumb', $Breadcrumb)
366
+ .directive('ncyBreadcrumb', BreadcrumbDirective)
367
+ .directive('ncyBreadcrumbLast', BreadcrumbLastDirective)
368
+ .directive('ncyBreadcrumbText', BreadcrumbTextDirective);
369
+ })(window, window.angular);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bastion
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.6
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric D Helms
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-21 00:00:00.000000000 Z
12
+ date: 2016-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: angular-rails-templates
@@ -140,8 +140,11 @@ files:
140
140
  - app/assets/javascripts/bastion/layouts/404.html
141
141
  - app/assets/javascripts/bastion/layouts/details-nutupane.html
142
142
  - app/assets/javascripts/bastion/layouts/nutupane.html
143
+ - app/assets/javascripts/bastion/layouts/page-with-breadcrumbs.html
143
144
  - app/assets/javascripts/bastion/layouts/panel.html
144
145
  - app/assets/javascripts/bastion/layouts/select-all-results.html
146
+ - app/assets/javascripts/bastion/layouts/table.html
147
+ - app/assets/javascripts/bastion/layouts/two-column.html
145
148
  - app/assets/javascripts/bastion/menu/menu-expander.service.js
146
149
  - app/assets/javascripts/bastion/menu/menu.module.js
147
150
  - app/assets/javascripts/bastion/routing.module.js
@@ -151,7 +154,7 @@ files:
151
154
  - app/assets/javascripts/bastion/utils/utils.module.js
152
155
  - app/assets/stylesheets/bastion/animations.scss
153
156
  - app/assets/stylesheets/bastion/bastion.scss
154
- - app/assets/stylesheets/bastion/details-page.scss
157
+ - app/assets/stylesheets/bastion/components.scss
155
158
  - app/assets/stylesheets/bastion/forms.scss
156
159
  - app/assets/stylesheets/bastion/helpers.scss
157
160
  - app/assets/stylesheets/bastion/mixins.scss
@@ -220,6 +223,7 @@ files:
220
223
  - vendor/assets/javascripts/bastion/angular-blocks/angular-blocks.js
221
224
  - vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap-tpls.js
222
225
  - vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap.js
226
+ - vendor/assets/javascripts/bastion/angular-breadcrumb/angular-breadcrumb.js
223
227
  - vendor/assets/javascripts/bastion/angular-gettext/angular-gettext.js
224
228
  - vendor/assets/javascripts/bastion/angular-i18n/angular-locale_aa-dj.js
225
229
  - vendor/assets/javascripts/bastion/angular-i18n/angular-locale_aa-er.js
File without changes