fng-reports 0.12.0-beta.171 → 0.12.0-beta.175

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,326 +1,349 @@
1
- /*! forms-angular 2021-10-26 */
1
+ /*! forms-angular 2022-01-22 */
2
2
  'use strict';
3
3
 
4
4
  formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$scope', '$http', '$location', 'cssFrameworkService', 'routingService',
5
- function ($rootScope, $window, $filter, $scope, $http, $location, cssFrameworkService, routingService) {
6
- /*jshint newcap: false */
7
- var firstTime = true,
8
- pdfPlugIn = new ngGridPdfExportPlugin({inhibitButton: true}),
9
- csvPlugIn = new ngGridCsvExportPlugin({inhibitButton: true});
10
- /*jshint newcap: true */
11
-
12
- angular.extend($scope, routingService.parsePathFunc()($location.$$path));
13
-
14
- $scope.reportSchema = {
15
- columnDefs: []
16
- };
17
- $scope.gridOptions = {
18
- data: 'report',
19
- columnDefs: $scope.reportSchema.columnDefs,
20
- showColumnMenu: true,
21
- enableRowHeaderSelection: false,
22
- enableFiltering: false,
23
- showGridFooter: false,
24
- reallyShowFooter: false, // this determines whether it is actually displayed or not
25
- showTotals: true,
26
- enableColumnResizing: true,
5
+ function ($rootScope, $window, $filter, $scope, $http, $location, cssFrameworkService, routingService) {
6
+ /*jshint newcap: false */
7
+ var firstTime = true,
8
+ pdfPlugIn = new ngGridPdfExportPlugin({inhibitButton: true}),
9
+ csvPlugIn = new ngGridCsvExportPlugin({inhibitButton: true});
10
+ /*jshint newcap: true */
11
+
12
+ angular.extend($scope, routingService.parsePathFunc()($location.$$path));
13
+
14
+ $scope.reportSchema = {
15
+ columnDefs: []
16
+ };
17
+ $scope.gridOptions = {
18
+ data: 'report',
19
+ columnDefs: $scope.reportSchema.columnDefs,
20
+ showColumnMenu: true,
21
+ enableRowHeaderSelection: false,
22
+ enableFiltering: false,
23
+ showGridFooter: false,
24
+ reallyShowFooter: false, // this determines whether it is actually displayed or not
25
+ showTotals: true,
26
+ enableColumnResizing: true,
27
27
  // enableColumnReordering: true,
28
28
  // jqueryUIDraggable: true,
29
- footerRowHeight: 65,
30
- multiSelect: false,
31
- plugins: [pdfPlugIn, csvPlugIn],
32
- onRegisterApi : function (gridApi) {
33
- $scope.gridApi = gridApi;
34
- $scope.gridOptions.plugins.forEach(function(p) {p.init($scope, gridApi.grid, null); });
35
- gridApi.selection.on.rowSelectionChanged($scope, function afterSelectionChange(rowItem) {
36
- var url = $scope.reportSchema.drilldown;
37
- if (url) {
38
- url = routingService.buildUrl(url.replace(/\|.+?\|/g, function (match) {
39
- var param = match.slice(1, -1),
40
- isParamTest = /\((.+)\)/.exec(param);
41
- if (isParamTest) {
42
- var instructions = $scope.reportSchema.params[isParamTest[1]];
43
- if (instructions) {
44
- $scope.param = $scope.record[isParamTest[1]];
45
- if (instructions.conversionExpression) {
46
- return $scope.$eval(instructions.conversionExpression);
47
- } else {
48
- return instructions.value;
49
- }
50
- } else {
51
- return $scope.reportSchema.params[isParamTest[1]].value;
52
- }
53
- } else {
54
- return rowItem.entity[param];
55
- }
56
- }));
57
- window.location = url;
58
- }
59
- });
60
- },
61
- };
62
- $scope.report = [];
63
-
64
-
65
- if (!$scope.reportSchemaName && $location.$$search.r) {
66
- switch ($location.$$search.r.slice(0, 1)) {
67
- case '[' :
68
- $scope.reportSchema.pipeline = JSON.parse($location.$$search.r);
69
- break;
70
- case '{' :
71
- angular.extend($scope.reportSchema, JSON.parse($location.$$search.r));
72
- break;
73
- default :
74
- throw new Error('No report instructions specified');
75
- }
76
- }
77
-
78
- $scope.getTotalVal = function (field, filter) {
79
- var result = '',
80
- instructions = _.find($scope.reportSchema.columnDefs, function (col) {
81
- return col.field === field;
82
- });
83
-
84
- if (instructions) {
85
- switch (instructions.totalsRow) {
86
- case undefined :
87
- break;
88
- case '$SUM' :
89
- var sum = 0;
90
- for (var j = 0; j < $scope.report.length; j++) {
91
- sum += $scope.report[j][field];
92
- }
93
- result = sum;
94
- if (filter) {
95
- result = $filter(filter)(result);
29
+ footerRowHeight: 65,
30
+ multiSelect: false,
31
+ plugins: [pdfPlugIn, csvPlugIn],
32
+ onRegisterApi: function (gridApi) {
33
+ $scope.gridApi = gridApi;
34
+ $scope.gridOptions.plugins.forEach(function (p) {
35
+ p.init($scope, gridApi.grid, null);
36
+ });
37
+ gridApi.selection.on.rowSelectionChanged($scope, function afterSelectionChange(rowItem) {
38
+ var url = $scope.reportSchema.drilldown;
39
+ if (url) {
40
+ url = routingService.buildUrl(url.replace(/\|.+?\|/g, function (match) {
41
+ var param = match.slice(1, -1),
42
+ isParamTest = /\((.+)\)/.exec(param);
43
+ if (isParamTest) {
44
+ var instructions = $scope.reportSchema.params[isParamTest[1]];
45
+ if (instructions) {
46
+ $scope.param = $scope.record[isParamTest[1]];
47
+ if (instructions.conversionExpression) {
48
+ return $scope.$eval(instructions.conversionExpression);
49
+ } else {
50
+ return instructions.value;
51
+ }
52
+ } else {
53
+ return $scope.reportSchema.params[isParamTest[1]].value;
54
+ }
55
+ } else {
56
+ return rowItem.entity[param];
57
+ }
58
+ }));
59
+ window.location = url;
60
+ }
61
+ });
62
+ },
63
+ };
64
+ $scope.report = [];
65
+
66
+ function parseAndHandleError(str) {
67
+ try {
68
+ return JSON.parse(str);
69
+ } catch (e) {
70
+ throw new Error(`Invalid JSON ${str}
71
+ ${e.message}`);
96
72
  }
97
- break;
98
- default :
99
- result = instructions.totalsRow;
100
- break;
101
73
  }
102
- }
103
74
 
104
- return result;
105
- };
106
-
107
- $scope.$on('exportToPDF', function () {
108
- pdfPlugIn.createPDF();
109
- });
110
-
111
- $scope.$on('exportToCSV', function () {
112
- csvPlugIn.createCSV();
113
- });
114
-
115
- $scope.extractFilter = function(col, filters) {
116
- if (col.cellFilter) {
117
- var filterName;
118
- var filterParam;
119
- var paramPos = col.cellFilter.indexOf(':');
120
- if (paramPos === -1) {
121
- filterName = col.cellFilter;
122
- } else {
123
- filterName = col.cellFilter.slice(0, paramPos).trim();
124
- filterParam = col.cellFilter.slice(paramPos + 1, 999).trim();
125
- if (filterParam[0] === '\'' || filterParam[0] === '"') {
126
- filterParam = filterParam.slice(1,-1);
127
- }
128
- }
129
- var filter = angular.element(document.body).injector().get('$filter')(filterName.trim());
130
- filters[col.field] = {filter: filter, filterParam: filterParam };
131
- }
132
- };
133
-
134
- var container = document.querySelector('div.report-grow');
135
- if (container) {
136
- var margin = container.offsetLeft; // let's have the same top and bottom margins as we have side margin
137
- var topOffset = container.offsetTop + margin;
138
- var header = document.querySelector('div.ui-grid-header');
139
- var headerHeight = header ? header.clientHeight : 31;
140
- var availRows = Math.floor(($window.innerHeight - topOffset - headerHeight - margin) / 30);
141
- angular.element(container).css('height', '' + availRows * 30 + 'px');
142
- }
143
-
144
- var navScope = $rootScope.navScope;
145
- navScope.items = [
146
- {
147
- fn: pdfPlugIn.createPDF,
148
- text: 'Save as PDF'
149
- },
150
- {
151
- fn: csvPlugIn.createCSV,
152
- text: 'Export as CSV'
153
- }
154
- ];
155
- navScope.contextMenu = 'Report';
156
- $scope.titleWithSubstitutions = $scope.reportSchema.title;
157
-
158
- // inhibitRefresh can be set by a controller, for example if report data is being provided as part of the URL
159
- if (!$scope.inhibitRefresh) {
160
- $scope.refreshQuery = function () {
161
-
162
- function substituteParams(str) {
163
- return str.replace(/\|.+?\|/g, function (match) {
164
- var param = match.slice(1, -1);
165
- var isParamTest = /\((.+)\)/.exec(param);
166
- return isParamTest ? $scope.reportSchema.params[isParamTest[1]].value : '';
167
- });
75
+ if (!$scope.reportSchemaName && $location.$$search.r) {
76
+ switch ($location.$$search.r.slice(0, 1)) {
77
+ case '[' :
78
+ $scope.reportSchema.pipeline = parseAndHandleError($location.$$search.r);
79
+ break;
80
+ case '{' :
81
+ angular.extend($scope.reportSchema, parseAndHandleError($location.$$search.r));
82
+ break;
83
+ default :
84
+ throw new Error('No report instructions specified');
85
+ }
168
86
  }
169
87
 
170
- var apiCall = '/api/report/' + $scope.modelName;
171
- var connector = '?';
172
- var haveUrlParams = false;
173
- var query = $location.$$url.match(/\?.*/);
174
-
175
- if ($scope.reportSchemaName) {
176
- apiCall += '/' + $scope.reportSchemaName;
177
- } else if (query) {
178
- apiCall += connector + query[0].slice(1);
179
- connector = '&';
180
- haveUrlParams = true;
181
- }
88
+ $scope.getTotalVal = function (field, filter) {
89
+ var result = '',
90
+ instructions = _.find($scope.reportSchema.columnDefs, function (col) {
91
+ return col.field === field;
92
+ });
182
93
 
183
- if ($scope.paramSchema) {
184
- // we are using the params form
185
- for (var paramVal in $scope.record) {
186
- if ($scope.record.hasOwnProperty(paramVal)) {
187
- var instructions = $scope.reportSchema.params[paramVal];
188
- if ($scope.record[paramVal] && $scope.record[paramVal] !== '') {
189
- $scope.param = $scope.record[paramVal];
190
- if (instructions.conversionExpression) {
191
- $scope.param = $scope.$eval(instructions.conversionExpression);
94
+ if (instructions) {
95
+ switch (instructions.totalsRow) {
96
+ case undefined :
97
+ break;
98
+ case '$SUM' :
99
+ var sum = 0;
100
+ for (var j = 0; j < $scope.report.length; j++) {
101
+ sum += $scope.report[j][field];
102
+ }
103
+ result = sum;
104
+ if (filter) {
105
+ result = $filter(filter)(result);
106
+ }
107
+ break;
108
+ default :
109
+ result = instructions.totalsRow;
110
+ break;
192
111
  }
193
- apiCall += connector + paramVal + '=' + $scope.param;
194
- connector = '&';
195
- } else if (instructions.required) {
196
- // Don't do a round trip if a required field is empty - it will show up red
197
- return;
198
- }
199
- }
200
- }
201
- } else {
202
- if (!haveUrlParams && query) {
203
- apiCall += connector + query[0].slice(1);
204
- connector = '&';
205
- }
206
- }
207
- return $http.get(apiCall).then(function (response) {
208
- var data = response.data;
209
- if (data.success) {
210
- $scope.report = data.report;
211
- $scope.reportSchema = data.schema;
212
- $scope.reportSchema.title = $scope.reportSchema.title || $scope.modelName;
213
- $scope.titleWithSubstitutions = substituteParams($scope.reportSchema.title);
214
- $scope.gridOptions.enableFiltering = !!$scope.reportSchema.filter;
215
- if (navScope && navScope.items) {
216
- navScope.items.length = 2;
217
- if ($scope.reportSchema.menu) {
218
- $scope.reportSchema.menu.forEach(function(m){
219
- navScope.items.push(JSON.parse(substituteParams(JSON.stringify(m))));
220
- });
221
- }
222
112
  }
223
113
 
224
- /*
225
- Generate link data
226
- */
114
+ return result;
115
+ };
227
116
 
228
- if (firstTime) {
229
- firstTime = false;
117
+ $scope.$on('exportToPDF', function () {
118
+ pdfPlugIn.createPDF();
119
+ });
230
120
 
231
- $scope.$watch('reportSchema.columnDefs', function (newValue) {
232
- var columnTotals = false;
233
- if (newValue) {
234
- for (var i = 0; i < newValue.length; i++) {
235
- if (newValue[i].totalsRow) {
236
- columnTotals = true;
237
- }
238
- if (newValue[i].align) {
239
- var alignClass = 'fng-' + newValue[i].align;
240
- newValue[i].cellClass = newValue[i].cellClass || '';
241
- if (newValue[i].cellClass.indexOf(alignClass) === -1) {
242
- newValue[i].cellClass = newValue[i].cellClass + ' ' + alignClass;
243
- }
244
- }
245
- }
246
- // Auto-upgrade from ng-grid to ui-grid
247
- newValue.forEach(function (def) {
248
- // Remove px from column widths
249
- if (def.width && typeof def.width === 'string' && def.width.indexOf('px') !== -1) {
250
- def.width = parseInt(def.width.slice(0, -2));
121
+ $scope.$on('exportToCSV', function () {
122
+ csvPlugIn.createCSV();
123
+ });
124
+
125
+ $scope.extractFilter = function (col, filters) {
126
+ if (col.cellFilter) {
127
+ var filterName;
128
+ var filterParam;
129
+ var paramPos = col.cellFilter.indexOf(':');
130
+ if (paramPos === -1) {
131
+ filterName = col.cellFilter;
132
+ } else {
133
+ filterName = col.cellFilter.slice(0, paramPos).trim();
134
+ filterParam = col.cellFilter.slice(paramPos + 1, 999).trim();
135
+ if (filterParam[0] === '\'' || filterParam[0] === '"') {
136
+ filterParam = filterParam.slice(1, -1);
251
137
  }
252
- });
253
- $scope.gridOptions.columnDefs = newValue;
254
138
  }
255
- $scope.gridOptions.showTotals = columnTotals;
256
- $scope.gridOptions.reallyShowFooter = columnTotals;
257
- $scope.gridOptions.footerRowHeight = 55 + (columnTotals ? 10 : 0);
258
- }, true);
259
-
260
- if (!$scope.paramSchema && data.schema.params) {
261
- $scope.paramSchema = [];
262
- // set up parameters
263
- $scope.record = {};
264
- for (var param in data.schema.params) {
265
- if (data.schema.params.hasOwnProperty(param)) {
266
- var thisPart = data.schema.params[param];
139
+ var filter = angular.element(document.body).injector().get('$filter')(filterName.trim());
140
+ filters[col.field] = {filter: filter, filterParam: filterParam};
141
+ }
142
+ };
143
+
144
+ function setupParamsForm(params) {
145
+ $scope.paramSchema = [];
146
+ // set up parameters
147
+ $scope.record = {};
148
+ for (var param in params) {
149
+ if (params.hasOwnProperty(param)) {
150
+ var thisPart = params[param];
267
151
  // if noInput then this value will be inferred from another parameter
268
152
  if (!thisPart.noInput) {
269
- var newLen = $scope.paramSchema.push({
270
- name: param,
271
- id: 'fp_' + param,
272
- label: thisPart.label || $filter('titleCase')(param),
273
- type: thisPart.type || 'text',
274
- required: true,
275
- add: thisPart.add || undefined,
276
- size: thisPart.size || (cssFrameworkService.frameWork === 'bs3' ? 'large' : 'medium')
277
- });
278
- if (thisPart.type === 'select') {
279
- // TODO: Remove when select and select2 is modified during the restructure
280
- $scope[param + '_Opts'] = thisPart.enum;
281
- $scope.paramSchema[newLen - 1].options = param + '_Opts';
282
- }
153
+ var newLen = $scope.paramSchema.push({
154
+ name: param,
155
+ id: 'fp_' + param,
156
+ label: thisPart.label || $filter('titleCase')(param),
157
+ type: thisPart.type || 'text',
158
+ required: true,
159
+ add: thisPart.add || undefined,
160
+ size: thisPart.size || (cssFrameworkService.frameWork === 'bs3' ? 'large' : 'medium')
161
+ });
162
+ if (thisPart.type === 'select') {
163
+ // TODO: Remove when select and select2 is modified during the restructure
164
+ $scope[param + '_Opts'] = thisPart.enum;
165
+ $scope.paramSchema[newLen - 1].options = param + '_Opts';
166
+ }
283
167
  }
284
168
  var dateTest = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(thisPart.value);
285
169
  if (dateTest) {
286
- thisPart.value = new Date(dateTest[1]);
170
+ thisPart.value = new Date(dateTest[1]);
287
171
  }
288
172
  $scope.record[param] = thisPart.value;
289
- }
290
173
  }
291
- $scope.$watch('record', function (newValue, oldValue) {
292
- if (oldValue !== newValue) {
174
+ }
175
+ $scope.$watch('record', function (newValue, oldValue) {
176
+ if (oldValue !== newValue) {
177
+ console.log('In the record watch ', JSON.stringify(newValue, null, 2));
293
178
  $scope.refreshQuery();
294
- }
295
- }, true);
179
+ }
180
+ }, true);
181
+ }
296
182
 
297
- }
183
+ var container = document.querySelector('div.report-grow');
184
+ if (container) {
185
+ var margin = container.offsetLeft; // let's have the same top and bottom margins as we have side margin
186
+ var topOffset = container.offsetTop + margin;
187
+ var header = document.querySelector('div.ui-grid-header');
188
+ var headerHeight = header ? header.clientHeight : 31;
189
+ var availRows = Math.floor(($window.innerHeight - topOffset - headerHeight - margin) / 30);
190
+ angular.element(container).css('height', '' + availRows * 30 + 'px');
191
+ }
192
+
193
+ var navScope = $rootScope.navScope;
194
+ navScope.items = [
195
+ {
196
+ fn: pdfPlugIn.createPDF,
197
+ text: 'Save as PDF'
198
+ },
199
+ {
200
+ fn: csvPlugIn.createCSV,
201
+ text: 'Export as CSV'
298
202
  }
299
- } else {
300
- console.log(JSON.stringify(data));
301
- $scope.reportSchema.title = 'Error - see console log';
302
- }
303
- }, function (response) {
304
- console.log(JSON.stringify(response));
305
- $location.url('/404');
306
- });
307
- };
203
+ ];
204
+ navScope.contextMenu = 'Report';
205
+ $scope.titleWithSubstitutions = $scope.reportSchema.title;
308
206
 
309
- $scope.refreshQuery();
310
- }
207
+ // inhibitRefresh can be set by a controller, for example if report data is being provided as part of the URL
208
+ if (!$scope.inhibitRefresh) {
311
209
 
312
- // Check whether a cell template shows the content (in which case we want to output it) or does something funky
313
- // (for example displays an image)
314
- $scope.showsContent = function(template) {
315
- return /{{[\s]*COL_FIELD[\s]*}}/.test(template.replace(/(<([^>]+)>)/gi, ''));
316
- };
210
+ $scope.refreshQuery = function () {
317
211
 
318
- $scope.$on('$locationChangeStart', function() {
319
- delete navScope.contextMenu;
320
- delete navScope.items;
321
- });
212
+ function substituteParams(str) {
213
+ return str.replace(/\|.+?\|/g, function (match) {
214
+ var param = match.slice(1, -1);
215
+ var isParamTest = /\((.+)\)/.exec(param);
216
+ return isParamTest ? $scope.reportSchema.params[isParamTest[1]].value : '';
217
+ });
218
+ }
219
+
220
+ var apiCall = '/api/report/' + $scope.modelName;
221
+ var connector = '?';
222
+ var haveUrlParams = false;
223
+ var query = $location.$$url.match(/\?.*/);
224
+
225
+ if ($scope.reportSchemaName) {
226
+ apiCall += '/' + $scope.reportSchemaName;
227
+ } else if (query) {
228
+ if (firstTime) {
229
+ // See if we have params in the URL (rather than going through schemaName)
230
+ $scope.paramSchema = JSON.parse($location.search().r).params;
231
+ setupParamsForm($scope.paramSchema);
232
+ }
233
+ apiCall += connector + query[0].slice(1);
234
+ connector = '&';
235
+ haveUrlParams = true;
236
+ }
237
+
238
+ if ($scope.paramSchema) {
239
+ // we are using the params form
240
+ for (var paramVal in $scope.record) {
241
+ if ($scope.record.hasOwnProperty(paramVal)) {
242
+ var instructions = $scope.reportSchema.params[paramVal];
243
+ if ($scope.record[paramVal] && $scope.record[paramVal] !== '') {
244
+ $scope.param = $scope.record[paramVal];
245
+ if (instructions.conversionExpression) {
246
+ $scope.param = $scope.$eval(instructions.conversionExpression);
247
+ }
248
+ apiCall += connector + paramVal + '=' + $scope.param;
249
+ connector = '&';
250
+ } else if (instructions.required) {
251
+ // Don't do a round trip if a required field is empty - it will show up red
252
+ return;
253
+ }
254
+ }
255
+ }
256
+ } else {
257
+ if (!haveUrlParams && query) {
258
+ apiCall += connector + query[0].slice(1);
259
+ connector = '&';
260
+ }
261
+ }
262
+ return $http.get(apiCall).then(function (response) {
263
+ console.log('back');
264
+ var data = response.data;
265
+ if (data.success) {
266
+ $scope.report = data.report;
267
+ $scope.reportSchema = data.schema;
268
+ $scope.reportSchema.title = $scope.reportSchema.title || $scope.modelName;
269
+ $scope.titleWithSubstitutions = substituteParams($scope.reportSchema.title);
270
+ $scope.gridOptions.enableFiltering = !!$scope.reportSchema.filter;
271
+ if (navScope && navScope.items) {
272
+ navScope.items.length = 2;
273
+ if ($scope.reportSchema.menu) {
274
+ $scope.reportSchema.menu.forEach(function (m) {
275
+ navScope.items.push(JSON.parse(substituteParams(JSON.stringify(m))));
276
+ });
277
+ }
278
+ }
279
+
280
+ /*
281
+ Generate link data
282
+ */
283
+
284
+ if (firstTime) {
285
+ firstTime = false;
286
+
287
+ $scope.$watch('reportSchema.columnDefs', function (newValue) {
288
+ var columnTotals = false;
289
+ if (newValue) {
290
+ for (var i = 0; i < newValue.length; i++) {
291
+ if (newValue[i].totalsRow) {
292
+ columnTotals = true;
293
+ }
294
+ if (newValue[i].align) {
295
+ var alignClass = 'fng-' + newValue[i].align;
296
+ newValue[i].cellClass = newValue[i].cellClass || '';
297
+ if (newValue[i].cellClass.indexOf(alignClass) === -1) {
298
+ newValue[i].cellClass = newValue[i].cellClass + ' ' + alignClass;
299
+ }
300
+ }
301
+ }
302
+ // Auto-upgrade from ng-grid to ui-grid
303
+ newValue.forEach(function (def) {
304
+ // Remove px from column widths
305
+ if (def.width && typeof def.width === 'string' && def.width.indexOf('px') !== -1) {
306
+ def.width = parseInt(def.width.slice(0, -2));
307
+ }
308
+ });
309
+ $scope.gridOptions.columnDefs = newValue;
310
+ }
311
+ $scope.gridOptions.showTotals = columnTotals;
312
+ $scope.gridOptions.reallyShowFooter = columnTotals;
313
+ $scope.gridOptions.footerRowHeight = 55 + (columnTotals ? 10 : 0);
314
+ }, true);
315
+
316
+ if (!$scope.paramSchema && data.schema.params) {
317
+ setupParamsForm(data.schema.params);
318
+ }
319
+ }
320
+ } else {
321
+ console.log(JSON.stringify(data));
322
+ $scope.reportSchema.title = 'Error - see console log';
323
+ }
324
+ }, function (response) {
325
+ console.log(JSON.stringify(response));
326
+ $location.url('/404');
327
+ });
328
+ };
329
+
330
+ console.log('From the bottom');
331
+
332
+ $scope.refreshQuery();
333
+ }
334
+
335
+ // Check whether a cell template shows the content (in which case we want to output it) or does something funky
336
+ // (for example displays an image)
337
+ $scope.showsContent = function (template) {
338
+ return /{{[\s]*COL_FIELD[\s]*}}/.test(template.replace(/(<([^>]+)>)/gi, ''));
339
+ };
340
+
341
+ $scope.$on('$locationChangeStart', function () {
342
+ delete navScope.contextMenu;
343
+ delete navScope.items;
344
+ });
322
345
 
323
- }]);
346
+ }]);
324
347
 
325
348
  'use strict';
326
349
  var COL_FIELD = /COL_FIELD/g;