activeadmin_ancestry_view 0.0.4 → 0.0.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49910ef703bdcec99abb4da3ecc636583e2bf260
|
4
|
+
data.tar.gz: dedb7a126398b4d4069b3d834cc54f29216ab681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d13c367cc49edd4cda4aeeb668df9e50123eacfbd68e8542898d3e98ea75df88b75fbf0a3e68a0fabfbc40e697b935f536e8e7e58e008a27c21fa96427b7f9ee
|
7
|
+
data.tar.gz: 7392a7fabd0df4fd185adb3c6bb6adec0894ed4b3cea119834b865a5514d9581fe6c04dcc7f8827da7fe47d3db86bdc25c5134c047474756de25718386c9794d
|
@@ -1,239 +1,244 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
i
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
1
|
+
(function() {
|
2
|
+
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
3
|
+
|
4
|
+
$(document).ready(function() {
|
5
|
+
var CSSRule, branchProp, clearAllColors, distance, findPanelHeader, getElements, pseudoElement, similarItems;
|
6
|
+
CSSRule = {
|
7
|
+
get: function(ruleName, deleteFlag) {
|
8
|
+
var cssRule, i, ii, styleSheet;
|
9
|
+
ruleName = ruleName.toLowerCase();
|
10
|
+
if (document.styleSheets) {
|
11
|
+
i = 0;
|
12
|
+
while (i < document.styleSheets.length) {
|
13
|
+
styleSheet = document.styleSheets[i];
|
14
|
+
ii = 0;
|
15
|
+
cssRule = false;
|
16
|
+
while (true) {
|
17
|
+
if (styleSheet.cssRules) {
|
18
|
+
cssRule = styleSheet.cssRules[ii];
|
19
|
+
} else {
|
20
|
+
cssRule = styleSheet.rules[ii];
|
21
|
+
}
|
22
|
+
if (cssRule) {
|
23
|
+
if (cssRule.selectorText.toLowerCase() === ruleName) {
|
24
|
+
if (deleteFlag === 'delete') {
|
25
|
+
if (styleSheet.cssRules) {
|
26
|
+
styleSheet.deleteRule(ii);
|
27
|
+
} else {
|
28
|
+
styleSheet.removeRule(ii);
|
29
|
+
}
|
30
|
+
return true;
|
24
31
|
} else {
|
25
|
-
|
32
|
+
return cssRule;
|
26
33
|
}
|
27
|
-
return true;
|
28
|
-
} else {
|
29
|
-
return cssRule;
|
30
34
|
}
|
31
35
|
}
|
36
|
+
ii++;
|
37
|
+
if (!cssRule) {
|
38
|
+
break;
|
39
|
+
}
|
32
40
|
}
|
33
|
-
|
34
|
-
if (!cssRule) {
|
35
|
-
break;
|
36
|
-
}
|
41
|
+
i++;
|
37
42
|
}
|
38
|
-
i++;
|
39
43
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
return false;
|
45
|
+
},
|
46
|
+
add: function(ruleName, properies) {
|
47
|
+
if (document.styleSheets) {
|
48
|
+
if (!this.get(ruleName)) {
|
49
|
+
if (document.styleSheets[0].addRule) {
|
50
|
+
return document.styleSheets[0].addRule(ruleName, properies, 0);
|
51
|
+
} else {
|
52
|
+
return document.styleSheets[0].insertRule(ruleName + (" { " + properies + " }"), 0);
|
53
|
+
}
|
50
54
|
}
|
51
55
|
}
|
52
56
|
}
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
dist = distance.verticalBranch(node, purposeNode);
|
87
|
-
id = $(node).attr('id');
|
88
|
-
return CSSRule.add("[id='" + id + "']::before", branchProp.vertical(dist));
|
89
|
-
},
|
90
|
-
updHorizontal: function(node) {
|
91
|
-
var id, line, newHeight;
|
92
|
-
if ($(node).hasClass('panel-root')) {
|
93
|
-
return false;
|
94
|
-
} else {
|
57
|
+
};
|
58
|
+
distance = {
|
59
|
+
middleHeight: function(node) {
|
60
|
+
return Math.abs($(node).height() / 2);
|
61
|
+
},
|
62
|
+
betweenTop: function(sourceNode, targetNode) {
|
63
|
+
return Math.abs($(sourceNode).offset().top - $(targetNode).offset().top);
|
64
|
+
},
|
65
|
+
verticalBranch: function(node, lastChild) {
|
66
|
+
return this.betweenTop(node, lastChild) + this.middleHeight(lastChild);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
branchProp = {
|
70
|
+
baseMargin: 2,
|
71
|
+
base: "transition: 150ms ease; " + "content: ''; " + "position: absolute; " + "border: 0.1em solid gray; ",
|
72
|
+
vertical: function(height) {
|
73
|
+
return ("margin-left: " + this.baseMargin + "em; ") + ("height: " + height + "px; ") + "z-index: -1; " + this.base;
|
74
|
+
},
|
75
|
+
horizontal: function(marginTop, marginLeft) {
|
76
|
+
return ("margin-top: -" + marginTop + "px; ") + ("margin-left: -" + (marginLeft - this.baseMargin) + "em; ") + ("width: " + (marginLeft - this.baseMargin) + "em; ") + "z-index: -2; " + this.base;
|
77
|
+
}
|
78
|
+
};
|
79
|
+
pseudoElement = {
|
80
|
+
addHorizontal: function(node) {
|
81
|
+
var height, id, marginLeft;
|
82
|
+
id = $(node).attr('id');
|
83
|
+
height = distance.middleHeight(node);
|
84
|
+
marginLeft = $(node).attr('data-shift-multiplicator');
|
85
|
+
return CSSRule.add("[id='" + id + "']::after", branchProp.horizontal(height, marginLeft));
|
86
|
+
},
|
87
|
+
addVertical: function(node, purposeNode) {
|
88
|
+
var dist, id;
|
89
|
+
dist = distance.verticalBranch(node, purposeNode);
|
95
90
|
id = $(node).attr('id');
|
96
|
-
|
97
|
-
|
98
|
-
|
91
|
+
return CSSRule.add("[id='" + id + "']::before", branchProp.vertical(dist));
|
92
|
+
},
|
93
|
+
updHorizontal: function(node) {
|
94
|
+
var id, line, newHeight;
|
95
|
+
if ($(node).hasClass('panel-root')) {
|
96
|
+
return false;
|
97
|
+
} else {
|
98
|
+
id = $(node).attr('id');
|
99
|
+
newHeight = -Math.abs(distance.middleHeight(node));
|
100
|
+
line = CSSRule.get('[id="' + id + '"]::after');
|
101
|
+
return line.style.marginTop = newHeight.toString().concat('px');
|
102
|
+
}
|
103
|
+
},
|
104
|
+
updVertical: function(node) {
|
105
|
+
var lastChild, line, newDistance, nodeId;
|
106
|
+
nodeId = $(node).attr('id');
|
107
|
+
lastChild = $(node).parent().find(".panel-container[data-last-child=" + nodeId + "]");
|
108
|
+
if ($(lastChild).length) {
|
109
|
+
newDistance = distance.verticalBranch(node, lastChild);
|
110
|
+
line = CSSRule.get('[id="' + nodeId + '"]::before');
|
111
|
+
return line.style.height = newDistance.toString().concat('px');
|
112
|
+
}
|
113
|
+
},
|
114
|
+
updEachVertical: function(node) {
|
115
|
+
var actualCollection, actualIds, allParents, nodeClasses, parentIds, that;
|
116
|
+
nodeClasses = $(node).attr('class').split(' ');
|
117
|
+
allParents = $(node).prevAll('.panel-parent');
|
118
|
+
parentIds = $.map(allParents, function(el) {
|
119
|
+
return $(el).attr('id');
|
120
|
+
});
|
121
|
+
actualIds = similarItems(nodeClasses, parentIds);
|
122
|
+
actualIds.push($(node).attr('id'));
|
123
|
+
actualCollection = getElements(actualIds);
|
124
|
+
that = this;
|
125
|
+
return $.each(actualCollection, function(i, element) {
|
126
|
+
return that.updVertical(element);
|
127
|
+
});
|
99
128
|
}
|
100
|
-
}
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
129
|
+
};
|
130
|
+
findPanelHeader = function(object) {
|
131
|
+
return object.find('.panel').find('.panel-header');
|
132
|
+
};
|
133
|
+
clearAllColors = function() {
|
134
|
+
$('.panel-header').css('background-color', '');
|
135
|
+
return $('.panel-header').each(function() {
|
136
|
+
if ($(this).hasClass('selectable')) {
|
137
|
+
return $(this).removeClass('selectable');
|
138
|
+
}
|
139
|
+
});
|
140
|
+
};
|
141
|
+
similarItems = function(arr1, arr2) {
|
142
|
+
var item, _i, _len, _results;
|
143
|
+
_results = [];
|
144
|
+
for (_i = 0, _len = arr2.length; _i < _len; _i++) {
|
145
|
+
item = arr2[_i];
|
146
|
+
if (__indexOf.call(arr1, item) >= 0) {
|
147
|
+
_results.push(item);
|
148
|
+
}
|
109
149
|
}
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
parentIds = $.map(allParents, function(el) {
|
116
|
-
return $(el).attr('id');
|
150
|
+
return _results;
|
151
|
+
};
|
152
|
+
getElements = function(arrayOfIds) {
|
153
|
+
return $.map(arrayOfIds, function(id) {
|
154
|
+
return $("#" + id).get();
|
117
155
|
});
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
156
|
+
};
|
157
|
+
$('.panel-parent').each(function() {
|
158
|
+
var id, parentColor;
|
159
|
+
id = $(this).attr('id');
|
160
|
+
parentColor = findPanelHeader($(this)).css('background-color');
|
161
|
+
return $('.panel-childless').each(function() {
|
162
|
+
if ($(this).hasClass(id)) {
|
163
|
+
return findPanelHeader($(this)).css('background-color', parentColor);
|
164
|
+
}
|
124
165
|
});
|
125
|
-
}
|
126
|
-
};
|
127
|
-
findPanelHeader = function(object) {
|
128
|
-
return object.find('.panel').find('.panel-header');
|
129
|
-
};
|
130
|
-
clearAllColors = function() {
|
131
|
-
$('.panel-header').css('background-color', '');
|
132
|
-
return $('.panel-header').each(function() {
|
133
|
-
if ($(this).hasClass('selectable')) {
|
134
|
-
return $(this).removeClass('selectable');
|
135
|
-
}
|
136
166
|
});
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
167
|
+
$('.show-content').click(function() {
|
168
|
+
var content, node, nodeId, oldNodeHeight, verticalLine;
|
169
|
+
node = $(this).parents('.panel-container');
|
170
|
+
nodeId = $(node).attr('id');
|
171
|
+
content = $(this).parent().next('.panel_contents');
|
172
|
+
oldNodeHeight = $(node).height();
|
173
|
+
verticalLine = CSSRule.get('[id="' + $(node).attr('id') + '"]::before');
|
174
|
+
if (content.is(':hidden')) {
|
175
|
+
content.show(0, function() {
|
176
|
+
return pseudoElement.updHorizontal(node);
|
177
|
+
});
|
178
|
+
} else {
|
179
|
+
content.hide(0, function() {
|
180
|
+
return pseudoElement.updHorizontal(node);
|
181
|
+
});
|
145
182
|
}
|
146
|
-
|
147
|
-
return _results;
|
148
|
-
};
|
149
|
-
getElements = function(arrayOfIds) {
|
150
|
-
return $.map(arrayOfIds, function(id) {
|
151
|
-
return $("#" + id).get();
|
183
|
+
return pseudoElement.updEachVertical(node);
|
152
184
|
});
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
if (
|
160
|
-
|
185
|
+
$('.show-childrens').click(function() {
|
186
|
+
var lastChild, lastChildId, nodeContent, nodeId;
|
187
|
+
nodeId = $(this).parents('.panel-container').attr('id');
|
188
|
+
nodeContent = $(this).parent().next('.panel_contents');
|
189
|
+
lastChild = $(".panel-container[data-last-child=" + nodeId + "]");
|
190
|
+
lastChildId = $(lastChild).attr('id');
|
191
|
+
if (nodeContent.is(':hidden')) {
|
192
|
+
nodeContent.show();
|
193
|
+
} else {
|
194
|
+
nodeContent.hide();
|
161
195
|
}
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
return pseudoElement.updEachVertical(node);
|
181
|
-
});
|
182
|
-
$('.show-childrens').click(function() {
|
183
|
-
var lastChild, lastChildId, nodeContent, nodeId;
|
184
|
-
nodeId = $(this).parents('.panel-container').attr('id');
|
185
|
-
nodeContent = $(this).parent().next('.panel_contents');
|
186
|
-
lastChild = $(".panel-container[data-last-child=" + nodeId + "]");
|
187
|
-
lastChildId = $(lastChild).attr('id');
|
188
|
-
if (nodeContent.is(':hidden')) {
|
189
|
-
nodeContent.show();
|
190
|
-
} else {
|
191
|
-
nodeContent.hide();
|
192
|
-
}
|
193
|
-
$('.panel').each(function() {
|
194
|
-
var content, subLastChildId, subNode;
|
195
|
-
subNode = $(this).parent('.panel-container');
|
196
|
-
if (subNode.hasClass(nodeId)) {
|
197
|
-
content = $(this).find('.panel_contents');
|
198
|
-
if (nodeContent.is(':visible')) {
|
199
|
-
content.show(0, function() {
|
200
|
-
return pseudoElement.updHorizontal(subNode);
|
201
|
-
});
|
202
|
-
} else {
|
203
|
-
content.hide(0, function() {
|
204
|
-
return pseudoElement.updHorizontal(subNode);
|
205
|
-
});
|
196
|
+
$('.panel').each(function() {
|
197
|
+
var content, subLastChildId, subNode;
|
198
|
+
subNode = $(this).parent('.panel-container');
|
199
|
+
if (subNode.hasClass(nodeId)) {
|
200
|
+
content = $(this).find('.panel_contents');
|
201
|
+
if (nodeContent.is(':visible')) {
|
202
|
+
content.show(0, function() {
|
203
|
+
return pseudoElement.updHorizontal(subNode);
|
204
|
+
});
|
205
|
+
} else {
|
206
|
+
content.hide(0, function() {
|
207
|
+
return pseudoElement.updHorizontal(subNode);
|
208
|
+
});
|
209
|
+
}
|
210
|
+
subLastChildId = $(subNode).attr('data-last-child');
|
211
|
+
if (subLastChildId != null) {
|
212
|
+
return pseudoElement.updVertical($("#" + subLastChildId));
|
213
|
+
}
|
206
214
|
}
|
207
|
-
|
208
|
-
|
209
|
-
|
215
|
+
});
|
216
|
+
return pseudoElement.updEachVertical(lastChild);
|
217
|
+
});
|
218
|
+
$('.panel-header').on('click', function() {
|
219
|
+
var parentId;
|
220
|
+
clearAllColors();
|
221
|
+
$(this).addClass('selectable');
|
222
|
+
parentId = $(this).parents('.panel-container').attr('id');
|
223
|
+
return $('.panel-header').each(function() {
|
224
|
+
if (($(this)).parents('.panel-container').hasClass(parentId)) {
|
225
|
+
return $(this).addClass('selectable');
|
210
226
|
}
|
227
|
+
});
|
228
|
+
});
|
229
|
+
$('.panel-parent').each(function() {
|
230
|
+
var lastChild, nodeId;
|
231
|
+
nodeId = $(this).attr('id');
|
232
|
+
lastChild = $(this).parent().find(".panel-container[data-last-child=" + nodeId + "]");
|
233
|
+
if ($(lastChild).length) {
|
234
|
+
return pseudoElement.addVertical(this, lastChild);
|
211
235
|
}
|
212
236
|
});
|
213
|
-
return
|
214
|
-
|
215
|
-
|
216
|
-
var parentId;
|
217
|
-
clearAllColors();
|
218
|
-
$(this).addClass('selectable');
|
219
|
-
parentId = $(this).parents('.panel-container').attr('id');
|
220
|
-
return $('.panel-header').each(function() {
|
221
|
-
if (($(this)).parents('.panel-container').hasClass(parentId)) {
|
222
|
-
return $(this).addClass('selectable');
|
237
|
+
return $('.panel-container').each(function() {
|
238
|
+
if (!$(this).hasClass('panel-root')) {
|
239
|
+
return pseudoElement.addHorizontal(this);
|
223
240
|
}
|
224
241
|
});
|
225
242
|
});
|
226
|
-
|
227
|
-
|
228
|
-
nodeId = $(this).attr('id');
|
229
|
-
lastChild = $(this).parent().find(".panel-container[data-last-child=" + nodeId + "]");
|
230
|
-
if ($(lastChild).length) {
|
231
|
-
return pseudoElement.addVertical(this, lastChild);
|
232
|
-
}
|
233
|
-
});
|
234
|
-
return $('.panel-container').each(function() {
|
235
|
-
if (!$(this).hasClass('panel-root')) {
|
236
|
-
return pseudoElement.addHorizontal(this);
|
237
|
-
}
|
238
|
-
});
|
239
|
-
});
|
243
|
+
|
244
|
+
}).call(this);
|