kms 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/kms/application/controllers/pages_controller.coffee.erb +1 -2
- data/app/assets/javascripts/templates/assets/index.html.slim +4 -12
- data/app/assets/javascripts/templates/help/scopes.html.slim +74 -0
- data/app/assets/javascripts/templates/pages/index.html.slim +4 -3
- data/app/assets/javascripts/templates/snippets/index.html.slim +4 -3
- data/app/assets/javascripts/templates/templates/index.html.slim +4 -3
- data/app/assets/javascripts/templates/users/index.html.slim +3 -2
- data/app/assets/stylesheets/kms/custom.css.scss +3 -0
- data/app/controllers/kms/pages_controller.rb +2 -2
- data/app/models/ability.rb +0 -1
- data/app/models/concerns/kms/positioned.rb +18 -0
- data/app/models/kms/page.rb +2 -12
- data/app/services/kms/functions_registry.rb +11 -0
- data/app/uploaders/kms/asset_uploader.rb +1 -1
- data/config/initializers/help.rb +1 -1
- data/config/initializers/liquor.rb +0 -47
- data/config/locales/en.yml +22 -0
- data/config/locales/ru.yml +22 -0
- data/lib/generators/kms/install/install_generator.rb +2 -0
- data/lib/generators/kms/install/templates/carrierwave.rb +14 -0
- data/lib/kms/dependencies.rb +2 -0
- data/lib/kms/engine.rb +1 -1
- data/lib/kms/version.rb +1 -1
- data/spec/controllers/kms/snippets_controller_spec.rb +6 -6
- data/spec/internal/log/test.log +2439 -0
- data/spec/services/kms/functions_registry_spec.rb +14 -0
- data/spec/spec_helper.rb +1 -1
- data/vendor/assets/bower.json +1 -1
- data/vendor/assets/bower_components/angular-ui-tree/CHANGELOG.md +164 -0
- data/vendor/assets/bower_components/angular-ui-tree/CONTRIBUTING.md +39 -0
- data/vendor/assets/bower_components/angular-ui-tree/README.md +145 -37
- data/vendor/assets/bower_components/angular-ui-tree/bower.json +28 -18
- data/vendor/assets/bower_components/angular-ui-tree/{source → dist}/angular-ui-tree.css +18 -16
- data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.js +1408 -822
- data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.min.css +1 -2
- data/vendor/assets/bower_components/angular-ui-tree/dist/angular-ui-tree.min.js +3 -3
- data/vendor/assets/bower_components/angular-ui-tree/e2e/basic-example/basic-example.js +81 -0
- data/vendor/assets/bower_components/angular-ui-tree/e2e/basic-example/page.js +42 -0
- data/vendor/assets/bower_components/angular-ui-tree/e2e/table-example/page.js +31 -0
- data/vendor/assets/bower_components/angular-ui-tree/e2e/table-example/table-example.js +34 -0
- data/vendor/assets/bower_components/angular-ui-tree/index.js +2 -0
- data/vendor/assets/bower_components/angular-ui-tree/protractor.conf.js +19 -0
- data/vendor/assets/bower_components/angular/angular.js +4880 -2111
- data/vendor/assets/bower_components/angular/angular.min.js +320 -297
- data/vendor/assets/bower_components/angular/angular.min.js.gzip +0 -0
- data/vendor/assets/bower_components/angular/angular.min.js.map +3 -3
- data/vendor/assets/bower_components/angular/bower.json +1 -1
- data/vendor/assets/bower_components/angular/package.json +1 -1
- metadata +32 -40
- data/vendor/assets/bower_components/angular-ui-tree/Gruntfile.js +0 -229
- data/vendor/assets/bower_components/angular-ui-tree/build/compiler.jar +0 -0
- data/vendor/assets/bower_components/angular-ui-tree/demo/css/demo-horizontal.css +0 -47
- data/vendor/assets/bower_components/angular-ui-tree/demo/css/demo.css +0 -31
- data/vendor/assets/bower_components/angular-ui-tree/demo/css/tree.css +0 -25
- data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.js +0 -1243
- data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.min.css +0 -2
- data/vendor/assets/bower_components/angular-ui-tree/demo/dist/angular-ui-tree.min.js +0 -6
- data/vendor/assets/bower_components/angular-ui-tree/demo/filter.html +0 -64
- data/vendor/assets/bower_components/angular-ui-tree/demo/groups.html +0 -100
- data/vendor/assets/bower_components/angular-ui-tree/demo/index.html +0 -101
- data/vendor/assets/bower_components/angular-ui-tree/demo/js/demo.js +0 -63
- data/vendor/assets/bower_components/angular-ui-tree/demo/js/filter.js +0 -91
- data/vendor/assets/bower_components/angular-ui-tree/demo/js/groups.js +0 -143
- data/vendor/assets/bower_components/angular-ui-tree/demo/js/tree.js +0 -102
- data/vendor/assets/bower_components/angular-ui-tree/demo/js/trees.js +0 -60
- data/vendor/assets/bower_components/angular-ui-tree/demo/test.html +0 -60
- data/vendor/assets/bower_components/angular-ui-tree/demo/tree-horizontal.html +0 -66
- data/vendor/assets/bower_components/angular-ui-tree/demo/tree.html +0 -66
- data/vendor/assets/bower_components/angular-ui-tree/demo/trees.html +0 -92
- data/vendor/assets/bower_components/angular-ui-tree/guide/00_usage.ngdoc +0 -78
- data/vendor/assets/bower_components/angular-ui-tree/guide/01_development_setup.ngdoc +0 -58
- data/vendor/assets/bower_components/angular-ui-tree/guide/index.ngdoc +0 -33
- data/vendor/assets/bower_components/angular-ui-tree/karma.conf.js +0 -49
- data/vendor/assets/bower_components/angular-ui-tree/package.json +0 -40
- data/vendor/assets/bower_components/angular-ui-tree/source/angular-ui-tree.scss +0 -63
- data/vendor/assets/bower_components/angular-ui-tree/source/controllers/handleCtrl.js +0 -16
- data/vendor/assets/bower_components/angular-ui-tree/source/controllers/nodeCtrl.js +0 -141
- data/vendor/assets/bower_components/angular-ui-tree/source/controllers/nodesCtrl.js +0 -100
- data/vendor/assets/bower_components/angular-ui-tree/source/controllers/treeCtrl.js +0 -63
- data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTree.js +0 -115
- data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeHandle.js +0 -27
- data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeNode.js +0 -427
- data/vendor/assets/bower_components/angular-ui-tree/source/directives/uiTreeNodes.js +0 -59
- data/vendor/assets/bower_components/angular-ui-tree/source/main.js +0 -23
- data/vendor/assets/bower_components/angular-ui-tree/source/services/helper.js +0 -265
@@ -1,59 +0,0 @@
|
|
1
|
-
(function () {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
angular.module('ui.tree')
|
5
|
-
.directive('uiTreeNodes', [ 'treeConfig', '$window',
|
6
|
-
function(treeConfig) {
|
7
|
-
return {
|
8
|
-
require: ['ngModel', '?^uiTreeNode', '^uiTree'],
|
9
|
-
restrict: 'A',
|
10
|
-
scope: true,
|
11
|
-
controller: 'TreeNodesController',
|
12
|
-
link: function(scope, element, attrs, controllersArr) {
|
13
|
-
|
14
|
-
var config = {};
|
15
|
-
angular.extend(config, treeConfig);
|
16
|
-
if (config.nodesClass) {
|
17
|
-
element.addClass(config.nodesClass);
|
18
|
-
}
|
19
|
-
|
20
|
-
var ngModel = controllersArr[0];
|
21
|
-
var treeNodeCtrl = controllersArr[1];
|
22
|
-
var treeCtrl = controllersArr[2];
|
23
|
-
if (treeNodeCtrl) {
|
24
|
-
treeNodeCtrl.scope.$childNodesScope = scope;
|
25
|
-
scope.$nodeScope = treeNodeCtrl.scope;
|
26
|
-
}
|
27
|
-
else { // find the root nodes if there is no parent node and have a parent ui-tree
|
28
|
-
treeCtrl.scope.$nodesScope = scope;
|
29
|
-
}
|
30
|
-
scope.$treeScope = treeCtrl.scope;
|
31
|
-
|
32
|
-
if (ngModel) {
|
33
|
-
ngModel.$render = function() {
|
34
|
-
if (!ngModel.$modelValue || !angular.isArray(ngModel.$modelValue)) {
|
35
|
-
scope.$modelValue = [];
|
36
|
-
}
|
37
|
-
scope.$modelValue = ngModel.$modelValue;
|
38
|
-
};
|
39
|
-
}
|
40
|
-
|
41
|
-
scope.$watch(attrs.maxDepth, function(val) {
|
42
|
-
if((typeof val) == "number") {
|
43
|
-
scope.maxDepth = val;
|
44
|
-
}
|
45
|
-
});
|
46
|
-
|
47
|
-
attrs.$observe('nodrop', function(val) {
|
48
|
-
scope.nodrop = ((typeof val) != "undefined");
|
49
|
-
});
|
50
|
-
|
51
|
-
attrs.$observe('horizontal', function(val) {
|
52
|
-
scope.horizontal = ((typeof val) != "undefined");
|
53
|
-
});
|
54
|
-
|
55
|
-
}
|
56
|
-
};
|
57
|
-
}
|
58
|
-
]);
|
59
|
-
})();
|
@@ -1,23 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Angular UI Tree v2.1.5
|
3
|
-
* (c) 2010-2014. https://github.com/JimLiu/angular-ui-tree
|
4
|
-
* License: MIT
|
5
|
-
*/
|
6
|
-
(function () {
|
7
|
-
'use strict';
|
8
|
-
|
9
|
-
angular.module('ui.tree', [])
|
10
|
-
.constant('treeConfig', {
|
11
|
-
treeClass: 'angular-ui-tree',
|
12
|
-
emptyTreeClass: 'angular-ui-tree-empty',
|
13
|
-
hiddenClass: 'angular-ui-tree-hidden',
|
14
|
-
nodesClass: 'angular-ui-tree-nodes',
|
15
|
-
nodeClass: 'angular-ui-tree-node',
|
16
|
-
handleClass: 'angular-ui-tree-handle',
|
17
|
-
placeHolderClass: 'angular-ui-tree-placeholder',
|
18
|
-
dragClass: 'angular-ui-tree-drag',
|
19
|
-
dragThreshold: 3,
|
20
|
-
levelThreshold: 30
|
21
|
-
});
|
22
|
-
|
23
|
-
})();
|
@@ -1,265 +0,0 @@
|
|
1
|
-
(function () {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
angular.module('ui.tree')
|
5
|
-
|
6
|
-
/**
|
7
|
-
* @ngdoc service
|
8
|
-
* @name ui.tree.service:$helper
|
9
|
-
* @requires ng.$document
|
10
|
-
* @requires ng.$window
|
11
|
-
*
|
12
|
-
* @description
|
13
|
-
* angular-ui-tree.
|
14
|
-
*/
|
15
|
-
.factory('$uiTreeHelper', ['$document', '$window',
|
16
|
-
function ($document, $window) {
|
17
|
-
return {
|
18
|
-
|
19
|
-
/**
|
20
|
-
* A hashtable used to storage data of nodes
|
21
|
-
* @type {Object}
|
22
|
-
*/
|
23
|
-
nodesData: {
|
24
|
-
},
|
25
|
-
|
26
|
-
setNodeAttribute: function(scope, attrName, val) {
|
27
|
-
var data = this.nodesData[scope.$modelValue.$$hashKey];
|
28
|
-
if (!data) {
|
29
|
-
data = {};
|
30
|
-
this.nodesData[scope.$modelValue.$$hashKey] = data;
|
31
|
-
}
|
32
|
-
data[attrName] = val;
|
33
|
-
},
|
34
|
-
|
35
|
-
getNodeAttribute: function(scope, attrName) {
|
36
|
-
var data = this.nodesData[scope.$modelValue.$$hashKey];
|
37
|
-
if (data) {
|
38
|
-
return data[attrName];
|
39
|
-
}
|
40
|
-
return null;
|
41
|
-
},
|
42
|
-
|
43
|
-
/**
|
44
|
-
* @ngdoc method
|
45
|
-
* @methodOf ui.tree.service:$nodrag
|
46
|
-
* @param {Object} targetElm angular element
|
47
|
-
* @return {Bool} check if the node can be dragged.
|
48
|
-
*/
|
49
|
-
nodrag: function (targetElm) {
|
50
|
-
return (typeof targetElm.attr('data-nodrag')) != "undefined";
|
51
|
-
},
|
52
|
-
|
53
|
-
/**
|
54
|
-
* get the event object for touchs
|
55
|
-
* @param {[type]} e [description]
|
56
|
-
* @return {[type]} [description]
|
57
|
-
*/
|
58
|
-
eventObj: function(e) {
|
59
|
-
var obj = e;
|
60
|
-
if (e.targetTouches !== undefined) {
|
61
|
-
obj = e.targetTouches.item(0);
|
62
|
-
} else if (e.originalEvent !== undefined && e.originalEvent.targetTouches !== undefined) {
|
63
|
-
obj = e.originalEvent.targetTouches.item(0);
|
64
|
-
}
|
65
|
-
return obj;
|
66
|
-
},
|
67
|
-
|
68
|
-
dragInfo: function(node) {
|
69
|
-
return {
|
70
|
-
source: node,
|
71
|
-
sourceInfo: {
|
72
|
-
nodeScope: node,
|
73
|
-
index: node.index(),
|
74
|
-
nodesScope: node.$parentNodesScope
|
75
|
-
},
|
76
|
-
index: node.index(),
|
77
|
-
siblings: node.siblings().slice(0),
|
78
|
-
parent: node.$parentNodesScope,
|
79
|
-
|
80
|
-
moveTo: function(parent, siblings, index) { // Move the node to a new position
|
81
|
-
this.parent = parent;
|
82
|
-
this.siblings = siblings.slice(0);
|
83
|
-
var i = this.siblings.indexOf(this.source); // If source node is in the target nodes
|
84
|
-
if (i > -1) {
|
85
|
-
this.siblings.splice(i, 1);
|
86
|
-
if (this.source.index() < index) {
|
87
|
-
index--;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
this.siblings.splice(index, 0, this.source);
|
91
|
-
this.index = index;
|
92
|
-
},
|
93
|
-
|
94
|
-
parentNode: function() {
|
95
|
-
return this.parent.$nodeScope;
|
96
|
-
},
|
97
|
-
|
98
|
-
prev: function() {
|
99
|
-
if (this.index > 0) {
|
100
|
-
return this.siblings[this.index - 1];
|
101
|
-
}
|
102
|
-
return null;
|
103
|
-
},
|
104
|
-
|
105
|
-
next: function() {
|
106
|
-
if (this.index < this.siblings.length - 1) {
|
107
|
-
return this.siblings[this.index + 1];
|
108
|
-
}
|
109
|
-
return null;
|
110
|
-
},
|
111
|
-
|
112
|
-
isDirty: function() {
|
113
|
-
return this.source.$parentNodesScope != this.parent ||
|
114
|
-
this.source.index() != this.index;
|
115
|
-
},
|
116
|
-
|
117
|
-
eventArgs: function(elements, pos) {
|
118
|
-
return {
|
119
|
-
source: this.sourceInfo,
|
120
|
-
dest: {
|
121
|
-
index: this.index,
|
122
|
-
nodesScope: this.parent
|
123
|
-
},
|
124
|
-
elements: elements,
|
125
|
-
pos: pos
|
126
|
-
};
|
127
|
-
},
|
128
|
-
|
129
|
-
apply: function() {
|
130
|
-
var nodeData = this.source.$modelValue;
|
131
|
-
this.source.remove();
|
132
|
-
this.parent.insertNode(this.index, nodeData);
|
133
|
-
}
|
134
|
-
};
|
135
|
-
},
|
136
|
-
|
137
|
-
/**
|
138
|
-
* @ngdoc method
|
139
|
-
* @name hippo.theme#height
|
140
|
-
* @methodOf ui.tree.service:$helper
|
141
|
-
*
|
142
|
-
* @description
|
143
|
-
* Get the height of an element.
|
144
|
-
*
|
145
|
-
* @param {Object} element Angular element.
|
146
|
-
* @returns {String} Height
|
147
|
-
*/
|
148
|
-
height: function (element) {
|
149
|
-
return element.prop('scrollHeight');
|
150
|
-
},
|
151
|
-
|
152
|
-
/**
|
153
|
-
* @ngdoc method
|
154
|
-
* @name hippo.theme#width
|
155
|
-
* @methodOf ui.tree.service:$helper
|
156
|
-
*
|
157
|
-
* @description
|
158
|
-
* Get the width of an element.
|
159
|
-
*
|
160
|
-
* @param {Object} element Angular element.
|
161
|
-
* @returns {String} Width
|
162
|
-
*/
|
163
|
-
width: function (element) {
|
164
|
-
return element.prop('scrollWidth');
|
165
|
-
},
|
166
|
-
|
167
|
-
/**
|
168
|
-
* @ngdoc method
|
169
|
-
* @name hippo.theme#offset
|
170
|
-
* @methodOf ui.nestedSortable.service:$helper
|
171
|
-
*
|
172
|
-
* @description
|
173
|
-
* Get the offset values of an element.
|
174
|
-
*
|
175
|
-
* @param {Object} element Angular element.
|
176
|
-
* @returns {Object} Object with properties width, height, top and left
|
177
|
-
*/
|
178
|
-
offset: function (element) {
|
179
|
-
var boundingClientRect = element[0].getBoundingClientRect();
|
180
|
-
|
181
|
-
return {
|
182
|
-
width: element.prop('offsetWidth'),
|
183
|
-
height: element.prop('offsetHeight'),
|
184
|
-
top: boundingClientRect.top + ($window.pageYOffset || $document[0].body.scrollTop || $document[0].documentElement.scrollTop),
|
185
|
-
left: boundingClientRect.left + ($window.pageXOffset || $document[0].body.scrollLeft || $document[0].documentElement.scrollLeft)
|
186
|
-
};
|
187
|
-
},
|
188
|
-
|
189
|
-
/**
|
190
|
-
* @ngdoc method
|
191
|
-
* @name hippo.theme#positionStarted
|
192
|
-
* @methodOf ui.tree.service:$helper
|
193
|
-
*
|
194
|
-
* @description
|
195
|
-
* Get the start position of the target element according to the provided event properties.
|
196
|
-
*
|
197
|
-
* @param {Object} e Event
|
198
|
-
* @param {Object} target Target element
|
199
|
-
* @returns {Object} Object with properties offsetX, offsetY, startX, startY, nowX and dirX.
|
200
|
-
*/
|
201
|
-
positionStarted: function (e, target) {
|
202
|
-
var pos = {};
|
203
|
-
pos.offsetX = e.pageX - this.offset(target).left;
|
204
|
-
pos.offsetY = e.pageY - this.offset(target).top;
|
205
|
-
pos.startX = pos.lastX = e.pageX;
|
206
|
-
pos.startY = pos.lastY = e.pageY;
|
207
|
-
pos.nowX = pos.nowY = pos.distX = pos.distY = pos.dirAx = 0;
|
208
|
-
pos.dirX = pos.dirY = pos.lastDirX = pos.lastDirY = pos.distAxX = pos.distAxY = 0;
|
209
|
-
return pos;
|
210
|
-
},
|
211
|
-
|
212
|
-
positionMoved: function (e, pos, firstMoving) {
|
213
|
-
// mouse position last events
|
214
|
-
pos.lastX = pos.nowX;
|
215
|
-
pos.lastY = pos.nowY;
|
216
|
-
|
217
|
-
// mouse position this events
|
218
|
-
pos.nowX = e.pageX;
|
219
|
-
pos.nowY = e.pageY;
|
220
|
-
|
221
|
-
// distance mouse moved between events
|
222
|
-
pos.distX = pos.nowX - pos.lastX;
|
223
|
-
pos.distY = pos.nowY - pos.lastY;
|
224
|
-
|
225
|
-
// direction mouse was moving
|
226
|
-
pos.lastDirX = pos.dirX;
|
227
|
-
pos.lastDirY = pos.dirY;
|
228
|
-
|
229
|
-
// direction mouse is now moving (on both axis)
|
230
|
-
pos.dirX = pos.distX === 0 ? 0 : pos.distX > 0 ? 1 : -1;
|
231
|
-
pos.dirY = pos.distY === 0 ? 0 : pos.distY > 0 ? 1 : -1;
|
232
|
-
|
233
|
-
// axis mouse is now moving on
|
234
|
-
var newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0;
|
235
|
-
|
236
|
-
// do nothing on first move
|
237
|
-
if (firstMoving) {
|
238
|
-
pos.dirAx = newAx;
|
239
|
-
pos.moving = true;
|
240
|
-
return;
|
241
|
-
}
|
242
|
-
|
243
|
-
// calc distance moved on this axis (and direction)
|
244
|
-
if (pos.dirAx !== newAx) {
|
245
|
-
pos.distAxX = 0;
|
246
|
-
pos.distAxY = 0;
|
247
|
-
} else {
|
248
|
-
pos.distAxX += Math.abs(pos.distX);
|
249
|
-
if (pos.dirX !== 0 && pos.dirX !== pos.lastDirX) {
|
250
|
-
pos.distAxX = 0;
|
251
|
-
}
|
252
|
-
|
253
|
-
pos.distAxY += Math.abs(pos.distY);
|
254
|
-
if (pos.dirY !== 0 && pos.dirY !== pos.lastDirY) {
|
255
|
-
pos.distAxY = 0;
|
256
|
-
}
|
257
|
-
}
|
258
|
-
|
259
|
-
pos.dirAx = newAx;
|
260
|
-
}
|
261
|
-
};
|
262
|
-
}
|
263
|
-
]);
|
264
|
-
|
265
|
-
})();
|