card-mod-script 0.13.0 → 0.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/script/decko/autosave.js.coffee +30 -0
- data/assets/script/decko/bridge.js.coffee +31 -0
- data/assets/script/decko/card_menu.js.coffee +26 -0
- data/assets/script/decko/components.js.coffee +46 -0
- data/assets/script/decko/decko.js.coffee +97 -0
- data/assets/script/decko/doubleclick.js.coffee +30 -0
- data/assets/script/decko/editor.js.coffee +55 -0
- data/assets/script/decko/filter.js.coffee +176 -0
- data/assets/script/decko/filter_items.js.coffee +128 -0
- data/assets/script/decko/filter_links.js.coffee +81 -0
- data/assets/script/decko/follow.js.coffee +22 -0
- data/assets/script/decko/layout.js.coffee +76 -0
- data/assets/script/decko/link_editor.js.coffee +61 -0
- data/assets/script/decko/mod.js.coffee +85 -0
- data/assets/script/decko/modal.js.coffee +113 -0
- data/assets/script/decko/name_editor.js.coffee +40 -0
- data/assets/script/decko/navbox.js.coffee +74 -0
- data/assets/script/decko/nest_editor.js.coffee +166 -0
- data/assets/script/decko/nest_editor_name.js.coffee +102 -0
- data/assets/script/decko/nest_editor_options.js.coffee +93 -0
- data/assets/script/decko/nest_editor_rules.js.coffee +3 -0
- data/assets/script/decko/overlay.js.coffee +54 -0
- data/assets/script/decko/recaptcha.js.coffee +19 -0
- data/assets/script/decko/selectable_filtered_content.js.coffee +12 -0
- data/assets/script/decko/slot.js.coffee +182 -0
- data/assets/script/decko/slot_ready.js.coffee +11 -0
- data/assets/script/decko/slotter.js.coffee +276 -0
- data/assets/script/decko/upload.js.coffee +57 -0
- data/assets/script/jquery-ui.min.js +13 -0
- data/assets/script/jquery.autosize.js +274 -0
- data/assets/script/manifest.yml +44 -0
- data/assets/script/script_pointer_config.js.coffee +80 -0
- data/assets/script/script_pointer_list_editor.js.coffee +67 -0
- data/file/mod_script_script_decko_machine_output/file.js +5 -30
- data/file/mod_script_script_jquery_machine_output/file.js +11 -9
- data/init/early/init_execjs.rb +3 -0
- data/set/all/head_javascript.rb +8 -3
- data/set/self/script_mods.rb +1 -1
- metadata +44 -10
@@ -0,0 +1,274 @@
|
|
1
|
+
/*!
|
2
|
+
Autosize 1.18.13
|
3
|
+
license: MIT
|
4
|
+
http://www.jacklmoore.com/autosize
|
5
|
+
*/
|
6
|
+
(function ($) {
|
7
|
+
var
|
8
|
+
defaults = {
|
9
|
+
className: 'autosizejs',
|
10
|
+
id: 'autosizejs',
|
11
|
+
append: '\n',
|
12
|
+
callback: false,
|
13
|
+
resizeDelay: 10,
|
14
|
+
placeholder: true
|
15
|
+
},
|
16
|
+
|
17
|
+
// border:0 is unnecessary, but avoids a bug in Firefox on OSX
|
18
|
+
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',
|
19
|
+
|
20
|
+
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
|
21
|
+
typographyStyles = [
|
22
|
+
'fontFamily',
|
23
|
+
'fontSize',
|
24
|
+
'fontWeight',
|
25
|
+
'fontStyle',
|
26
|
+
'letterSpacing',
|
27
|
+
'textTransform',
|
28
|
+
'wordSpacing',
|
29
|
+
'textIndent',
|
30
|
+
'whiteSpace'
|
31
|
+
],
|
32
|
+
|
33
|
+
// to keep track which textarea is being mirrored when adjust() is called.
|
34
|
+
mirrored,
|
35
|
+
|
36
|
+
// the mirror element, which is used to calculate what size the mirrored element should be.
|
37
|
+
mirror = $(copy).data('autosize', true)[0];
|
38
|
+
|
39
|
+
// test that line-height can be accurately copied.
|
40
|
+
mirror.style.lineHeight = '99px';
|
41
|
+
if ($(mirror).css('lineHeight') === '99px') {
|
42
|
+
typographyStyles.push('lineHeight');
|
43
|
+
}
|
44
|
+
mirror.style.lineHeight = '';
|
45
|
+
|
46
|
+
$.fn.autosize = function (options) {
|
47
|
+
if (!this.length) {
|
48
|
+
return this;
|
49
|
+
}
|
50
|
+
|
51
|
+
options = $.extend({}, defaults, options || {});
|
52
|
+
|
53
|
+
if (mirror.parentNode !== document.body) {
|
54
|
+
$(document.body).append(mirror);
|
55
|
+
}
|
56
|
+
|
57
|
+
return this.each(function () {
|
58
|
+
var
|
59
|
+
ta = this,
|
60
|
+
$ta = $(ta),
|
61
|
+
maxHeight,
|
62
|
+
minHeight,
|
63
|
+
boxOffset = 0,
|
64
|
+
callback = $.isFunction(options.callback),
|
65
|
+
originalStyles = {
|
66
|
+
height: ta.style.height,
|
67
|
+
overflow: ta.style.overflow,
|
68
|
+
overflowY: ta.style.overflowY,
|
69
|
+
wordWrap: ta.style.wordWrap,
|
70
|
+
resize: ta.style.resize
|
71
|
+
},
|
72
|
+
timeout,
|
73
|
+
width = $ta.width(),
|
74
|
+
taResize = $ta.css('resize');
|
75
|
+
|
76
|
+
if ($ta.data('autosize')) {
|
77
|
+
// exit if autosize has already been applied, or if the textarea is the mirror element.
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
$ta.data('autosize', true);
|
81
|
+
|
82
|
+
if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
|
83
|
+
boxOffset = $ta.outerHeight() - $ta.height();
|
84
|
+
}
|
85
|
+
|
86
|
+
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
|
87
|
+
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
|
88
|
+
|
89
|
+
$ta.css({
|
90
|
+
overflow: 'hidden',
|
91
|
+
overflowY: 'hidden',
|
92
|
+
wordWrap: 'break-word' // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
|
93
|
+
});
|
94
|
+
|
95
|
+
if (taResize === 'vertical') {
|
96
|
+
$ta.css('resize','none');
|
97
|
+
} else if (taResize === 'both') {
|
98
|
+
$ta.css('resize', 'horizontal');
|
99
|
+
}
|
100
|
+
|
101
|
+
// The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
|
102
|
+
// window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
|
103
|
+
function setWidth() {
|
104
|
+
var width;
|
105
|
+
var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
|
106
|
+
|
107
|
+
if (style) {
|
108
|
+
|
109
|
+
width = ta.getBoundingClientRect().width;
|
110
|
+
|
111
|
+
if (width === 0 || typeof width !== 'number') {
|
112
|
+
width = parseInt(style.width,10);
|
113
|
+
}
|
114
|
+
|
115
|
+
$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
|
116
|
+
width -= parseInt(style[val],10);
|
117
|
+
});
|
118
|
+
} else {
|
119
|
+
width = $ta.width();
|
120
|
+
}
|
121
|
+
|
122
|
+
mirror.style.width = Math.max(width,0) + 'px';
|
123
|
+
}
|
124
|
+
|
125
|
+
function initMirror() {
|
126
|
+
var styles = {};
|
127
|
+
|
128
|
+
mirrored = ta;
|
129
|
+
mirror.className = options.className;
|
130
|
+
mirror.id = options.id;
|
131
|
+
maxHeight = parseInt($ta.css('maxHeight'), 10);
|
132
|
+
|
133
|
+
// mirror is a duplicate textarea located off-screen that
|
134
|
+
// is automatically updated to contain the same text as the
|
135
|
+
// original textarea. mirror always has a height of 0.
|
136
|
+
// This gives a cross-browser supported way getting the actual
|
137
|
+
// height of the text, through the scrollTop property.
|
138
|
+
$.each(typographyStyles, function(i,val){
|
139
|
+
styles[val] = $ta.css(val);
|
140
|
+
});
|
141
|
+
|
142
|
+
$(mirror).css(styles).attr('wrap', $ta.attr('wrap'));
|
143
|
+
|
144
|
+
setWidth();
|
145
|
+
|
146
|
+
// Chrome-specific fix:
|
147
|
+
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
|
148
|
+
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
|
149
|
+
if (window.chrome) {
|
150
|
+
var width = ta.style.width;
|
151
|
+
ta.style.width = '0px';
|
152
|
+
var ignore = ta.offsetWidth;
|
153
|
+
ta.style.width = width;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
// Using mainly bare JS in this function because it is going
|
158
|
+
// to fire very often while typing, and needs to very efficient.
|
159
|
+
function adjust() {
|
160
|
+
var height, original;
|
161
|
+
|
162
|
+
if (mirrored !== ta) {
|
163
|
+
initMirror();
|
164
|
+
} else {
|
165
|
+
setWidth();
|
166
|
+
}
|
167
|
+
|
168
|
+
if (!ta.value && options.placeholder) {
|
169
|
+
// If the textarea is empty, copy the placeholder text into
|
170
|
+
// the mirror control and use that for sizing so that we
|
171
|
+
// don't end up with placeholder getting trimmed.
|
172
|
+
mirror.value = ($ta.attr("placeholder") || '');
|
173
|
+
} else {
|
174
|
+
mirror.value = ta.value;
|
175
|
+
}
|
176
|
+
|
177
|
+
mirror.value += options.append || '';
|
178
|
+
mirror.style.overflowY = ta.style.overflowY;
|
179
|
+
original = parseInt(ta.style.height,10);
|
180
|
+
|
181
|
+
// Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
|
182
|
+
mirror.scrollTop = 0;
|
183
|
+
|
184
|
+
mirror.scrollTop = 9e4;
|
185
|
+
|
186
|
+
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
|
187
|
+
height = mirror.scrollTop;
|
188
|
+
|
189
|
+
if (maxHeight && height > maxHeight) {
|
190
|
+
ta.style.overflowY = 'scroll';
|
191
|
+
height = maxHeight;
|
192
|
+
} else {
|
193
|
+
ta.style.overflowY = 'hidden';
|
194
|
+
if (height < minHeight) {
|
195
|
+
height = minHeight;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
height += boxOffset;
|
200
|
+
|
201
|
+
if (original !== height) {
|
202
|
+
ta.style.height = height + 'px';
|
203
|
+
if (callback) {
|
204
|
+
options.callback.call(ta,ta);
|
205
|
+
}
|
206
|
+
$ta.trigger('autosize.resized');
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
function resize () {
|
211
|
+
clearTimeout(timeout);
|
212
|
+
timeout = setTimeout(function(){
|
213
|
+
var newWidth = $ta.width();
|
214
|
+
|
215
|
+
if (newWidth !== width) {
|
216
|
+
width = newWidth;
|
217
|
+
adjust();
|
218
|
+
}
|
219
|
+
}, parseInt(options.resizeDelay,10));
|
220
|
+
}
|
221
|
+
|
222
|
+
if ('onpropertychange' in ta) {
|
223
|
+
if ('oninput' in ta) {
|
224
|
+
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
|
225
|
+
// so binding to onkeyup to catch most of those occasions. There is no way that I
|
226
|
+
// know of to detect something like 'cut' in IE9.
|
227
|
+
$ta.on('input.autosize keyup.autosize', adjust);
|
228
|
+
} else {
|
229
|
+
// IE7 / IE8
|
230
|
+
$ta.on('propertychange.autosize', function(){
|
231
|
+
if(event.propertyName === 'value'){
|
232
|
+
adjust();
|
233
|
+
}
|
234
|
+
});
|
235
|
+
}
|
236
|
+
} else {
|
237
|
+
// Modern Browsers
|
238
|
+
$ta.on('input.autosize', adjust);
|
239
|
+
}
|
240
|
+
|
241
|
+
// Set options.resizeDelay to false if using fixed-width textarea elements.
|
242
|
+
// Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
|
243
|
+
|
244
|
+
if (options.resizeDelay !== false) {
|
245
|
+
$(window).on('resize.autosize', resize);
|
246
|
+
}
|
247
|
+
|
248
|
+
// Event for manual triggering if needed.
|
249
|
+
// Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
|
250
|
+
$ta.on('autosize.resize', adjust);
|
251
|
+
|
252
|
+
// Event for manual triggering that also forces the styles to update as well.
|
253
|
+
// Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
|
254
|
+
$ta.on('autosize.resizeIncludeStyle', function() {
|
255
|
+
mirrored = null;
|
256
|
+
adjust();
|
257
|
+
});
|
258
|
+
|
259
|
+
$ta.on('autosize.destroy', function(){
|
260
|
+
mirrored = null;
|
261
|
+
clearTimeout(timeout);
|
262
|
+
$(window).off('resize', resize);
|
263
|
+
$ta
|
264
|
+
.off('autosize')
|
265
|
+
.off('.autosize')
|
266
|
+
.css(originalStyles)
|
267
|
+
.removeData('autosize');
|
268
|
+
});
|
269
|
+
|
270
|
+
// Call adjust in case the textarea already contains text.
|
271
|
+
adjust();
|
272
|
+
});
|
273
|
+
};
|
274
|
+
}(jQuery || $)); // jQuery or jQuery-like library, such as Zepto
|
@@ -0,0 +1,44 @@
|
|
1
|
+
jquery:
|
2
|
+
items:
|
3
|
+
- ../../vendor/jquery_rails/vendor/assets/javascripts/jquery3.js
|
4
|
+
- ../../vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js
|
5
|
+
# jquery-ui includes all interaction components, the dialog and the autocomplete widget
|
6
|
+
# and all dependencies for those
|
7
|
+
# decko depends on autocomplete, sortable, jquery.autosize and jquery.fileupload
|
8
|
+
# the dialog widget is not used in decko but in wikirate
|
9
|
+
# don't know if iframe-transport is needed but it used to be there
|
10
|
+
- jquery-ui.min.js
|
11
|
+
- jquery.autosize.js
|
12
|
+
- ../../vendor/jquery_file_upload/js/jquery.fileupload.js
|
13
|
+
- ../../vendor/jquery_file_upload/js/jquery.iframe-transport.js
|
14
|
+
|
15
|
+
decko:
|
16
|
+
items:
|
17
|
+
- decko/mod.js.coffee
|
18
|
+
- decko/editor.js.coffee
|
19
|
+
- decko/name_editor.js.coffee
|
20
|
+
- decko/autosave.js.coffee
|
21
|
+
- decko/doubleclick.js.coffee
|
22
|
+
- decko/layout.js.coffee
|
23
|
+
- decko/navbox.js.coffee
|
24
|
+
- decko/upload.js.coffee
|
25
|
+
- decko/slot.js.coffee
|
26
|
+
- decko/decko.js.coffee
|
27
|
+
- decko/modal.js.coffee
|
28
|
+
- decko/overlay.js.coffee
|
29
|
+
- decko/recaptcha.js.coffee
|
30
|
+
- decko/slotter.js.coffee
|
31
|
+
- decko/bridge.js.coffee
|
32
|
+
- decko/nest_editor.js.coffee
|
33
|
+
- decko/nest_editor_rules.js.coffee
|
34
|
+
- decko/nest_editor_options.js.coffee
|
35
|
+
- decko/nest_editor_name.js.coffee
|
36
|
+
- decko/link_editor.js.coffee
|
37
|
+
- decko/components.js.coffee
|
38
|
+
- decko/follow.js.coffee
|
39
|
+
- decko/card_menu.js.coffee
|
40
|
+
- decko/slot_ready.js.coffee
|
41
|
+
- decko/filter.js.coffee
|
42
|
+
- decko/filter_links.js.coffee
|
43
|
+
- decko/filter_items.js.coffee
|
44
|
+
- decko/selectable_filtered_content.js.coffee
|
@@ -0,0 +1,80 @@
|
|
1
|
+
$.extend decko.editorContentFunctionMap,
|
2
|
+
'select.pointer-select': ->
|
3
|
+
pointerContent @val()
|
4
|
+
'select.pointer-multiselect': ->
|
5
|
+
pointerContent @val()
|
6
|
+
'.pointer-radio-list': ->
|
7
|
+
pointerContent @find('input:checked').val()
|
8
|
+
'.pointer-list-ul': ->
|
9
|
+
pointerContent @find('input').map( -> $(this).val() )
|
10
|
+
'.pointer-link-list-ul': ->
|
11
|
+
decko.linkListContent @find('.input-group')
|
12
|
+
'._nest-list-ul': ->
|
13
|
+
decko.nestListContent @find('.input-group')
|
14
|
+
'.pointer-checkbox-list': ->
|
15
|
+
pointerContent @find('input:checked').map( -> $(this).val() )
|
16
|
+
'.pointer-select-list': ->
|
17
|
+
pointerContent @find('.pointer-select select').map( -> $(this).val() )
|
18
|
+
'._pointer-filtered-list': ->
|
19
|
+
pointerContent @find('._filtered-list-item').map( -> $(this).data('cardName') )
|
20
|
+
'._pointer-list': ->
|
21
|
+
pointerContent @find('._pointer-item').map( -> $(this).val() )
|
22
|
+
# can't find evidence that the following is in use: #efm
|
23
|
+
# '.pointer-mixed': ->
|
24
|
+
# element = '.pointer-checkbox-sublist input:checked,\
|
25
|
+
# .pointer-sublist-ul input'
|
26
|
+
# pointerContent @find(element).map( -> $(this).val() )
|
27
|
+
# must happen after pointer-list-ul, I think
|
28
|
+
'.perm-editor': -> permissionsContent this
|
29
|
+
|
30
|
+
decko.editorInitFunctionMap['.pointer-list-editor'] = ->
|
31
|
+
@sortable({handle: '.handle', cancel: ''})
|
32
|
+
decko.initPointerList @find('input')
|
33
|
+
|
34
|
+
decko.editorInitFunctionMap['._pointer-filtered-list'] = ->
|
35
|
+
@sortable({handle: '._handle', cancel: ''})
|
36
|
+
|
37
|
+
$.extend decko,
|
38
|
+
initPointerList: (input) ->
|
39
|
+
decko.initAutoCardPlete input
|
40
|
+
|
41
|
+
initAutoCardPlete: (input) ->
|
42
|
+
optionsCard = input.data 'options-card'
|
43
|
+
return unless !!optionsCard
|
44
|
+
path = optionsCard + '.json?view=name_match'
|
45
|
+
input.autocomplete { source: decko.slotPath(path) }
|
46
|
+
|
47
|
+
pointerContent: (vals) ->
|
48
|
+
list = $.map $.makeArray(vals), (v) -> if v then '[[' + v + ']]'
|
49
|
+
$.makeArray(list).join "\n"
|
50
|
+
|
51
|
+
linkListContent: (input_groups) ->
|
52
|
+
vals = input_groups.map( ->
|
53
|
+
v = $(this).find('input._reference').val()
|
54
|
+
title = $(this).find('input._title').val()
|
55
|
+
v += "|#{title}" if title.length > 0
|
56
|
+
v
|
57
|
+
)
|
58
|
+
list = $.map $.makeArray(vals), (v) -> if v then '[[' + v + ']]'
|
59
|
+
$.makeArray(list).join "\n"
|
60
|
+
|
61
|
+
nestListContent: (input_groups) ->
|
62
|
+
vals = input_groups.map( ->
|
63
|
+
v = $(this).find('input._reference').val()
|
64
|
+
options = $(this).find('input._nest-options').val()
|
65
|
+
v += "|#{options}" if options.length > 0
|
66
|
+
v
|
67
|
+
)
|
68
|
+
list = $.map $.makeArray(vals), (v) -> if v then '{{' + v + '}}'
|
69
|
+
$.makeArray(list).join "\n"
|
70
|
+
|
71
|
+
|
72
|
+
pointerContent = (vals) ->
|
73
|
+
decko.pointerContent vals
|
74
|
+
# deprecated. backwards compatibility
|
75
|
+
|
76
|
+
permissionsContent = (ed) ->
|
77
|
+
return '_left' if ed.find('#inherit').is(':checked')
|
78
|
+
groups = ed.find('.perm-group input:checked').map( -> $(this).val() )
|
79
|
+
indivs = ed.find('.perm-indiv input' ).map( -> $(this).val() )
|
80
|
+
pointerContent $.makeArray(groups).concat($.makeArray(indivs))
|
@@ -0,0 +1,67 @@
|
|
1
|
+
$(window).ready ->
|
2
|
+
# add pointer item when clicking on "add another" button
|
3
|
+
$('body').on 'click', '._pointer-item-add', (event)->
|
4
|
+
decko.addPointerItem this
|
5
|
+
event.preventDefault() # Prevent link from following its href
|
6
|
+
|
7
|
+
# add pointer item when you hit enter in an item
|
8
|
+
$('body').on 'keydown', '.pointer-item-text', (event)->
|
9
|
+
if event.key == 'Enter'
|
10
|
+
decko.addPointerItem this
|
11
|
+
event.preventDefault() # was triggering extra item in unrelated pointer
|
12
|
+
|
13
|
+
# enable/disable add
|
14
|
+
$('body').on 'keyup', '.pointer-item-text', (_event)->
|
15
|
+
decko.updateAddItemButton this
|
16
|
+
|
17
|
+
$('body').on 'click', '.pointer-item-delete', ->
|
18
|
+
item = $(this).closest 'li'
|
19
|
+
list = item.closest('ul')
|
20
|
+
if list.find('.pointer-li').length > 1
|
21
|
+
item.remove()
|
22
|
+
else
|
23
|
+
item.find('input').val ''
|
24
|
+
decko.updateAddItemButton(list)
|
25
|
+
|
26
|
+
decko.slotReady (slot) ->
|
27
|
+
slot.find('.pointer-list-editor').each ->
|
28
|
+
decko.updateAddItemButton this
|
29
|
+
|
30
|
+
$.extend decko,
|
31
|
+
addPointerItem: (el) ->
|
32
|
+
slot = $(el).slot()
|
33
|
+
slot.trigger "slotDestroy"
|
34
|
+
# why is this necessary?
|
35
|
+
# this can have a lot of side effects in a multi-card form.
|
36
|
+
|
37
|
+
newInput = decko.nextPointerInput decko.lastPointerItem(el)
|
38
|
+
newInput.val ''
|
39
|
+
|
40
|
+
slot.trigger "slotReady"
|
41
|
+
decko.initializeEditors slot
|
42
|
+
# should be (but is not) handled by slotReady
|
43
|
+
# without this, "add another" was breaking tinymce editors in same slot
|
44
|
+
|
45
|
+
newInput.first().focus()
|
46
|
+
decko.updateAddItemButton el
|
47
|
+
decko.initPointerList newInput
|
48
|
+
|
49
|
+
nextPointerInput: (lastItem)->
|
50
|
+
lastInputs = lastItem.find 'input'
|
51
|
+
all_empty = true
|
52
|
+
for input in lastInputs
|
53
|
+
all_empty = all_empty and $(input).val() == ''
|
54
|
+
return lastInputs if all_empty
|
55
|
+
|
56
|
+
newItem = lastItem.clone()
|
57
|
+
lastItem.after newItem
|
58
|
+
newItem.attr("data-index", parseInt(lastItem.attr("data-index") + 1))
|
59
|
+
newItem.find 'input'
|
60
|
+
|
61
|
+
lastPointerItem: (el)->
|
62
|
+
$(el).closest('.content-editor').find '.pointer-li:last'
|
63
|
+
|
64
|
+
updateAddItemButton: (el)->
|
65
|
+
button = $(el).closest('.content-editor').find '._pointer-item-add'
|
66
|
+
disabled = decko.lastPointerItem(el).find('input').val() == ''
|
67
|
+
button.prop 'disabled', disabled
|
@@ -155,24 +155,11 @@
|
|
155
155
|
|
156
156
|
// name_editor.js.coffee
|
157
157
|
(function() {
|
158
|
-
var checkName, checkNameAfterTyping
|
158
|
+
var checkName, checkNameAfterTyping;
|
159
159
|
|
160
160
|
checkNameAfterTyping = null;
|
161
161
|
|
162
162
|
$(window).ready(function() {
|
163
|
-
$('body').on('click', '._renamer-updater', function() {
|
164
|
-
return $(this).closest('form').find('#card_update_referers').val('true');
|
165
|
-
});
|
166
|
-
$('body').on('submit', '._rename-form', function() {
|
167
|
-
var confirm, f;
|
168
|
-
f = $(this);
|
169
|
-
confirm = f.find('.alert');
|
170
|
-
if (confirm.is(':hidden')) {
|
171
|
-
referenceConfirm(f);
|
172
|
-
confirm.show('blind');
|
173
|
-
return false;
|
174
|
-
}
|
175
|
-
});
|
176
163
|
return $('body').on('keyup', '.name-editor input', function(event) {
|
177
164
|
var input;
|
178
165
|
if (checkNameAfterTyping) {
|
@@ -191,18 +178,6 @@
|
|
191
178
|
});
|
192
179
|
});
|
193
180
|
|
194
|
-
referenceConfirm = function(form) {
|
195
|
-
var btn, confirm;
|
196
|
-
confirm = form.find('._rename-reference-confirm');
|
197
|
-
if (!(confirm.data('referer-count') > 0)) {
|
198
|
-
return;
|
199
|
-
}
|
200
|
-
confirm.show();
|
201
|
-
btn = form.find('._renamer-updater');
|
202
|
-
btn.show();
|
203
|
-
return btn.focus();
|
204
|
-
};
|
205
|
-
|
206
181
|
checkName = function(box) {
|
207
182
|
var name;
|
208
183
|
name = box.val();
|
@@ -750,7 +725,7 @@
|
|
750
725
|
if (el.closest(".modal")[0]) {
|
751
726
|
el = el.findOriginSlot("modal");
|
752
727
|
}
|
753
|
-
return el.isMain();
|
728
|
+
return el && el.isMain();
|
754
729
|
},
|
755
730
|
findSlot: function(selector) {
|
756
731
|
var parent_slot, target_slot;
|
@@ -2270,7 +2245,7 @@
|
|
2270
2245
|
return field.find("input, select").first().focus();
|
2271
2246
|
};
|
2272
2247
|
this.fieldValue = function(field, value) {
|
2273
|
-
if (typeof value === "object") {
|
2248
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
2274
2249
|
return this.compoundFieldValue(field, value);
|
2275
2250
|
} else {
|
2276
2251
|
return this.simpleFieldValue(field, value);
|
@@ -2498,9 +2473,9 @@
|
|
2498
2473
|
f = targetFilter(this);
|
2499
2474
|
if (f.widget.length) {
|
2500
2475
|
f.restrict(filterableData(this));
|
2476
|
+
e.preventDefault();
|
2477
|
+
return e.stopPropagation();
|
2501
2478
|
}
|
2502
|
-
e.preventDefault();
|
2503
|
-
return e.stopPropagation();
|
2504
2479
|
});
|
2505
2480
|
$('body').on('click', '._filter-link', function(e) {
|
2506
2481
|
var f, filter_data, link;
|