card-mod-machines 0.11.0 → 0.11.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/file/all_script_machine_output/file.js +2 -2558
- data/file/all_style_machine_output/file.css +2 -2
- data/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
- data/lib/card/machine.rb +2 -0
- data/set/abstract/machine.rb +2 -2
- data/set/abstract/machine/output_update.rb +7 -0
- data/set/abstract/machine_input.rb +1 -0
- metadata +19 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c66ba0000e704c9a528cfceda10a730c7b8cb8ba0ed6db8b2f26c612365a97d
|
4
|
+
data.tar.gz: 7a0c85dd4377f7101fa728fb7c172f669f51d7e09e8a66164b50b9606b1ca363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46627c6592f547d6e8c1f002a30aafc15a3e9bad43ce3a91ca930bef89898ce6910fe9fb3c87a78499e9b24c21841c9b531603b6f4bb178fa14eaa51701c5774
|
7
|
+
data.tar.gz: b8f9da27c1734fb44c6e0eba70a260afcd5534e6adbbe4face0032c6bebceaa120fbc3a1aef212489826a66a8aa3da7e907d1a4bfd4a7e1e6bfcddec207c5198
|
@@ -10921,2564 +10921,8 @@ return jQuery;
|
|
10921
10921
|
})( jQuery );
|
10922
10922
|
|
10923
10923
|
//script: decko
|
10924
|
-
(function() {
|
10925
|
-
var addModalDialogClasses, addSelectedButton, addSelectedButtonUrl, arrayFromField, checkName, checkNameAfterTyping, containerClass, deselectAllLink, detectMobileBrowser, doubleClickActive, doubleClickActiveMap, doubleClickApplies, doubleSidebar, filterBox, formatNavboxItem, formatNavboxSelectedItem, navboxItem, navboxSelect, navboxize, nestNameTimeout, newFilteredListContent, openModalIfPresent, prefilteredData, prefilteredIds, prefilteredNames, selectFilteredItem, selectedBin, selectedData, selectedIds, selectedNames, setSlotMode, sidebarToggle, singleSidebar, snakeCase, submitAfterTyping, toggleButton, trackSelectedIds, triggerDoubleClickEditingOn, updateAfterSelection, updateSelectedCount, updateSelectedSectionVisibility, updateUnselectedCount, warn, wrapDeckoLayout, wrapSidebarToggle;
|
10926
|
-
|
10927
|
-
window.decko || (window.decko = {});
|
10928
|
-
|
10929
|
-
$(window).ready(function() {
|
10930
|
-
var firstShade;
|
10931
|
-
$('body').on('click', '._stop_propagation', function(event) {
|
10932
|
-
return event.stopPropagation();
|
10933
|
-
});
|
10934
|
-
$('body').on('click', '._prevent_default', function(event) {
|
10935
|
-
return event.preventDefault();
|
10936
|
-
});
|
10937
|
-
$('body').on('mouseenter', 'a[data-hover-text]', function() {
|
10938
|
-
var text;
|
10939
|
-
text = $(this).text();
|
10940
|
-
$(this).data("original-text", text);
|
10941
|
-
return $(this).text($(this).data("hover-text"));
|
10942
|
-
});
|
10943
|
-
$('body').on('mouseleave', 'a[data-hover-text]', function() {
|
10944
|
-
return $(this).text($(this).data("original-text"));
|
10945
|
-
});
|
10946
|
-
$('body').on('click', '.shade-view h1', function() {
|
10947
|
-
var toggleThis;
|
10948
|
-
toggleThis = $(this).slot().find('.shade-content').is(':hidden');
|
10949
|
-
decko.toggleShade($(this).closest('.pointer-list').find('.shade-content:visible').parent());
|
10950
|
-
if (toggleThis) {
|
10951
|
-
return decko.toggleShade($(this).slot());
|
10952
|
-
}
|
10953
|
-
});
|
10954
|
-
if (firstShade = $('.shade-view h1')[0]) {
|
10955
|
-
$(firstShade).trigger('click');
|
10956
|
-
}
|
10957
|
-
$('body').on('click', '.open-slow-items', function() {
|
10958
|
-
var panel;
|
10959
|
-
panel = $(this).closest('.panel-group');
|
10960
|
-
panel.find('.open-slow-items').removeClass('open-slow-items').addClass('close-slow-items');
|
10961
|
-
panel.find('.toggle-fast-items').text("show < 100ms");
|
10962
|
-
panel.find('.duration-ok').hide();
|
10963
|
-
return panel.find('.panel-danger > .panel-collapse').collapse('show').find('a > span').addClass('show-fast-items');
|
10964
|
-
});
|
10965
|
-
$('body').on('click', '.close-slow-items', function() {
|
10966
|
-
var panel;
|
10967
|
-
panel = $(this).closest('.panel-group');
|
10968
|
-
panel.find('.close-slow-items').removeClass('close-slow-items').addClass('open-slow-items');
|
10969
|
-
panel.find('.toggle-fast-items').text("hide < 100ms");
|
10970
|
-
panel.find('.panel-danger > .panel-collapse').collapse('hide').removeClass('show-fast-items');
|
10971
|
-
return panel.find('.duration-ok').show();
|
10972
|
-
});
|
10973
|
-
$('body').on('click', '.toggle-fast-items', function() {
|
10974
|
-
var panel;
|
10975
|
-
panel = $(this).closest('.panel-group');
|
10976
|
-
if ($(this).text() === 'hide < 100ms') {
|
10977
|
-
panel.find('.duration-ok').hide();
|
10978
|
-
return $(this).text("show < 100ms");
|
10979
|
-
} else {
|
10980
|
-
panel.find('.duration-ok').show();
|
10981
|
-
return $(this).text("hide < 100ms");
|
10982
|
-
}
|
10983
|
-
});
|
10984
|
-
return $('body').on('click', '.show-fast-items', function(event) {
|
10985
|
-
var panel;
|
10986
|
-
$(this).removeClass('show-fast-items');
|
10987
|
-
panel = $(this).closest('.panel-group');
|
10988
|
-
panel.find('.duration-ok').show();
|
10989
|
-
panel.find('.show-fast-items').removeClass('show-fast-items');
|
10990
|
-
panel.find('.panel-collapse').collapse('show');
|
10991
|
-
return event.stopPropagation();
|
10992
|
-
});
|
10993
|
-
});
|
10994
|
-
|
10995
|
-
$.extend(decko, {
|
10996
|
-
toggleShade: function(shadeSlot) {
|
10997
|
-
shadeSlot.find('.shade-content').slideToggle(1000);
|
10998
|
-
return shadeSlot.find('.glyphicon').toggleClass('glyphicon-triangle-right glpyphicon-triangle-bottom');
|
10999
|
-
}
|
11000
|
-
});
|
11001
|
-
|
11002
|
-
$.extend(decko, {
|
11003
|
-
initializeEditors: function(range, map) {
|
11004
|
-
if (map == null) {
|
11005
|
-
map = decko.editorInitFunctionMap;
|
11006
|
-
}
|
11007
|
-
return $.each(map, function(selector, fn) {
|
11008
|
-
return $.each(range.find(selector), function() {
|
11009
|
-
return fn.call($(this));
|
11010
|
-
});
|
11011
|
-
});
|
11012
|
-
},
|
11013
|
-
editorContentFunctionMap: {},
|
11014
|
-
editorInitFunctionMap: {
|
11015
|
-
'textarea': function() {
|
11016
|
-
return $(this).autosize();
|
11017
|
-
},
|
11018
|
-
'.file-upload': function() {
|
11019
|
-
return decko.upload_file(this);
|
11020
|
-
},
|
11021
|
-
'.etherpad-textarea': function() {
|
11022
|
-
return $(this).closest('form').find('.edit-submit-button').attr('class', 'etherpad-submit-button');
|
11023
|
-
}
|
11024
|
-
},
|
11025
|
-
addEditor: function(selector, init, get_content) {
|
11026
|
-
decko.editorContentFunctionMap[selector] = get_content;
|
11027
|
-
return decko.editorInitFunctionMap[selector] = init;
|
11028
|
-
}
|
11029
|
-
});
|
11030
|
-
|
11031
|
-
jQuery.fn.extend({
|
11032
|
-
setContentFieldsFromMap: function(map) {
|
11033
|
-
var this_form;
|
11034
|
-
if (map == null) {
|
11035
|
-
map = decko.editorContentFunctionMap;
|
11036
|
-
}
|
11037
|
-
this_form = $(this);
|
11038
|
-
return $.each(map, function(selector, fn) {
|
11039
|
-
return this_form.setContentFields(selector, fn);
|
11040
|
-
});
|
11041
|
-
},
|
11042
|
-
setContentFields: function(selector, fn) {
|
11043
|
-
return $.each(this.find(selector), function() {
|
11044
|
-
return $(this).setContentField(fn);
|
11045
|
-
});
|
11046
|
-
},
|
11047
|
-
setContentField: function(fn) {
|
11048
|
-
var field, init_val, new_val;
|
11049
|
-
field = this.closest('.card-editor').find('.d0-card-content');
|
11050
|
-
init_val = field.val();
|
11051
|
-
new_val = fn.call(this);
|
11052
|
-
field.val(new_val);
|
11053
|
-
if (init_val !== new_val) {
|
11054
|
-
return field.change();
|
11055
|
-
}
|
11056
|
-
}
|
11057
|
-
});
|
11058
|
-
|
11059
|
-
$(window).ready(function() {
|
11060
|
-
setTimeout((function() {
|
11061
|
-
return decko.initializeEditors($('body > :not(.modal)'));
|
11062
|
-
}), 10);
|
11063
|
-
return $('body').on('submit', '.card-form', function() {
|
11064
|
-
$(this).setContentFieldsFromMap();
|
11065
|
-
$(this).find('.d0-card-content').attr('no-autosave', 'true');
|
11066
|
-
return true;
|
11067
|
-
});
|
11068
|
-
});
|
11069
|
-
|
11070
|
-
setInterval((function() {
|
11071
|
-
return $('.card-form').setContentFieldsFromMap();
|
11072
|
-
}), 20000);
|
11073
|
-
|
11074
|
-
checkNameAfterTyping = null;
|
11075
|
-
|
11076
|
-
$(window).ready(function() {
|
11077
|
-
$('body').on('click', '.renamer-updater', function() {
|
11078
|
-
return $(this).closest('form').find('#card_update_referers').val('true');
|
11079
|
-
});
|
11080
|
-
$('body').on('submit', '.edit_name-view .card-form, .name_form-view .card-form', function() {
|
11081
|
-
var confirmer;
|
11082
|
-
confirmer = $(this).find('.alert');
|
11083
|
-
if (confirmer.is(':hidden')) {
|
11084
|
-
if ($(this).find('#referers').val() > 0) {
|
11085
|
-
$(this).find('.renamer-updater').show();
|
11086
|
-
}
|
11087
|
-
confirmer.show('blind');
|
11088
|
-
return false;
|
11089
|
-
}
|
11090
|
-
});
|
11091
|
-
return $('body').on('keyup', '.name-editor input', function(event) {
|
11092
|
-
var input;
|
11093
|
-
if (checkNameAfterTyping) {
|
11094
|
-
clearTimeout(checkNameAfterTyping);
|
11095
|
-
}
|
11096
|
-
input = $(this);
|
11097
|
-
if (event.which === 13) {
|
11098
|
-
checkName(input);
|
11099
|
-
return checkNameAfterTyping = null;
|
11100
|
-
} else {
|
11101
|
-
return checkNameAfterTyping = setTimeout(function() {
|
11102
|
-
checkName(input);
|
11103
|
-
return checkNameAfterTyping = null;
|
11104
|
-
}, 400);
|
11105
|
-
}
|
11106
|
-
});
|
11107
|
-
});
|
11108
|
-
|
11109
|
-
checkName = function(box) {
|
11110
|
-
var name;
|
11111
|
-
name = box.val();
|
11112
|
-
return decko.pingName(name, function(data) {
|
11113
|
-
var ed, href, leg, msg, qualifier, slot_id, status;
|
11114
|
-
if (box.val() !== name) {
|
11115
|
-
return null;
|
11116
|
-
}
|
11117
|
-
status = data['status'];
|
11118
|
-
if (status) {
|
11119
|
-
ed = box.parent();
|
11120
|
-
leg = box.closest('fieldset').find('legend');
|
11121
|
-
msg = leg.find('.name-messages');
|
11122
|
-
if (!msg[0]) {
|
11123
|
-
msg = $('<span class="name-messages"></span>');
|
11124
|
-
leg.append(msg != null);
|
11125
|
-
}
|
11126
|
-
ed.removeClass('real-name virtual-name known-name');
|
11127
|
-
slot_id = box.slot().data('cardId');
|
11128
|
-
if (status !== 'unknown' && !(slot_id && parseInt(slot_id) === data['id'])) {
|
11129
|
-
ed.addClass(status + '-name known-name');
|
11130
|
-
qualifier = status === 'virtual' ? 'in virtual' : 'already in';
|
11131
|
-
href = decko.path(data['url_key']);
|
11132
|
-
return msg.html("\"<a href='" + href + "'>" + name + "</a>\" " + qualifier + " use");
|
11133
|
-
} else {
|
11134
|
-
return msg.html('');
|
11135
|
-
}
|
11136
|
-
}
|
11137
|
-
});
|
11138
|
-
};
|
11139
|
-
|
11140
|
-
jQuery.fn.extend({
|
11141
|
-
autosave: function() {
|
11142
|
-
var form_data, id, multi, reportee, slot, submit_url;
|
11143
|
-
slot = this.slot();
|
11144
|
-
if (this.attr('no-autosave')) {
|
11145
|
-
return;
|
11146
|
-
}
|
11147
|
-
multi = this.closest('.form-group');
|
11148
|
-
if (multi[0]) {
|
11149
|
-
if (!(id = multi.data('cardId'))) {
|
11150
|
-
return;
|
11151
|
-
}
|
11152
|
-
reportee = ': ' + multi.data('cardName');
|
11153
|
-
} else {
|
11154
|
-
id = slot.data('cardId');
|
11155
|
-
reportee = '';
|
11156
|
-
}
|
11157
|
-
if (!id) {
|
11158
|
-
return;
|
11159
|
-
}
|
11160
|
-
submit_url = decko.path('update/~' + id);
|
11161
|
-
form_data = $('#edit_card_' + id).serializeArray().reduce((function(obj, item) {
|
11162
|
-
obj[item.name] = item.value;
|
11163
|
-
return obj;
|
11164
|
-
}), {
|
11165
|
-
'draft': 'true',
|
11166
|
-
'success[view]': 'blank'
|
11167
|
-
});
|
11168
|
-
return $.ajax(submit_url, {
|
11169
|
-
data: form_data,
|
11170
|
-
type: 'POST'
|
11171
|
-
});
|
11172
|
-
}
|
11173
|
-
});
|
11174
|
-
|
11175
|
-
$(window).ready(function() {
|
11176
|
-
return $('body').on('change', '.autosave .d0-card-content', function() {
|
11177
|
-
var content_field;
|
11178
|
-
content_field = $(this);
|
11179
|
-
return setTimeout((function() {
|
11180
|
-
return content_field.autosave();
|
11181
|
-
}), 500);
|
11182
|
-
});
|
11183
|
-
});
|
11184
|
-
|
11185
|
-
doubleClickActiveMap = {
|
11186
|
-
off: false,
|
11187
|
-
on: true,
|
11188
|
-
signed_in: decko.currentUserId
|
11189
|
-
};
|
11190
|
-
|
11191
|
-
doubleClickActive = function() {
|
11192
|
-
return doubleClickActiveMap[decko.doubleClick];
|
11193
|
-
};
|
11194
|
-
|
11195
|
-
doubleClickApplies = function(el) {
|
11196
|
-
if (['.nodblclick', '.d0-card-header', '.card-editor'].some(function(klass) {
|
11197
|
-
return el.closest(klass)[0];
|
11198
|
-
})) {
|
11199
|
-
return false;
|
11200
|
-
}
|
11201
|
-
return el.slot().find('.card-editor')[0] == null;
|
11202
|
-
};
|
11203
|
-
|
11204
|
-
triggerDoubleClickEditingOn = function(el) {
|
11205
|
-
var edit_link, edit_view, slot, url;
|
11206
|
-
slot = el.slot();
|
11207
|
-
edit_link = decko.slotEditLink(slot);
|
11208
|
-
if (edit_link) {
|
11209
|
-
return edit_link.click();
|
11210
|
-
} else {
|
11211
|
-
edit_view = decko.slotEditView(slot);
|
11212
|
-
url = decko.path("~" + (slot.data('cardId')) + "?view=" + edit_view);
|
11213
|
-
return slot.reloadSlot(url);
|
11214
|
-
}
|
11215
|
-
};
|
11216
|
-
|
11217
|
-
$(window).ready(function() {
|
11218
|
-
if (doubleClickActive()) {
|
11219
|
-
return $('body').on('dblclick', 'div', function(_event) {
|
11220
|
-
if (doubleClickApplies($(this))) {
|
11221
|
-
triggerDoubleClickEditingOn($(this));
|
11222
|
-
}
|
11223
|
-
return false;
|
11224
|
-
});
|
11225
|
-
}
|
11226
|
-
});
|
11227
|
-
|
11228
|
-
wrapDeckoLayout = function() {
|
11229
|
-
var $footer;
|
11230
|
-
$footer = $('body > footer').first();
|
11231
|
-
$('body > article, body > aside').wrapAll("<div class='" + (containerClass()) + "'/>");
|
11232
|
-
$('body > div > article, body > div > aside').wrapAll('<div class="row row-offcanvas">');
|
11233
|
-
if ($footer) {
|
11234
|
-
return $('body').append($footer);
|
11235
|
-
}
|
11236
|
-
};
|
11237
|
-
|
11238
|
-
wrapSidebarToggle = function(toggle, flex) {
|
11239
|
-
return "<div class='container'><div class='row " + flex + "'>" + toggle + "</div></div>";
|
11240
|
-
};
|
11241
|
-
|
11242
|
-
containerClass = function() {
|
11243
|
-
if ($('body').hasClass('fluid')) {
|
11244
|
-
return "container-fluid";
|
11245
|
-
} else {
|
11246
|
-
return "container";
|
11247
|
-
}
|
11248
|
-
};
|
11249
|
-
|
11250
|
-
toggleButton = function(side) {
|
11251
|
-
var icon_dir;
|
11252
|
-
icon_dir = side === 'left' ? 'right' : 'left';
|
11253
|
-
return "<button class='offcanvas-toggle btn btn-secondary " + ("d-sm-none' data-toggle='offcanvas-" + side + "'>") + ("<i class='material-icons'>chevron_" + icon_dir + "</i></button>");
|
11254
|
-
};
|
11255
|
-
|
11256
|
-
sidebarToggle = function(side) {
|
11257
|
-
if (side === "both") {
|
11258
|
-
return wrapSidebarToggle(toggleButton("left") + toggleButton("right"), "flex-row justify-content-between");
|
11259
|
-
} else if (side === "left") {
|
11260
|
-
return wrapSidebarToggle(toggleButton("left"), "flex-row");
|
11261
|
-
} else {
|
11262
|
-
return wrapSidebarToggle(toggleButton("right"), "flex-row-reverse");
|
11263
|
-
}
|
11264
|
-
};
|
11265
|
-
|
11266
|
-
singleSidebar = function(side) {
|
11267
|
-
var $article, $aside;
|
11268
|
-
$article = $('body > article').first();
|
11269
|
-
$aside = $('body > aside').first();
|
11270
|
-
$article.addClass("col-xs-12 col-sm-9");
|
11271
|
-
$aside.addClass("col-xs-6 col-sm-3 sidebar-offcanvas sidebar-offcanvas-" + side);
|
11272
|
-
if (side === 'left') {
|
11273
|
-
$('body').append($aside).append($article);
|
11274
|
-
} else {
|
11275
|
-
$('body').append($article).append($aside);
|
11276
|
-
}
|
11277
|
-
wrapDeckoLayout();
|
11278
|
-
return $article.prepend(sidebarToggle(side));
|
11279
|
-
};
|
11280
|
-
|
11281
|
-
doubleSidebar = function() {
|
11282
|
-
var $article, $asideLeft, $asideRight, sideClass, toggles;
|
11283
|
-
$article = $('body > article').first();
|
11284
|
-
$asideLeft = $('body > aside').first();
|
11285
|
-
$asideRight = $($('body > aside')[1]);
|
11286
|
-
$article.addClass("col-xs-12 col-sm-6");
|
11287
|
-
sideClass = "col-xs-6 col-sm-3 sidebar-offcanvas";
|
11288
|
-
$asideLeft.addClass(sideClass + " sidebar-offcanvas-left");
|
11289
|
-
$asideRight.addClass(sideClass + " sidebar-offcanvas-right");
|
11290
|
-
$('body').append($asideLeft).append($article).append($asideRight);
|
11291
|
-
wrapDeckoLayout();
|
11292
|
-
toggles = sidebarToggle('both');
|
11293
|
-
return $article.prepend(toggles);
|
11294
|
-
};
|
11295
|
-
|
11296
|
-
$.fn.extend({
|
11297
|
-
toggleText: function(a, b) {
|
11298
|
-
this.text(this.text() === b ? a : b);
|
11299
|
-
return this;
|
11300
|
-
}
|
11301
|
-
});
|
11302
|
-
|
11303
|
-
$(window).ready(function() {
|
11304
|
-
switch (false) {
|
11305
|
-
case !$('body').hasClass('right-sidebar'):
|
11306
|
-
singleSidebar('right');
|
11307
|
-
break;
|
11308
|
-
case !$('body').hasClass('left-sidebar'):
|
11309
|
-
singleSidebar('left');
|
11310
|
-
break;
|
11311
|
-
case !$('body').hasClass('two-sidebar'):
|
11312
|
-
doubleSidebar();
|
11313
|
-
}
|
11314
|
-
$('[data-toggle="offcanvas-left"]').click(function() {
|
11315
|
-
$('.row-offcanvas').removeClass('right-active').toggleClass('left-active');
|
11316
|
-
return $(this).find('i.material-icons').toggleText('chevron_left', 'chevron_right');
|
11317
|
-
});
|
11318
|
-
return $('[data-toggle="offcanvas-right"]').click(function() {
|
11319
|
-
$('.row-offcanvas').removeClass('left-active').toggleClass('right-active');
|
11320
|
-
return $(this).find('i.material-icons').toggleText('chevron_left', 'chevron_right');
|
11321
|
-
});
|
11322
|
-
});
|
11323
|
-
|
11324
|
-
$(window).ready(function() {
|
11325
|
-
var navbox;
|
11326
|
-
navbox = $('._navbox');
|
11327
|
-
navbox.select2({
|
11328
|
-
placeholder: navbox.attr("placeholder"),
|
11329
|
-
escapeMarkup: function(markup) {
|
11330
|
-
return markup;
|
11331
|
-
},
|
11332
|
-
minimumInputLength: 1,
|
11333
|
-
maximumSelectionSize: 1,
|
11334
|
-
ajax: {
|
11335
|
-
delay: 200,
|
11336
|
-
url: decko.path(':search.json'),
|
11337
|
-
data: function(params) {
|
11338
|
-
return {
|
11339
|
-
query: {
|
11340
|
-
keyword: params.term
|
11341
|
-
},
|
11342
|
-
view: "complete"
|
11343
|
-
};
|
11344
|
-
},
|
11345
|
-
processResults: function(data) {
|
11346
|
-
return {
|
11347
|
-
results: navboxize(data)
|
11348
|
-
};
|
11349
|
-
},
|
11350
|
-
cache: true
|
11351
|
-
},
|
11352
|
-
templateResult: formatNavboxItem,
|
11353
|
-
templateSelection: formatNavboxSelectedItem,
|
11354
|
-
multiple: true,
|
11355
|
-
containerCssClass: 'select2-navbox-autocomplete',
|
11356
|
-
dropdownCssClass: 'select2-navbox-dropdown',
|
11357
|
-
width: "100%!important"
|
11358
|
-
});
|
11359
|
-
return navbox.on("select2:select", function(e) {
|
11360
|
-
return navboxSelect(e);
|
11361
|
-
});
|
11362
|
-
});
|
11363
|
-
|
11364
|
-
formatNavboxItem = function(i) {
|
11365
|
-
if (i.loading) {
|
11366
|
-
return i.text;
|
11367
|
-
}
|
11368
|
-
return '<i class="material-icons">' + i.icon + '</i>' + '<span class="navbox-item-label">' + i.prefix + ':</span> ' + '<span class="navbox-item-value">' + i.label + '</span>';
|
11369
|
-
};
|
11370
|
-
|
11371
|
-
formatNavboxSelectedItem = function(i) {
|
11372
|
-
if (!i.icon) {
|
11373
|
-
return i.text;
|
11374
|
-
}
|
11375
|
-
return '<i class="material-icons">' + i.icon + '</i>' + '<span class="navbox-item-value">' + i.label + '</span>';
|
11376
|
-
};
|
11377
|
-
|
11378
|
-
navboxize = function(results) {
|
11379
|
-
var items, term;
|
11380
|
-
items = [];
|
11381
|
-
term = results.term;
|
11382
|
-
if (results["search"]) {
|
11383
|
-
items.push(navboxItem({
|
11384
|
-
prefix: "search",
|
11385
|
-
id: term,
|
11386
|
-
text: term
|
11387
|
-
}));
|
11388
|
-
}
|
11389
|
-
$.each(['add', 'new'], function(index, key) {
|
11390
|
-
var val;
|
11391
|
-
if (val = results[key]) {
|
11392
|
-
return items.push(navboxItem({
|
11393
|
-
prefix: key,
|
11394
|
-
icon: "add",
|
11395
|
-
text: val[0],
|
11396
|
-
href: val[1]
|
11397
|
-
}));
|
11398
|
-
}
|
11399
|
-
});
|
11400
|
-
$.each(results['goto'], function(index, val) {
|
11401
|
-
var i;
|
11402
|
-
i = navboxItem({
|
11403
|
-
prefix: "go to",
|
11404
|
-
id: index,
|
11405
|
-
icon: "arrow_forward",
|
11406
|
-
text: val[0],
|
11407
|
-
href: val[1],
|
11408
|
-
label: val[2]
|
11409
|
-
});
|
11410
|
-
return items.push(i);
|
11411
|
-
});
|
11412
|
-
return items;
|
11413
|
-
};
|
11414
|
-
|
11415
|
-
navboxItem = function(data) {
|
11416
|
-
data.id || (data.id = data.prefix);
|
11417
|
-
data.icon || (data.icon = data.prefix);
|
11418
|
-
data.label || (data.label = '<strong class="highlight">' + data.text + '</strong>');
|
11419
|
-
return data;
|
11420
|
-
};
|
11421
|
-
|
11422
|
-
navboxSelect = function(event) {
|
11423
|
-
var item;
|
11424
|
-
item = event.params.data;
|
11425
|
-
if (item.href) {
|
11426
|
-
window.location = decko.path(item.href);
|
11427
|
-
} else {
|
11428
|
-
$(event.target).closest('form').submit();
|
11429
|
-
}
|
11430
|
-
return $(event.target).attr('disabled', 'disabled');
|
11431
|
-
};
|
11432
|
-
|
11433
|
-
$.extend(decko, {
|
11434
|
-
upload_file: function(fileupload) {
|
11435
|
-
var $_fileupload, url;
|
11436
|
-
$(fileupload).on('fileuploadsubmit', function(e, data) {
|
11437
|
-
var $_this, card_name, type_id;
|
11438
|
-
$_this = $(this);
|
11439
|
-
card_name = $_this.siblings(".attachment_card_name:first").attr("name");
|
11440
|
-
type_id = $_this.siblings("#attachment_type_id").val();
|
11441
|
-
return data.formData = {
|
11442
|
-
"card[type_id]": type_id,
|
11443
|
-
"attachment_upload": card_name
|
11444
|
-
};
|
11445
|
-
});
|
11446
|
-
$_fileupload = $(fileupload);
|
11447
|
-
if ($_fileupload.closest("form").attr("action").indexOf("update") > -1) {
|
11448
|
-
url = "card/update/" + $(fileupload).siblings("#file_card_name").val();
|
11449
|
-
} else {
|
11450
|
-
url = "card/create";
|
11451
|
-
}
|
11452
|
-
return $(fileupload).fileupload({
|
11453
|
-
url: decko.path(url),
|
11454
|
-
dataType: 'html',
|
11455
|
-
done: decko.doneFile,
|
11456
|
-
add: decko.chooseFile,
|
11457
|
-
progressall: decko.progressallFile
|
11458
|
-
});
|
11459
|
-
},
|
11460
|
-
chooseFile: function(e, data) {
|
11461
|
-
var editor;
|
11462
|
-
data.form.find('button[type=submit]').attr('disabled', true);
|
11463
|
-
editor = $(this).closest('.card-editor');
|
11464
|
-
$('#progress').show();
|
11465
|
-
editor.append('<input type="hidden" class="extra_upload_param" ' + 'value="true" name="attachment_upload">');
|
11466
|
-
editor.append('<input type="hidden" class="extra_upload_param" ' + 'value="preview_editor" name="view">');
|
11467
|
-
data.submit();
|
11468
|
-
editor.find('.choose-file').hide();
|
11469
|
-
return editor.find('.extra_upload_param').remove();
|
11470
|
-
},
|
11471
|
-
progressallFile: function(e, data) {
|
11472
|
-
var progress;
|
11473
|
-
progress = parseInt(data.loaded / data.total * 100, 10);
|
11474
|
-
return $('#progress .progress-bar').css('width', progress + '%');
|
11475
|
-
},
|
11476
|
-
doneFile: function(e, data) {
|
11477
|
-
var editor;
|
11478
|
-
editor = $(this).closest('.card-editor');
|
11479
|
-
editor.find('.chosen-file').replaceWith(data.result);
|
11480
|
-
return data.form.find('button[type=submit]').attr('disabled', false);
|
11481
|
-
}
|
11482
|
-
});
|
11483
|
-
|
11484
|
-
$(window).ready(function() {
|
11485
|
-
return $('body').on('click', '.cancel-upload', function() {
|
11486
|
-
var editor;
|
11487
|
-
editor = $(this).closest('.card-editor');
|
11488
|
-
editor.find('.choose-file').show();
|
11489
|
-
editor.find('.chosen-file').empty();
|
11490
|
-
editor.find('.progress').show();
|
11491
|
-
editor.find('#progress .progress-bar').css('width', '0%');
|
11492
|
-
return editor.find('#progress').hide();
|
11493
|
-
});
|
11494
|
-
});
|
11495
|
-
|
11496
|
-
$.extend(decko, {
|
11497
|
-
slotPath: function(path, slot) {
|
11498
|
-
var params;
|
11499
|
-
params = decko.slotData(slot);
|
11500
|
-
return decko.path(path) + ((path.match(/\?/) ? '&' : '?') + $.param(params));
|
11501
|
-
},
|
11502
|
-
slotData: function(slot) {
|
11503
|
-
var main, slotdata, xtra;
|
11504
|
-
xtra = {};
|
11505
|
-
main = $('#main').children('.card-slot').data('cardName');
|
11506
|
-
if (main != null) {
|
11507
|
-
xtra['main'] = main;
|
11508
|
-
}
|
11509
|
-
if (slot) {
|
11510
|
-
if (slot.isMain()) {
|
11511
|
-
xtra['is_main'] = true;
|
11512
|
-
}
|
11513
|
-
slotdata = slot.data('slot');
|
11514
|
-
if (slotdata != null) {
|
11515
|
-
decko.slotParams(slotdata, xtra, 'slot');
|
11516
|
-
if (slotdata['type']) {
|
11517
|
-
xtra['type'] = slotdata['type'];
|
11518
|
-
}
|
11519
|
-
}
|
11520
|
-
}
|
11521
|
-
return xtra;
|
11522
|
-
},
|
11523
|
-
slotEditView: function(slot) {
|
11524
|
-
var data;
|
11525
|
-
data = decko.slotData(slot);
|
11526
|
-
switch (data["slot[edit]"]) {
|
11527
|
-
case "inline":
|
11528
|
-
return "edit_inline";
|
11529
|
-
case "full":
|
11530
|
-
return "bridge";
|
11531
|
-
default:
|
11532
|
-
return "edit";
|
11533
|
-
}
|
11534
|
-
},
|
11535
|
-
slotEditLink: function(slot) {
|
11536
|
-
var edit_links;
|
11537
|
-
edit_links = slot.find(".edit-link").filter(function(i, el) {
|
11538
|
-
return $(el).slot().data('slotId') === slot.data('slotId');
|
11539
|
-
});
|
11540
|
-
if (edit_links[0]) {
|
11541
|
-
return $(edit_links[0]);
|
11542
|
-
} else {
|
11543
|
-
return false;
|
11544
|
-
}
|
11545
|
-
},
|
11546
|
-
slotParams: function(raw, processed, prefix) {
|
11547
|
-
return $.each(raw, function(key, value) {
|
11548
|
-
var cgiKey;
|
11549
|
-
cgiKey = prefix + '[' + snakeCase(key) + ']';
|
11550
|
-
if (key === 'items') {
|
11551
|
-
return decko.slotParams(value, processed, cgiKey);
|
11552
|
-
} else {
|
11553
|
-
return processed[cgiKey] = value;
|
11554
|
-
}
|
11555
|
-
});
|
11556
|
-
},
|
11557
|
-
contentLoaded: function(el, slotter) {
|
11558
|
-
var notice;
|
11559
|
-
decko.initializeEditors(el);
|
11560
|
-
notice = slotter.attr('notify-success');
|
11561
|
-
if (notice != null) {
|
11562
|
-
el.notify(notice, "success");
|
11563
|
-
}
|
11564
|
-
return el.triggerSlotReady(slotter);
|
11565
|
-
},
|
11566
|
-
slotReady: function(func) {
|
11567
|
-
return $('document').ready(function() {
|
11568
|
-
return $('body').on('slotReady', '.card-slot', function(e, slotter) {
|
11569
|
-
e.stopPropagation();
|
11570
|
-
if (slotter != null) {
|
11571
|
-
return func.call(this, $(this), $(slotter));
|
11572
|
-
} else {
|
11573
|
-
return func.call(this, $(this));
|
11574
|
-
}
|
11575
|
-
});
|
11576
|
-
});
|
11577
|
-
},
|
11578
|
-
slotDestroy: function(func) {
|
11579
|
-
return $('document').ready(function() {
|
11580
|
-
return $('body').on('slotDestroy', '.card-slot, ._modal-slot', function(e) {
|
11581
|
-
e.stopPropagation();
|
11582
|
-
return func.call(this, $(this));
|
11583
|
-
});
|
11584
|
-
});
|
11585
|
-
}
|
11586
|
-
});
|
11587
|
-
|
11588
|
-
jQuery.fn.extend({
|
11589
|
-
slot: function(status, mode) {
|
11590
|
-
if (status == null) {
|
11591
|
-
status = "success";
|
11592
|
-
}
|
11593
|
-
if (mode == null) {
|
11594
|
-
mode = "replace";
|
11595
|
-
}
|
11596
|
-
if (mode === "modal") {
|
11597
|
-
return this.modalSlot();
|
11598
|
-
} else {
|
11599
|
-
return this.selectSlot("slot-" + status + "-selector") || this.selectSlot("slot-selector") || this.closest(".card-slot");
|
11600
|
-
}
|
11601
|
-
},
|
11602
|
-
selectSlot: function(selectorName) {
|
11603
|
-
var selector, slot;
|
11604
|
-
if (selector = this.data(selectorName)) {
|
11605
|
-
slot = this.findSlot(selector);
|
11606
|
-
return slot && slot[0] && slot;
|
11607
|
-
}
|
11608
|
-
},
|
11609
|
-
isSlot: function() {
|
11610
|
-
return $(this).hasClass("card-slot");
|
11611
|
-
},
|
11612
|
-
isMain: function() {
|
11613
|
-
return this.slot().parent('#main')[0];
|
11614
|
-
},
|
11615
|
-
findSlot: function(selector) {
|
11616
|
-
var parent_slot, target_slot;
|
11617
|
-
if (selector === "modal-origin") {
|
11618
|
-
return this.findOriginSlot("modal");
|
11619
|
-
} else if (selector === "overlay-origin") {
|
11620
|
-
return this.findOriginSlot("overlay");
|
11621
|
-
} else {
|
11622
|
-
target_slot = this.closest(selector);
|
11623
|
-
parent_slot = this.closest('.card-slot');
|
11624
|
-
while (target_slot.length === 0 && parent_slot.length > 0) {
|
11625
|
-
target_slot = $(parent_slot).find(selector);
|
11626
|
-
parent_slot = $(parent_slot).parent().closest('.card-slot');
|
11627
|
-
}
|
11628
|
-
if (target_slot.length === 0) {
|
11629
|
-
return $(selector);
|
11630
|
-
} else {
|
11631
|
-
return target_slot;
|
11632
|
-
}
|
11633
|
-
}
|
11634
|
-
},
|
11635
|
-
findOriginSlot: function(type) {
|
11636
|
-
var origin_slot, origin_slot_id, overlaySlot;
|
11637
|
-
overlaySlot = this.closest("[data-" + type + "-origin-slot-id]");
|
11638
|
-
origin_slot_id = overlaySlot.data(type + "-origin-slot-id");
|
11639
|
-
origin_slot = $("[data-slot-id=" + origin_slot_id + "]");
|
11640
|
-
if (origin_slot[0] != null) {
|
11641
|
-
return origin_slot;
|
11642
|
-
} else {
|
11643
|
-
return console.log("couldn't find origin with slot id " + origin_slot_id);
|
11644
|
-
}
|
11645
|
-
},
|
11646
|
-
reloadSlot: function(url) {
|
11647
|
-
var $slot;
|
11648
|
-
$slot = $(this);
|
11649
|
-
if ($slot.length > 1) {
|
11650
|
-
$slot.each(function() {
|
11651
|
-
return $(this).reloadSlot(url);
|
11652
|
-
});
|
11653
|
-
return;
|
11654
|
-
}
|
11655
|
-
if (!$slot.isSlot) {
|
11656
|
-
$slot = $slot.slot();
|
11657
|
-
}
|
11658
|
-
if (!$slot[0]) {
|
11659
|
-
return;
|
11660
|
-
}
|
11661
|
-
if (url == null) {
|
11662
|
-
url = $slot.slotUrl();
|
11663
|
-
}
|
11664
|
-
$slot.addClass('slotter');
|
11665
|
-
$slot.attr('href', url);
|
11666
|
-
$slot.data("url", url);
|
11667
|
-
this[0].href = url;
|
11668
|
-
$slot.data("remote", true);
|
11669
|
-
return $.rails.handleRemote($slot);
|
11670
|
-
},
|
11671
|
-
clearSlot: function() {
|
11672
|
-
this.triggerSlotDestroy();
|
11673
|
-
return this.empty();
|
11674
|
-
},
|
11675
|
-
slotUrl: function() {
|
11676
|
-
return decko.slotPath((this.slotMark()) + "?view=" + (this.data("slot")["view"]));
|
11677
|
-
},
|
11678
|
-
slotMark: function() {
|
11679
|
-
if (this.data('cardId')) {
|
11680
|
-
return "~" + (this.data('cardId'));
|
11681
|
-
} else {
|
11682
|
-
return this.data("cardName");
|
11683
|
-
}
|
11684
|
-
},
|
11685
|
-
setSlotContent: function(val, mode, $slotter) {
|
11686
|
-
var v;
|
11687
|
-
v = $(val)[0] && $(val) || val;
|
11688
|
-
if (typeof v === "string") {
|
11689
|
-
this.slot("success", mode).replaceWith(v);
|
11690
|
-
} else {
|
11691
|
-
if (v.hasClass("_overlay")) {
|
11692
|
-
mode = "overlay";
|
11693
|
-
} else if (v.hasClass("_modal")) {
|
11694
|
-
mode = "modal";
|
11695
|
-
}
|
11696
|
-
this.slot("success", mode).setSlotContentFromElement(v, mode, $slotter);
|
11697
|
-
}
|
11698
|
-
return v;
|
11699
|
-
},
|
11700
|
-
setSlotContentFromElement: function(el, mode, $slotter) {
|
11701
|
-
var slot_id;
|
11702
|
-
if (mode === "overlay") {
|
11703
|
-
return this.addOverlay(el, $slotter);
|
11704
|
-
} else if (el.hasClass("_modal-slot") || mode === "modal") {
|
11705
|
-
return el.showAsModal($slotter);
|
11706
|
-
} else {
|
11707
|
-
slot_id = this.data("slot-id");
|
11708
|
-
if (slot_id) {
|
11709
|
-
el.attr("data-slot-id", slot_id);
|
11710
|
-
}
|
11711
|
-
this.triggerSlotDestroy();
|
11712
|
-
this.replaceWith(el);
|
11713
|
-
return decko.contentLoaded(el, $slotter);
|
11714
|
-
}
|
11715
|
-
},
|
11716
|
-
triggerSlotReady: function(slotter) {
|
11717
|
-
if (this.isSlot()) {
|
11718
|
-
this.trigger("slotReady", slotter);
|
11719
|
-
}
|
11720
|
-
return this.find(".card-slot").trigger("slotReady", slotter);
|
11721
|
-
},
|
11722
|
-
triggerSlotDestroy: function() {
|
11723
|
-
return this.trigger("slotDestroy");
|
11724
|
-
}
|
11725
|
-
});
|
11726
|
-
|
11727
|
-
$(window).ready(function() {
|
11728
|
-
$('body').on('hidden.bs.modal', function(_event) {
|
11729
|
-
return decko.removeModal();
|
11730
|
-
});
|
11731
|
-
$('body').on("show.bs.modal", "._modal-slot", function(event, slot) {
|
11732
|
-
var link;
|
11733
|
-
link = $(event.relatedTarget);
|
11734
|
-
addModalDialogClasses($(this), link);
|
11735
|
-
$(this).modal("handleUpdate");
|
11736
|
-
return decko.contentLoaded($(event.target), link);
|
11737
|
-
});
|
11738
|
-
$('._modal-slot').each(function() {
|
11739
|
-
openModalIfPresent($(this));
|
11740
|
-
return addModalDialogClasses($(this));
|
11741
|
-
});
|
11742
|
-
return $('body').on('click', '.submit-modal', function() {
|
11743
|
-
return $(this).closest('.modal-content').find('form').submit();
|
11744
|
-
});
|
11745
|
-
});
|
11746
|
-
|
11747
|
-
openModalIfPresent = function(mslot) {
|
11748
|
-
var modal_content;
|
11749
|
-
modal_content = mslot.find(".modal-content");
|
11750
|
-
if (modal_content.length > 0 && modal_content.html().length > 0) {
|
11751
|
-
$("#main > .card-slot").registerAsOrigin("modal", mslot);
|
11752
|
-
return mslot.modal("show");
|
11753
|
-
}
|
11754
|
-
};
|
11755
|
-
|
11756
|
-
addModalDialogClasses = function($modal_slot, $link) {
|
11757
|
-
var classes_from_link, dialog;
|
11758
|
-
dialog = $modal_slot.find(".modal-dialog");
|
11759
|
-
classes_from_link = $link != null ? $link.data("modal-class") : $modal_slot.data("modal-class");
|
11760
|
-
if ((classes_from_link != null) && (dialog != null)) {
|
11761
|
-
return dialog.addClass(classes_from_link);
|
11762
|
-
}
|
11763
|
-
};
|
11764
|
-
|
11765
|
-
jQuery.fn.extend({
|
11766
|
-
showAsModal: function($slotter) {
|
11767
|
-
var el;
|
11768
|
-
if ($slotter != null) {
|
11769
|
-
el = this.modalify($slotter);
|
11770
|
-
}
|
11771
|
-
if ($("body > ._modal-slot").is(":visible")) {
|
11772
|
-
return this.addModal(el, $slotter);
|
11773
|
-
} else {
|
11774
|
-
if ($("body > ._modal-slot")[0]) {
|
11775
|
-
$("._modal-slot").trigger("slotDestroy");
|
11776
|
-
$("body > ._modal-slot").replaceWith(el);
|
11777
|
-
} else {
|
11778
|
-
$("body").append(el);
|
11779
|
-
}
|
11780
|
-
$slotter.registerAsOrigin("modal", el);
|
11781
|
-
return el.modal("show", $slotter);
|
11782
|
-
}
|
11783
|
-
},
|
11784
|
-
addModal: function(el, $slotter) {
|
11785
|
-
var dialog;
|
11786
|
-
if ($slotter.data("slotter-mode") === "modal-replace") {
|
11787
|
-
dialog = el.find(".modal-dialog");
|
11788
|
-
el.adoptModalOrigin();
|
11789
|
-
$("._modal-slot").trigger("slotDestroy");
|
11790
|
-
$("body > ._modal-slot > .modal-dialog").replaceWith(dialog);
|
11791
|
-
return decko.contentLoaded(dialog, $slotter);
|
11792
|
-
} else {
|
11793
|
-
decko.pushModal(el);
|
11794
|
-
$slotter.registerAsOrigin("modal", el);
|
11795
|
-
return el.modal("show", $slotter);
|
11796
|
-
}
|
11797
|
-
},
|
11798
|
-
adoptModalOrigin: function() {
|
11799
|
-
var origin_slot_id;
|
11800
|
-
origin_slot_id = $("body > ._modal-slot .card-slot[data-modal-origin-slot-id]").data("modal-origin-slot-id");
|
11801
|
-
return this.find(".modal-body .card-slot").attr("data-modal-origin-slot-id", origin_slot_id);
|
11802
|
-
},
|
11803
|
-
modalSlot: function() {
|
11804
|
-
var slot;
|
11805
|
-
slot = $("#modal-container");
|
11806
|
-
if (slot.length > 0) {
|
11807
|
-
return slot;
|
11808
|
-
} else {
|
11809
|
-
return decko.createModalSlot();
|
11810
|
-
}
|
11811
|
-
},
|
11812
|
-
modalify: function($slotter) {
|
11813
|
-
var modalSlot;
|
11814
|
-
if ($slotter.data("modal-body") != null) {
|
11815
|
-
this.find(".modal-body").append($slotter.data("modal-body"));
|
11816
|
-
}
|
11817
|
-
if (this.hasClass("_modal-slot")) {
|
11818
|
-
return this;
|
11819
|
-
} else {
|
11820
|
-
modalSlot = $('<div/>', {
|
11821
|
-
id: "modal-container",
|
11822
|
-
"class": "modal fade _modal-slot"
|
11823
|
-
});
|
11824
|
-
modalSlot.append($('<div/>', {
|
11825
|
-
"class": "modal-dialog"
|
11826
|
-
}).append($('<div/>', {
|
11827
|
-
"class": "modal-content"
|
11828
|
-
}).append(this)));
|
11829
|
-
return modalSlot;
|
11830
|
-
}
|
11831
|
-
}
|
11832
|
-
});
|
11833
|
-
|
11834
|
-
$.extend(decko, {
|
11835
|
-
createModalSlot: function() {
|
11836
|
-
var slot;
|
11837
|
-
slot = $('<div/>', {
|
11838
|
-
id: "modal-container",
|
11839
|
-
"class": "modal fade _modal-slot"
|
11840
|
-
});
|
11841
|
-
$("body").append(slot);
|
11842
|
-
return slot;
|
11843
|
-
},
|
11844
|
-
removeModal: function() {
|
11845
|
-
if ($("._modal-stack")[0]) {
|
11846
|
-
return decko.popModal();
|
11847
|
-
} else {
|
11848
|
-
$("._modal-slot").trigger("slotDestroy");
|
11849
|
-
return $(".modal-dialog").empty();
|
11850
|
-
}
|
11851
|
-
},
|
11852
|
-
pushModal: function(el) {
|
11853
|
-
var mslot;
|
11854
|
-
mslot = $("body > ._modal-slot");
|
11855
|
-
mslot.removeAttr("id");
|
11856
|
-
mslot.removeClass("_modal-slot").addClass("_modal-stack").removeClass("modal").addClass("background-modal");
|
11857
|
-
el.insertBefore(mslot);
|
11858
|
-
return $(".modal-backdrop").removeClass("show");
|
11859
|
-
},
|
11860
|
-
popModal: function() {
|
11861
|
-
var modal;
|
11862
|
-
$(".modal-backdrop").addClass("show");
|
11863
|
-
$("body > ._modal-slot").trigger("slotDestroy");
|
11864
|
-
$("body > ._modal-slot").remove();
|
11865
|
-
modal = $($("._modal-stack")[0]);
|
11866
|
-
modal.addClass("_modal-slot").removeClass("_modal-stack").attr("id", "modal-container").addClass("modal").removeClass("background-modal");
|
11867
|
-
return $(document.body).addClass("modal-open");
|
11868
|
-
}
|
11869
|
-
});
|
11870
|
-
|
11871
|
-
jQuery.fn.extend({
|
11872
|
-
overlaySlot: function() {
|
11873
|
-
var oslot;
|
11874
|
-
oslot = this.closest(".card-slot._overlay");
|
11875
|
-
if (oslot[0] != null) {
|
11876
|
-
return oslot;
|
11877
|
-
}
|
11878
|
-
oslot = this.closest(".overlay-container").find("._overlay");
|
11879
|
-
return (oslot[0] != null) && $(oslot[0]);
|
11880
|
-
},
|
11881
|
-
addOverlay: function(overlay, $slotter) {
|
11882
|
-
if (this.parent().hasClass("overlay-container")) {
|
11883
|
-
if ($(overlay).hasClass("_stack-overlay")) {
|
11884
|
-
this.before(overlay);
|
11885
|
-
} else {
|
11886
|
-
$("._overlay-origin").removeClass("_overlay-origin");
|
11887
|
-
this.replaceOverlay(overlay);
|
11888
|
-
}
|
11889
|
-
} else {
|
11890
|
-
if (this.parent().hasClass("_overlay-container-placeholder")) {
|
11891
|
-
this.parent().addClass("overlay-container");
|
11892
|
-
} else {
|
11893
|
-
this.wrapAll('<div class="overlay-container">');
|
11894
|
-
}
|
11895
|
-
this.addClass("_bottomlay-slot");
|
11896
|
-
this.before(overlay);
|
11897
|
-
}
|
11898
|
-
$slotter.registerAsOrigin("overlay", overlay);
|
11899
|
-
return decko.contentLoaded(overlay, $slotter);
|
11900
|
-
},
|
11901
|
-
replaceOverlay: function(overlay) {
|
11902
|
-
this.overlaySlot().trigger("slotDestroy");
|
11903
|
-
this.overlaySlot().replaceWith(overlay);
|
11904
|
-
return $(".bridge-sidebar .tab-pane:not(.active) .bridge-pills > .nav-item > .nav-link.active").removeClass("active");
|
11905
|
-
},
|
11906
|
-
isInOverlay: function() {
|
11907
|
-
return this.closest(".card-slot._overlay").length;
|
11908
|
-
},
|
11909
|
-
removeOverlay: function() {
|
11910
|
-
var slot;
|
11911
|
-
slot = this.overlaySlot();
|
11912
|
-
if (slot) {
|
11913
|
-
return slot.removeOverlaySlot();
|
11914
|
-
}
|
11915
|
-
},
|
11916
|
-
removeOverlaySlot: function() {
|
11917
|
-
var bottomlay;
|
11918
|
-
this.trigger("slotDestroy");
|
11919
|
-
if (this.siblings().length === 1) {
|
11920
|
-
bottomlay = $(this.siblings()[0]);
|
11921
|
-
if (bottomlay.hasClass("_bottomlay-slot")) {
|
11922
|
-
if (bottomlay.parent().hasClass("_overlay-container-placeholder")) {
|
11923
|
-
bottomlay.parent().removeClass("overlay-container");
|
11924
|
-
} else {
|
11925
|
-
bottomlay.unwrap();
|
11926
|
-
}
|
11927
|
-
bottomlay.removeClass("_bottomlay-slot").updateBridge(true, bottomlay);
|
11928
|
-
}
|
11929
|
-
}
|
11930
|
-
return this.remove();
|
11931
|
-
}
|
11932
|
-
});
|
11933
|
-
|
11934
|
-
jQuery.fn.extend({
|
11935
|
-
updateRecaptchaToken: function(event) {
|
11936
|
-
var $slotter, recaptcha;
|
11937
|
-
recaptcha = this.find("input._recaptcha-token");
|
11938
|
-
if (recaptcha[0] == null) {
|
11939
|
-
return recaptcha.val("recaptcha-token-field-missing");
|
11940
|
-
} else if (typeof grecaptcha === "undefined" || grecaptcha === null) {
|
11941
|
-
return recaptcha.val("grecaptcha-undefined");
|
11942
|
-
} else {
|
11943
|
-
$slotter = $(this);
|
11944
|
-
if (event) {
|
11945
|
-
event.stopPropagation();
|
11946
|
-
}
|
11947
|
-
grecaptcha.execute(recaptcha.data("site-key"), {
|
11948
|
-
action: recaptcha.data("action")
|
11949
|
-
}).then(function(token) {
|
11950
|
-
recaptcha.val(token);
|
11951
|
-
recaptcha.addClass("_token-updated");
|
11952
|
-
if (event) {
|
11953
|
-
return $slotter.submit();
|
11954
|
-
}
|
11955
|
-
});
|
11956
|
-
return false;
|
11957
|
-
}
|
11958
|
-
}
|
11959
|
-
});
|
11960
|
-
|
11961
|
-
$(window).ready(function() {
|
11962
|
-
$('body').on('ajax:success', '.slotter', function(event, data, c, d) {
|
11963
|
-
return $(this).slotterSuccess(event, data);
|
11964
|
-
});
|
11965
|
-
$('body').on('ajax:error', '.slotter', function(event, xhr) {
|
11966
|
-
return $(this).showErrorResponse(xhr.status, xhr.responseText);
|
11967
|
-
});
|
11968
|
-
$('body').on('click', 'button.slotter', function(event) {
|
11969
|
-
if (!$.rails.allowAction($(this))) {
|
11970
|
-
return false;
|
11971
|
-
}
|
11972
|
-
return $.rails.handleRemote($(this));
|
11973
|
-
});
|
11974
|
-
$('body').on('click', '._clickable.slotter', function(event) {
|
11975
|
-
$(this)[0].href = $(this).attr("href");
|
11976
|
-
return $.rails.handleRemote($(this));
|
11977
|
-
});
|
11978
|
-
$('body').on('click', '[data-dismiss="overlay"]', function(event) {
|
11979
|
-
return $(this).findSlot(".card-slot._overlay").removeOverlay();
|
11980
|
-
});
|
11981
|
-
$('body').on('click', '._close-overlay-on-success', function(event) {
|
11982
|
-
return $(this).closeOnSuccess("overlay");
|
11983
|
-
});
|
11984
|
-
$('body').on('click', '._close-modal-on-success', function(event) {
|
11985
|
-
return $(this).closeOnSuccess("modal");
|
11986
|
-
});
|
11987
|
-
$('body').on('click', '._close-on-success', function(event) {
|
11988
|
-
return $(this).closeOnSuccess();
|
11989
|
-
});
|
11990
|
-
$('body').on('click', '._update-origin', function(event) {
|
11991
|
-
return $(this).closest('.slotter').data("slotter-mode", "update-origin");
|
11992
|
-
});
|
11993
|
-
$('body').on('submit', 'form.slotter', function(event) {
|
11994
|
-
var input, target;
|
11995
|
-
if ((target = $(this).attr('main-success')) && $(this).isMain()) {
|
11996
|
-
input = $(this).find('[name=success]');
|
11997
|
-
if (input && input.val() && !(input.val().match(/^REDIRECT/))) {
|
11998
|
-
input.val((target === 'REDIRECT' ? target + ': ' + input.val() : target));
|
11999
|
-
}
|
12000
|
-
}
|
12001
|
-
if ($(this).data('recaptcha') === 'on') {
|
12002
|
-
return $(this).handleRecaptchaBeforeSubmit(event);
|
12003
|
-
}
|
12004
|
-
});
|
12005
|
-
return $('body').on('ajax:beforeSend', '.slotter', function(event, xhr, opt) {
|
12006
|
-
return $(this).slotterBeforeSend(opt);
|
12007
|
-
});
|
12008
|
-
});
|
12009
|
-
|
12010
|
-
jQuery.fn.extend({
|
12011
|
-
slotterSuccess: function(event, data) {
|
12012
|
-
var $slot, mode, reload_url, slot_top_pos;
|
12013
|
-
if (!this.hasClass("slotter")) {
|
12014
|
-
console.log("warning: slotterSuccess called on non-slotter element " + this);
|
12015
|
-
return;
|
12016
|
-
}
|
12017
|
-
if (event.slotSuccessful) {
|
12018
|
-
return;
|
12019
|
-
}
|
12020
|
-
if (this.data("reload")) {
|
12021
|
-
window.location.reload(true);
|
12022
|
-
}
|
12023
|
-
if (this.data("update-modal-origin")) {
|
12024
|
-
this.updateModalOrigin();
|
12025
|
-
}
|
12026
|
-
if (this.data("update-origin")) {
|
12027
|
-
this.updateOrigin();
|
12028
|
-
}
|
12029
|
-
if (this.data('original-slotter-mode')) {
|
12030
|
-
this.attr('data-slotter-mode', this.data('original-slotter-mode'));
|
12031
|
-
}
|
12032
|
-
mode = this.data("slotter-mode");
|
12033
|
-
this.showSuccessResponse(data, mode);
|
12034
|
-
if (this.hasClass("_close-overlay")) {
|
12035
|
-
this.removeOverlay();
|
12036
|
-
}
|
12037
|
-
if (this.hasClass("_close-modal")) {
|
12038
|
-
this.closest('.modal').modal('hide');
|
12039
|
-
}
|
12040
|
-
if (this.hasClass("card-paging-link")) {
|
12041
|
-
slot_top_pos = this.slot().offset().top;
|
12042
|
-
$("body").scrollTop(slot_top_pos);
|
12043
|
-
}
|
12044
|
-
if (this.data("update-foreign-slot")) {
|
12045
|
-
$slot = this.findSlot(this.data("update-foreign-slot"));
|
12046
|
-
reload_url = this.data("update-foreign-slot-url");
|
12047
|
-
$slot.reloadSlot(reload_url);
|
12048
|
-
}
|
12049
|
-
return event.slotSuccessful = true;
|
12050
|
-
},
|
12051
|
-
showSuccessResponse: function(data, mode) {
|
12052
|
-
if (mode === "silent-success") {
|
12053
|
-
|
12054
|
-
} else if (mode === "update-modal-origin") {
|
12055
|
-
return this.updateModalOrigin();
|
12056
|
-
} else if (mode === "update-origin") {
|
12057
|
-
return this.updateOrigin();
|
12058
|
-
} else if (data.redirect) {
|
12059
|
-
return window.location = data.redirect;
|
12060
|
-
} else if (data.reload) {
|
12061
|
-
return window.location.reload(true);
|
12062
|
-
} else {
|
12063
|
-
return this.updateSlot(data, mode);
|
12064
|
-
}
|
12065
|
-
},
|
12066
|
-
showErrorResponse: function(status, result) {
|
12067
|
-
if (status === 403) {
|
12068
|
-
return $(result).showAsModal($(this));
|
12069
|
-
} else if (status === 900) {
|
12070
|
-
return $(result).showAsModal($(this));
|
12071
|
-
} else {
|
12072
|
-
this.notify(result, "error");
|
12073
|
-
if (status === 409) {
|
12074
|
-
return this.slot().find('.current_revision_id').val(this.slot().find('.new-current-revision-id').text());
|
12075
|
-
}
|
12076
|
-
}
|
12077
|
-
},
|
12078
|
-
updateModalOrigin: function() {
|
12079
|
-
var overlayOrigin;
|
12080
|
-
if (this.overlaySlot()) {
|
12081
|
-
overlayOrigin = this.findOriginSlot("overlay");
|
12082
|
-
return overlayOrigin.updateOrigin();
|
12083
|
-
} else if (this.closest("#modal-container")[0]) {
|
12084
|
-
return this.updateOrigin();
|
12085
|
-
}
|
12086
|
-
},
|
12087
|
-
updateOrigin: function() {
|
12088
|
-
var origin, type;
|
12089
|
-
type = this.overlaySlot() ? "overlay" : this.closest("#modal-container")[0] ? "modal" : void 0;
|
12090
|
-
if (type == null) {
|
12091
|
-
return;
|
12092
|
-
}
|
12093
|
-
origin = this.findOriginSlot(type);
|
12094
|
-
if (origin && (origin[0] != null)) {
|
12095
|
-
return origin.reloadSlot();
|
12096
|
-
}
|
12097
|
-
},
|
12098
|
-
registerAsOrigin: function(type, slot) {
|
12099
|
-
if (slot.hasClass("_modal-slot")) {
|
12100
|
-
slot = slot.find(".modal-body .card-slot");
|
12101
|
-
}
|
12102
|
-
return slot.attr("data-" + type + "-origin-slot-id", this.closest(".card-slot").data("slot-id"));
|
12103
|
-
},
|
12104
|
-
updateSlot: function(data, mode) {
|
12105
|
-
mode || (mode = "replace");
|
12106
|
-
return this.setSlotContent(data, mode, $(this));
|
12107
|
-
},
|
12108
|
-
closeOnSuccess: function(type) {
|
12109
|
-
var slotter;
|
12110
|
-
slotter = this.closest('.slotter');
|
12111
|
-
if (type == null) {
|
12112
|
-
type = this.isInOverlay() ? "overlay" : "modal";
|
12113
|
-
}
|
12114
|
-
return slotter.addClass("_close-" + type);
|
12115
|
-
},
|
12116
|
-
slotterBeforeSend: function(opt) {
|
12117
|
-
var data;
|
12118
|
-
if (opt.skip_before_send) {
|
12119
|
-
return;
|
12120
|
-
}
|
12121
|
-
if (!(opt.url.match(/home_view/) || this.data("slotter-mode") === "modal")) {
|
12122
|
-
opt.url = decko.slotPath(opt.url, this.slot());
|
12123
|
-
}
|
12124
|
-
if (this.is('form')) {
|
12125
|
-
if (data = this.data('file-data')) {
|
12126
|
-
this.uploadWithBlueimp(data, opt);
|
12127
|
-
return false;
|
12128
|
-
}
|
12129
|
-
}
|
12130
|
-
},
|
12131
|
-
uploadWithBlueimp: function(data, opt) {
|
12132
|
-
var args, iframeUploadFilter, input, widget;
|
12133
|
-
input = this.find('.file-upload');
|
12134
|
-
if (input[1]) {
|
12135
|
-
this.notify("Decko does not yet support multiple files in a single form.", "error");
|
12136
|
-
return false;
|
12137
|
-
}
|
12138
|
-
widget = input.data('blueimpFileupload');
|
12139
|
-
if (!widget._isXHRUpload(widget.options)) {
|
12140
|
-
this.find('[name=success]').val('_self');
|
12141
|
-
opt.url += '&simulate_xhr=true';
|
12142
|
-
iframeUploadFilter = function(data) {
|
12143
|
-
return data.find('body').html();
|
12144
|
-
};
|
12145
|
-
opt.dataFilter = iframeUploadFilter;
|
12146
|
-
}
|
12147
|
-
args = $.extend(opt, widget._getAJAXSettings(data), {
|
12148
|
-
url: opt.url
|
12149
|
-
});
|
12150
|
-
args.skip_before_send = true;
|
12151
|
-
return $.ajax(args);
|
12152
|
-
},
|
12153
|
-
handleRecaptchaBeforeSubmit: function(event) {
|
12154
|
-
var recaptcha;
|
12155
|
-
recaptcha = this.find("input._recaptcha-token");
|
12156
|
-
if (recaptcha[0] == null) {
|
12157
|
-
return recaptcha.val("recaptcha-token-field-missing");
|
12158
|
-
} else if (recaptcha.hasClass("_token-updated")) {
|
12159
|
-
return recaptcha.removeClass("_token-updated");
|
12160
|
-
} else if (typeof grecaptcha === "undefined" || grecaptcha === null) {
|
12161
|
-
return recaptcha.val("grecaptcha-undefined");
|
12162
|
-
} else {
|
12163
|
-
return this.updateRecaptchaToken(event);
|
12164
|
-
}
|
12165
|
-
}
|
12166
|
-
});
|
12167
|
-
|
12168
|
-
decko.slotReady(function(slot, slotter) {
|
12169
|
-
var links;
|
12170
|
-
slot.updateBridge(false, slotter);
|
12171
|
-
links = slot.find('ul._auto-single-select > li.nav-item > a.nav-link');
|
12172
|
-
if (links.length === 1) {
|
12173
|
-
return $(links[0]).click();
|
12174
|
-
}
|
12175
|
-
});
|
12176
|
-
|
12177
|
-
jQuery.fn.extend({
|
12178
|
-
updateBridge: function(overlayClosed, slotter) {
|
12179
|
-
if (overlayClosed == null) {
|
12180
|
-
overlayClosed = false;
|
12181
|
-
}
|
12182
|
-
if (!(this.closest(".bridge").length > 0)) {
|
12183
|
-
return;
|
12184
|
-
}
|
12185
|
-
if (this.data("breadcrumb")) {
|
12186
|
-
this.updateBreadcrumb();
|
12187
|
-
} else if (slotter && $(slotter).data("breadcrumb")) {
|
12188
|
-
$(slotter).updateBreadcrumb();
|
12189
|
-
}
|
12190
|
-
if (overlayClosed) {
|
12191
|
-
return $(".bridge-pills > .nav-item > .nav-link.active").removeClass("active");
|
12192
|
-
}
|
12193
|
-
},
|
12194
|
-
updateBreadcrumb: function() {
|
12195
|
-
var bc_item;
|
12196
|
-
bc_item = $(".modal-header ._bridge-breadcrumb li:last-child");
|
12197
|
-
bc_item.text(this.data("breadcrumb"));
|
12198
|
-
return bc_item.attr("class", "breadcrumb-item active " + (this.data('breadcrumb-class')));
|
12199
|
-
}
|
12200
|
-
});
|
12201
|
-
|
12202
|
-
$(window).ready(function() {
|
12203
|
-
$('body').on("select2:select", "._close-rule-overlay-on-select", function(event) {
|
12204
|
-
return $(".overlay-container > ._overlay.card-slot.overlay_rule-view.RULE").removeOverlay();
|
12205
|
-
});
|
12206
|
-
return $('body').on("click", "._update-history-pills", function(event) {
|
12207
|
-
return $(this).closest(".slotter").data("update-foreign-slot", ".card-slot.history_tab-view");
|
12208
|
-
});
|
12209
|
-
});
|
12210
|
-
|
12211
|
-
$(document).ready(function() {
|
12212
|
-
$('body').on('click', 'button._nest-apply', function() {
|
12213
|
-
if ($(this).data("index") != null) {
|
12214
|
-
return nest.applyNestToNestListEditor($(this).data("index"));
|
12215
|
-
} else {
|
12216
|
-
return nest.applyNestToTinymceEditor($(this).data("tinymce-id"), $(this).data("tm-snippet-start"), $(this).data("tm-snippet-size"));
|
12217
|
-
}
|
12218
|
-
});
|
12219
|
-
$('body').on('click', 'button._change-create-to-update', function() {
|
12220
|
-
var tm_id;
|
12221
|
-
tm_id = $(this).closest("form").find("#success_tinymce_id").val();
|
12222
|
-
return nest.changeCreateToUpdate(tm_id);
|
12223
|
-
});
|
12224
|
-
return $('body').on('click', 'button._open-nest-editor', function() {
|
12225
|
-
var encoded_nest, form, nest_options, reference;
|
12226
|
-
form = $(this).closest("._nest-form");
|
12227
|
-
reference = form.find("._reference").val();
|
12228
|
-
nest_options = form.find("._nest-options").val();
|
12229
|
-
encoded_nest = encodeURIComponent("{{" + reference + "|" + nest_options + "}}");
|
12230
|
-
return nest.openNestEditorForSlot($(this).closest(".card-slot"), $(this).closest(".slotter"), "index=" + (form.data('index')) + "&tm_snippet_raw=" + encoded_nest);
|
12231
|
-
});
|
12232
|
-
});
|
12233
|
-
|
12234
|
-
window.nest || (window.nest = {});
|
12235
|
-
|
12236
|
-
$.extend(nest, {
|
12237
|
-
openNestEditor: function(tm, params) {
|
12238
|
-
if (params == null) {
|
12239
|
-
params = nest.editParams(tm);
|
12240
|
-
}
|
12241
|
-
return this.openEditorForTm(tm, params, "nest_editor", "modal_nest_editor");
|
12242
|
-
},
|
12243
|
-
openNestEditorForSlot: function(slot, slotter, params) {
|
12244
|
-
var card;
|
12245
|
-
card = slot[0] ? $(slot[0]).attr('data-card-name') : ":update";
|
12246
|
-
return nest.request(card, "nest_editor", "modal_nest_editor", slotter, params);
|
12247
|
-
},
|
12248
|
-
openEditorForTm: function(tm, params, overlay_view, modal_view) {
|
12249
|
-
var card, slot, slotter;
|
12250
|
-
params += "&tinymce_id=" + tm.id;
|
12251
|
-
slot = $("#" + tm.id).closest(".card-slot");
|
12252
|
-
slotter = $("#" + tm.id);
|
12253
|
-
card = slot[0] ? $(slot[0]).attr('data-card-name') : ":update";
|
12254
|
-
return nest.request(card, overlay_view, modal_view, slotter, params);
|
12255
|
-
},
|
12256
|
-
openImageEditor: function(tm) {
|
12257
|
-
var params;
|
12258
|
-
if (typeof params === "undefined" || params === null) {
|
12259
|
-
params = nest.editParams(tm, "{{", "}}", false);
|
12260
|
-
}
|
12261
|
-
return this.openEditorForTm(tm, params, "nest_image", "modal_nest_image");
|
12262
|
-
},
|
12263
|
-
changeCreateToUpdate: function(tm_id) {
|
12264
|
-
var form, new_action;
|
12265
|
-
form = $("#" + tm_id).closest("form");
|
12266
|
-
new_action = form.attr("action").replace("card/create", "card/update");
|
12267
|
-
return form.attr("action", new_action);
|
12268
|
-
},
|
12269
|
-
insertNest: function(tm, nest_string) {
|
12270
|
-
return tm.insertContent(nest_string);
|
12271
|
-
},
|
12272
|
-
request: function(card, overlay_view, modal_view, slotter, params) {
|
12273
|
-
var mode, slot, view;
|
12274
|
-
slot = $(".bridge-sidebar > ._overlay-container-placeholder > .card-slot");
|
12275
|
-
if (slot[0]) {
|
12276
|
-
view = overlay_view;
|
12277
|
-
mode = "overlay";
|
12278
|
-
} else {
|
12279
|
-
slot = $($(".card-slot")[0]);
|
12280
|
-
view = modal_view;
|
12281
|
-
mode = "modal";
|
12282
|
-
}
|
12283
|
-
return nest.sendRequest(slotter, slot, mode, card, view, params);
|
12284
|
-
},
|
12285
|
-
sendRequest: function(slotter, slot, mode, card, view, params) {
|
12286
|
-
var url;
|
12287
|
-
if (params == null) {
|
12288
|
-
params = "";
|
12289
|
-
}
|
12290
|
-
url = "/" + card + "?view=" + view + "&" + params;
|
12291
|
-
return $.ajax({
|
12292
|
-
url: url,
|
12293
|
-
type: 'GET',
|
12294
|
-
success: function(html) {
|
12295
|
-
return slot.setSlotContent(html, mode, slotter);
|
12296
|
-
}
|
12297
|
-
});
|
12298
|
-
},
|
12299
|
-
editParams: function(tm, prefix, postfix, edit) {
|
12300
|
-
var after, before, index, name, nest_size, nest_start, offset, sel, text;
|
12301
|
-
if (prefix == null) {
|
12302
|
-
prefix = "{{";
|
12303
|
-
}
|
12304
|
-
if (postfix == null) {
|
12305
|
-
postfix = "}}";
|
12306
|
-
}
|
12307
|
-
if (edit == null) {
|
12308
|
-
edit = true;
|
12309
|
-
}
|
12310
|
-
sel = tm.selection.getSel();
|
12311
|
-
if (!((sel != null) && (sel.anchorNode != null))) {
|
12312
|
-
return nest.paramsStr(0);
|
12313
|
-
}
|
12314
|
-
text = sel.anchorNode.data;
|
12315
|
-
if (!text) {
|
12316
|
-
return nest.paramsStr(sel.anchorOffset);
|
12317
|
-
}
|
12318
|
-
offset = sel.anchorOffset;
|
12319
|
-
before = text.substr(0, offset);
|
12320
|
-
after = text.substr(offset);
|
12321
|
-
index = {
|
12322
|
-
before: {
|
12323
|
-
close: before.lastIndexOf(postfix),
|
12324
|
-
open: before.lastIndexOf(prefix)
|
12325
|
-
},
|
12326
|
-
after: {
|
12327
|
-
close: after.indexOf(postfix),
|
12328
|
-
open: after.indexOf(prefix)
|
12329
|
-
}
|
12330
|
-
};
|
12331
|
-
if (index.before.open > index.before.close && index.after.close !== -1 && (index.after.open === -1 || index.after.close < index.after.open)) {
|
12332
|
-
nest_start = index.before.open;
|
12333
|
-
if (typeof name === "undefined" || name === null) {
|
12334
|
-
nest_size = index.after.close + offset + 2 - nest_start;
|
12335
|
-
name = text.substr(nest_start, nest_size);
|
12336
|
-
}
|
12337
|
-
if (edit) {
|
12338
|
-
return nest.paramsStr(nest_start, name);
|
12339
|
-
} else {
|
12340
|
-
return nest.paramsStr(nest_start + nest_size);
|
12341
|
-
}
|
12342
|
-
} else {
|
12343
|
-
return nest.paramsStr(offset);
|
12344
|
-
}
|
12345
|
-
},
|
12346
|
-
paramsStr: function(start, name) {
|
12347
|
-
var params;
|
12348
|
-
params = "";
|
12349
|
-
if (start != null) {
|
12350
|
-
params += "&tm_snippet_start=" + start;
|
12351
|
-
}
|
12352
|
-
if ((name != null) && name.length > 0) {
|
12353
|
-
params += "&tm_snippet_raw=" + (encodeURIComponent(name));
|
12354
|
-
}
|
12355
|
-
return params;
|
12356
|
-
},
|
12357
|
-
offsetAfterInsert: function(editor, content) {
|
12358
|
-
var offset;
|
12359
|
-
offset = editor.selection.getSel().anchorOffset;
|
12360
|
-
return offset - content.lengthr;
|
12361
|
-
},
|
12362
|
-
applyNestToTinymceEditor: function(tinymce_id, nest_start, nest_size) {
|
12363
|
-
return nest.applySnippet("nest", tinymce_id, nest_start, nest_size);
|
12364
|
-
},
|
12365
|
-
applyNestToNestListEditor: function(index) {
|
12366
|
-
var row;
|
12367
|
-
row = $("._nest-form[data-index='" + index + "']");
|
12368
|
-
row.find("._reference").val(nest.name());
|
12369
|
-
row.find("._nest-options").val(nest.options());
|
12370
|
-
return decko.updateAddItemButton(row);
|
12371
|
-
},
|
12372
|
-
applySnippet: function(snippet_type, tinymce_id, start, size) {
|
12373
|
-
var content, editor, offset;
|
12374
|
-
content = $("._" + snippet_type + "-preview").val();
|
12375
|
-
editor = tinymce.get(tinymce_id);
|
12376
|
-
if (start != null) {
|
12377
|
-
nest.replaceSnippet(editor, start, size, content);
|
12378
|
-
} else {
|
12379
|
-
editor.insertContent(content);
|
12380
|
-
offset = nest.offsetAfterInsert(editor, content);
|
12381
|
-
$("button._" + snippet_type + "-apply").attr("data-tm-snippet-start", offset);
|
12382
|
-
}
|
12383
|
-
return $("button._" + snippet_type + "-apply").attr("data-tm-snippet-size", content.length);
|
12384
|
-
},
|
12385
|
-
replaceSnippet: function(editor, start, size, content) {
|
12386
|
-
var sel, text;
|
12387
|
-
sel = editor.selection.getSel();
|
12388
|
-
if ((sel != null) && (sel.anchorNode != null) && (sel.anchorNode.data != null)) {
|
12389
|
-
text = sel.anchorNode.data;
|
12390
|
-
if (size == null) {
|
12391
|
-
size = 0;
|
12392
|
-
}
|
12393
|
-
text = "" + (text.substr(0, start)) + content + (text.substr(start + size));
|
12394
|
-
return sel.anchorNode.data = text;
|
12395
|
-
} else {
|
12396
|
-
return editor.insertContent(content);
|
12397
|
-
}
|
12398
|
-
},
|
12399
|
-
updatePreview: function(new_val) {
|
12400
|
-
var preview;
|
12401
|
-
if (new_val == null) {
|
12402
|
-
new_val = "{{" + (nest.name()) + "|" + (nest.options()) + "}}";
|
12403
|
-
}
|
12404
|
-
preview = $("._nest-preview");
|
12405
|
-
preview.val(new_val);
|
12406
|
-
preview.data("nest-options", nest.options());
|
12407
|
-
return preview.data("reference", nest.name());
|
12408
|
-
}
|
12409
|
-
});
|
12410
|
-
|
12411
|
-
$(document).ready(function() {
|
12412
|
-
$('body').on('keyup', 'input._nest-option-value', function() {
|
12413
|
-
return nest.updatePreview();
|
12414
|
-
});
|
12415
|
-
$('body').on("select2:select", "._nest-option-name", function() {
|
12416
|
-
nest.toggleOptionName($(this).closest("._options-select"), $(this).val(), true);
|
12417
|
-
return nest.updatePreview();
|
12418
|
-
});
|
12419
|
-
$('body').on("select2:selecting", "._nest-option-name", function() {
|
12420
|
-
return nest.toggleOptionName($(this).closest("._options-select"), $(this).val(), false);
|
12421
|
-
});
|
12422
|
-
$('body').on("select2:select", "._nest-option-name._new-row", function() {
|
12423
|
-
var row, template;
|
12424
|
-
$(this).closest(".input-group").find(".input-group-prepend").removeClass("d-none");
|
12425
|
-
row = $(this).closest("._nest-option-row");
|
12426
|
-
row.find("._nest-option-value").removeAttr("disabled");
|
12427
|
-
template = row.parent().find("._nest-option-row._template");
|
12428
|
-
$(this).removeClass("_new-row");
|
12429
|
-
return nest.addRow(template);
|
12430
|
-
});
|
12431
|
-
$('body').on("click", "._configure-items-button", function() {
|
12432
|
-
return nest.addItemsOptions($(this));
|
12433
|
-
});
|
12434
|
-
return $('body').on('click', 'button._nest-delete-option', function() {
|
12435
|
-
return nest.removeRow($(this).closest("._nest-option-row"));
|
12436
|
-
});
|
12437
|
-
});
|
12438
|
-
|
12439
|
-
$.extend(nest, {
|
12440
|
-
showTemplate: function(elem) {
|
12441
|
-
return elem.removeClass("_template");
|
12442
|
-
},
|
12443
|
-
addRow: function(template) {
|
12444
|
-
var double, select_tag;
|
12445
|
-
select_tag = template.find("select");
|
12446
|
-
select_tag.select2("destroy");
|
12447
|
-
select_tag.removeAttr("data-select2-id");
|
12448
|
-
double = template.clone();
|
12449
|
-
decko.initSelect2(select_tag);
|
12450
|
-
nest.showTemplate(template);
|
12451
|
-
template.after(double);
|
12452
|
-
return decko.initSelect2(double.find("select"));
|
12453
|
-
},
|
12454
|
-
removeRow: function(row) {
|
12455
|
-
var name;
|
12456
|
-
name = row.find("._nest-option-name").val();
|
12457
|
-
nest.toggleOptionName(row.closest("._options-select"), name, false);
|
12458
|
-
row.remove();
|
12459
|
-
return nest.updatePreview();
|
12460
|
-
},
|
12461
|
-
addItemsOptions: function(button) {
|
12462
|
-
var container, next, title;
|
12463
|
-
container = button.closest("._configure-items");
|
12464
|
-
next = container.cloneSelect2(true);
|
12465
|
-
title = button.text();
|
12466
|
-
button.replaceWith($("<h6>" + (title.substr(9)) + "<h6>"));
|
12467
|
-
nest.showTemplate(container.find("._options-select._template"));
|
12468
|
-
next.find("._configure-items-button").text(title.replace("items", "subitems"));
|
12469
|
-
container.after(next);
|
12470
|
-
return nest.updatePreview();
|
12471
|
-
},
|
12472
|
-
options: function() {
|
12473
|
-
var ele, j, len, level_options, options, ref;
|
12474
|
-
options = [];
|
12475
|
-
ref = $("._options-select:not(._template");
|
12476
|
-
for (j = 0, len = ref.length; j < len; j++) {
|
12477
|
-
ele = ref[j];
|
12478
|
-
options.push(nest.extractOptions($(ele)));
|
12479
|
-
}
|
12480
|
-
level_options = options.map(function(opts) {
|
12481
|
-
return nest.toNestSyntax(opts);
|
12482
|
-
});
|
12483
|
-
return level_options.join("|");
|
12484
|
-
},
|
12485
|
-
extractOptions: function(ele) {
|
12486
|
-
var j, len, options, ref, row;
|
12487
|
-
options = {};
|
12488
|
-
ref = ele.find("._nest-option-row:not(.template)");
|
12489
|
-
for (j = 0, len = ref.length; j < len; j++) {
|
12490
|
-
row = ref[j];
|
12491
|
-
nest.addOption(options, $(row));
|
12492
|
-
}
|
12493
|
-
return options;
|
12494
|
-
},
|
12495
|
-
addOption: function(options, row) {
|
12496
|
-
var name, val;
|
12497
|
-
val = row.find("._nest-option-value").val();
|
12498
|
-
if (!((val != null) && val.length > 0)) {
|
12499
|
-
return;
|
12500
|
-
}
|
12501
|
-
name = row.find("._nest-option-name").val();
|
12502
|
-
if (options[name] != null) {
|
12503
|
-
return options[name].push(val);
|
12504
|
-
} else {
|
12505
|
-
return options[name] = [val];
|
12506
|
-
}
|
12507
|
-
},
|
12508
|
-
toggleOptionName: function(container, name, active) {
|
12509
|
-
var j, len, ref, results1, sel;
|
12510
|
-
if (name === "show" || name === "hide") {
|
12511
|
-
return true;
|
12512
|
-
}
|
12513
|
-
ref = container.find("._nest-option-name");
|
12514
|
-
results1 = [];
|
12515
|
-
for (j = 0, len = ref.length; j < len; j++) {
|
12516
|
-
sel = ref[j];
|
12517
|
-
if ($(sel).val() !== name) {
|
12518
|
-
$(sel).find("option[value=" + name + "]").attr("disabled", active);
|
12519
|
-
}
|
12520
|
-
results1.push(decko.initSelect2($(sel)));
|
12521
|
-
}
|
12522
|
-
return results1;
|
12523
|
-
},
|
12524
|
-
toNestSyntax: function(opts) {
|
12525
|
-
var name, str, values;
|
12526
|
-
str = [];
|
12527
|
-
for (name in opts) {
|
12528
|
-
values = opts[name];
|
12529
|
-
str.push(name + ": " + (values.join(', ')));
|
12530
|
-
}
|
12531
|
-
return str.join("; ");
|
12532
|
-
}
|
12533
|
-
});
|
12534
|
-
|
12535
|
-
nestNameTimeout = null;
|
12536
|
-
|
12537
|
-
$(document).ready(function() {
|
12538
|
-
$('body').on('click', '._nest-field-toggle', function() {
|
12539
|
-
if ($(this).is(':checked')) {
|
12540
|
-
return nest.addPlus();
|
12541
|
-
} else {
|
12542
|
-
return nest.removePlus();
|
12543
|
-
}
|
12544
|
-
});
|
12545
|
-
$('body').on('input', 'input._nest-name', function(event) {
|
12546
|
-
nest.nameChanged();
|
12547
|
-
if (event.which !== 13) {
|
12548
|
-
if (nestNameTimeout) {
|
12549
|
-
clearTimeout(nestNameTimeout);
|
12550
|
-
}
|
12551
|
-
return nestNameTimeout = setTimeout((function() {
|
12552
|
-
return nest.updateNameRelatedTabs();
|
12553
|
-
}), 700);
|
12554
|
-
}
|
12555
|
-
});
|
12556
|
-
return $('body').on('keydown', 'input._nest-name', function(event) {
|
12557
|
-
if (event.which === 13) {
|
12558
|
-
if (nestNameTimeout) {
|
12559
|
-
clearTimeout(nestNameTimeout);
|
12560
|
-
}
|
12561
|
-
return nest.updateNameRelatedTabs();
|
12562
|
-
}
|
12563
|
-
});
|
12564
|
-
});
|
12565
|
-
|
12566
|
-
$.extend(nest, {
|
12567
|
-
name: function() {
|
12568
|
-
return nest.evalFieldOption($('input._nest-name').val());
|
12569
|
-
},
|
12570
|
-
nameChanged: function() {
|
12571
|
-
var new_val;
|
12572
|
-
new_val = $("._nest-preview").val().replace(/^\{\{[^}|]*/, "{{" + nest.name());
|
12573
|
-
return nest.updatePreview(new_val);
|
12574
|
-
},
|
12575
|
-
evalFieldOption: function(name) {
|
12576
|
-
if (nest.isField()) {
|
12577
|
-
return "+" + name;
|
12578
|
-
} else {
|
12579
|
-
return name;
|
12580
|
-
}
|
12581
|
-
},
|
12582
|
-
isField: function() {
|
12583
|
-
return $('._nest-field-toggle').is(":checked");
|
12584
|
-
},
|
12585
|
-
addPlus: function() {
|
12586
|
-
var new_val;
|
12587
|
-
new_val = $("._nest-preview").val().replace(/^\{\{\+?/, "{{+");
|
12588
|
-
nest.updatePreview(new_val);
|
12589
|
-
return $(".input-group.hide-prefix").removeClass("hide-prefix").addClass("show-prefix");
|
12590
|
-
},
|
12591
|
-
removePlus: function() {
|
12592
|
-
var new_val;
|
12593
|
-
new_val = $("._nest-preview").val().replace(/^\{\{\+?/, "{{");
|
12594
|
-
nest.updatePreview(new_val);
|
12595
|
-
return $(".input-group.show-prefix").removeClass("show-prefix").addClass("hide-prefix");
|
12596
|
-
},
|
12597
|
-
rulesTabSlot: function() {
|
12598
|
-
return $("._nest-editor .tab-pane-rules > .card-slot");
|
12599
|
-
},
|
12600
|
-
contentTabSlot: function() {
|
12601
|
-
return $("._nest-editor .tab-pane-content > .card-slot");
|
12602
|
-
},
|
12603
|
-
emptyNameAlert: function(show) {
|
12604
|
-
if (show) {
|
12605
|
-
return $("._empty-nest-name-alert").removeClass("d-none");
|
12606
|
-
} else {
|
12607
|
-
return $("._empty-nest-name-alert:not(.d-none)").addClass("d-none");
|
12608
|
-
}
|
12609
|
-
},
|
12610
|
-
updateNameRelatedTabs: function() {
|
12611
|
-
nest.updateRulesTab();
|
12612
|
-
return nest.updateContentTab();
|
12613
|
-
},
|
12614
|
-
updateContentTab: function() {
|
12615
|
-
var $contentTab, url;
|
12616
|
-
$contentTab = nest.contentTabSlot();
|
12617
|
-
if ($contentTab.length > 0) {
|
12618
|
-
url = decko.path((nest.fullName()) + "?view=nest_content");
|
12619
|
-
return nest.updateNameDependentSlot($contentTab, url);
|
12620
|
-
}
|
12621
|
-
},
|
12622
|
-
updateRulesTab: function() {
|
12623
|
-
var $rulesTab, url;
|
12624
|
-
$rulesTab = nest.rulesTabSlot();
|
12625
|
-
url = decko.path((nest.setNameForRules()) + "?view=nest_rules");
|
12626
|
-
return nest.updateNameDependentSlot($rulesTab, url);
|
12627
|
-
},
|
12628
|
-
updateNameDependentSlot: function($slot, url) {
|
12629
|
-
var name;
|
12630
|
-
name = $("input._nest-name").val();
|
12631
|
-
if ((name != null) && name.length > 0) {
|
12632
|
-
nest.emptyNameAlert(false);
|
12633
|
-
return $slot.reloadSlot(url);
|
12634
|
-
} else {
|
12635
|
-
$slot.clearSlot();
|
12636
|
-
return nest.emptyNameAlert(true);
|
12637
|
-
}
|
12638
|
-
},
|
12639
|
-
fullName: function() {
|
12640
|
-
var input, nest_name;
|
12641
|
-
input = $('input._nest-name');
|
12642
|
-
nest_name = input.val();
|
12643
|
-
if (nest.isField() && input.attr("data-left-name")) {
|
12644
|
-
return (input.attr("data-left-name")) + "+" + nest_name;
|
12645
|
-
} else {
|
12646
|
-
return nest_name;
|
12647
|
-
}
|
12648
|
-
},
|
12649
|
-
setNameForRules: function() {
|
12650
|
-
var input, nest_name;
|
12651
|
-
input = $('input._nest-name');
|
12652
|
-
nest_name = input.val();
|
12653
|
-
if (nest.isField()) {
|
12654
|
-
if (input.attr("data-left-type")) {
|
12655
|
-
return (input.attr("data-left-type")) + "+" + nest_name + "+*type plus right";
|
12656
|
-
} else {
|
12657
|
-
return nest_name + "+*right";
|
12658
|
-
}
|
12659
|
-
} else {
|
12660
|
-
return nest_name + "+*self";
|
12661
|
-
}
|
12662
|
-
}
|
12663
|
-
});
|
12664
|
-
|
12665
|
-
$(document).ready(function() {
|
12666
|
-
return $('body').on('click', 'button._link-apply', function() {
|
12667
|
-
return link.applyLink($(this).data("tinymce-id"), $(this).data("tm-snippet-start"), $(this).data("tm-snippet-size"));
|
12668
|
-
});
|
12669
|
-
});
|
12670
|
-
|
12671
|
-
window.link || (window.link = {});
|
12672
|
-
|
12673
|
-
$(document).ready(function() {
|
12674
|
-
$('body').on('click', '._link-field-toggle', function() {
|
12675
|
-
if ($(this).is(':checked')) {
|
12676
|
-
return link.addPlus();
|
12677
|
-
} else {
|
12678
|
-
return link.removePlus();
|
12679
|
-
}
|
12680
|
-
});
|
12681
|
-
$('body').on('input', 'input._link-target', function(event) {
|
12682
|
-
return link.targetChanged();
|
12683
|
-
});
|
12684
|
-
return $('body').on('input', 'input._link-title', function(event) {
|
12685
|
-
return link.titleChanged();
|
12686
|
-
});
|
12687
|
-
});
|
12688
|
-
|
12689
|
-
$.extend(link, {
|
12690
|
-
openLinkEditor: function(tm) {
|
12691
|
-
var params;
|
12692
|
-
if (typeof params === "undefined" || params === null) {
|
12693
|
-
params = nest.editParams(tm, "[[", "]]");
|
12694
|
-
}
|
12695
|
-
return nest.openEditorForTm(tm, params, "link_editor", "modal_link_editor");
|
12696
|
-
},
|
12697
|
-
applyLink: function(tinymce_id, link_start, link_size) {
|
12698
|
-
return nest.applySnippet("link", tinymce_id, link_start, link_size);
|
12699
|
-
},
|
12700
|
-
target: function() {
|
12701
|
-
return link.evalFieldOption($('input._link-target').val());
|
12702
|
-
},
|
12703
|
-
title: function() {
|
12704
|
-
return $('input._link-title').val();
|
12705
|
-
},
|
12706
|
-
titleChanged: function() {
|
12707
|
-
var new_val;
|
12708
|
-
new_val = $("._link-preview").val().replace(/^\[\[[^\]]*/, "[[" + link.target() + "|" + link.title());
|
12709
|
-
return link.updatePreview(new_val);
|
12710
|
-
},
|
12711
|
-
targetChanged: function() {
|
12712
|
-
var new_val;
|
12713
|
-
new_val = $("._link-preview").val().replace(/^\[\[[^\]|]*/, "[[" + link.target());
|
12714
|
-
return link.updatePreview(new_val);
|
12715
|
-
},
|
12716
|
-
evalFieldOption: function(name) {
|
12717
|
-
if (link.isField()) {
|
12718
|
-
return "+" + name;
|
12719
|
-
} else {
|
12720
|
-
return name;
|
12721
|
-
}
|
12722
|
-
},
|
12723
|
-
isField: function() {
|
12724
|
-
return $('._link-field-toggle').is(":checked");
|
12725
|
-
},
|
12726
|
-
addPlus: function() {
|
12727
|
-
var new_val;
|
12728
|
-
new_val = $("._link-preview").val().replace(/^\[\[\+?/, "[[+");
|
12729
|
-
link.updatePreview(new_val);
|
12730
|
-
return $(".input-group.hide-prefix").removeClass("hide-prefix").addClass("show-prefix");
|
12731
|
-
},
|
12732
|
-
removePlus: function() {
|
12733
|
-
var new_val;
|
12734
|
-
new_val = $("._link-preview").val().replace(/^\[\[\+?/, "[[");
|
12735
|
-
link.updatePreview(new_val);
|
12736
|
-
return $(".input-group.show-prefix").removeClass("show-prefix").addClass("hide-prefix");
|
12737
|
-
},
|
12738
|
-
updatePreview: function(new_val) {
|
12739
|
-
if (new_val == null) {
|
12740
|
-
new_val = "[[" + (link.target()) + "|" + (link.title()) + "]]";
|
12741
|
-
}
|
12742
|
-
return $("._link-preview").val(new_val);
|
12743
|
-
}
|
12744
|
-
});
|
12745
|
-
|
12746
|
-
decko.slotReady(function(slot) {
|
12747
|
-
$('[data-toggle="popover"]').popover({
|
12748
|
-
html: true
|
12749
|
-
});
|
12750
|
-
return $('.colorpicker-component').colorpicker();
|
12751
|
-
});
|
12752
|
-
|
12753
|
-
submitAfterTyping = null;
|
12754
|
-
|
12755
|
-
$(window).ready(function() {
|
12756
|
-
$('body').on('show.bs.tab', 'a.load[data-toggle="tab"][data-url]', function(e) {
|
12757
|
-
var tab_id, url;
|
12758
|
-
tab_id = $(e.target).attr('href');
|
12759
|
-
url = $(e.target).data('url');
|
12760
|
-
$(e.target).removeClass('load');
|
12761
|
-
return $.ajax({
|
12762
|
-
url: url,
|
12763
|
-
type: 'GET',
|
12764
|
-
success: function(html) {
|
12765
|
-
$(tab_id).append(html);
|
12766
|
-
return decko.contentLoaded($(tab_id), $(this));
|
12767
|
-
}
|
12768
|
-
});
|
12769
|
-
});
|
12770
|
-
$('body').on("input", "._submit-after-typing", function(event) {
|
12771
|
-
var form;
|
12772
|
-
form = $(event.target).closest('form');
|
12773
|
-
form.slot().find(".autosubmit-success-notification").remove();
|
12774
|
-
if (submitAfterTyping) {
|
12775
|
-
clearTimeout(submitAfterTyping);
|
12776
|
-
}
|
12777
|
-
return submitAfterTyping = setTimeout(function() {
|
12778
|
-
$(event.target).closest('form').submit();
|
12779
|
-
return submitAfterTyping = null;
|
12780
|
-
}, 1000);
|
12781
|
-
});
|
12782
|
-
$('body').on("keydown", "._submit-after-typing", function(event) {
|
12783
|
-
if (event.which === 13) {
|
12784
|
-
if (submitAfterTyping) {
|
12785
|
-
clearTimeout(submitAfterTyping);
|
12786
|
-
}
|
12787
|
-
submitAfterTyping = null;
|
12788
|
-
$(event.target).closest('form').submit();
|
12789
|
-
return false;
|
12790
|
-
}
|
12791
|
-
});
|
12792
|
-
$('body').on("change", "._submit-on-change", function(event) {
|
12793
|
-
$(event.target).closest('form').submit();
|
12794
|
-
return false;
|
12795
|
-
});
|
12796
|
-
return $('body').on("change", "._edit-item", function(event) {
|
12797
|
-
var cb;
|
12798
|
-
cb = $(event.target);
|
12799
|
-
if (cb.is(":checked")) {
|
12800
|
-
cb.attr("name", "add_item");
|
12801
|
-
} else {
|
12802
|
-
cb.attr("name", "drop_item");
|
12803
|
-
}
|
12804
|
-
$(event.target).closest('form').submit();
|
12805
|
-
return false;
|
12806
|
-
});
|
12807
|
-
});
|
12808
|
-
|
12809
|
-
$.extend(decko, {
|
12810
|
-
path: function(rawPath) {
|
12811
|
-
if (rawPath.match(/^\/|:\/\//)) {
|
12812
|
-
return rawPath;
|
12813
|
-
} else {
|
12814
|
-
return decko.rootUrl + rawPath;
|
12815
|
-
}
|
12816
|
-
},
|
12817
|
-
pingName: function(name, success) {
|
12818
|
-
return $.getJSON(decko.path(''), {
|
12819
|
-
format: 'json',
|
12820
|
-
view: 'status',
|
12821
|
-
'card[name]': name
|
12822
|
-
}, success);
|
12823
|
-
}
|
12824
|
-
});
|
12825
|
-
|
12826
|
-
jQuery.fn.extend({
|
12827
|
-
notify: function(message, status) {
|
12828
|
-
var form, notice, slot;
|
12829
|
-
slot = this.slot(status);
|
12830
|
-
notice = slot.find('.card-notice');
|
12831
|
-
if (!notice[0]) {
|
12832
|
-
notice = $('<div class="card-notice"></div>');
|
12833
|
-
form = slot.find('.card-form');
|
12834
|
-
if (form[0]) {
|
12835
|
-
$(form[0]).append(notice);
|
12836
|
-
} else {
|
12837
|
-
slot.append(notice);
|
12838
|
-
}
|
12839
|
-
}
|
12840
|
-
notice.html(message);
|
12841
|
-
return notice.show('blind');
|
12842
|
-
},
|
12843
|
-
report: function(message) {
|
12844
|
-
var report;
|
12845
|
-
report = this.slot().find('.card-report');
|
12846
|
-
if (!report[0]) {
|
12847
|
-
return false;
|
12848
|
-
}
|
12849
|
-
report.hide();
|
12850
|
-
report.html(message);
|
12851
|
-
report.show('drop', 750);
|
12852
|
-
return setTimeout((function() {
|
12853
|
-
return report.hide('drop', 750);
|
12854
|
-
}), 3000);
|
12855
|
-
}
|
12856
|
-
});
|
12857
|
-
|
12858
|
-
$(window).ready(function() {
|
12859
|
-
$.ajaxSetup({
|
12860
|
-
cache: false
|
12861
|
-
});
|
12862
|
-
$('body').on('click', '.submitter', function() {
|
12863
|
-
return $(this).closest('form').submit();
|
12864
|
-
});
|
12865
|
-
$('body').on('click', 'button.redirecter', function() {
|
12866
|
-
return window.location = $(this).attr('href');
|
12867
|
-
});
|
12868
|
-
$('body').on("change", '.live-type-field', function() {
|
12869
|
-
var $this;
|
12870
|
-
$this = $(this);
|
12871
|
-
setSlotMode($this);
|
12872
|
-
$this.data('params', $(this).closest('form').serialize());
|
12873
|
-
return $this.data('url', $(this).attr('href'));
|
12874
|
-
});
|
12875
|
-
$('body').on('change', '.edit-type-field', function() {
|
12876
|
-
return $(this).closest('form').submit();
|
12877
|
-
});
|
12878
|
-
$('body').on('mouseenter', '[hover_content]', function() {
|
12879
|
-
$(this).attr('hover_restore', $(this).html());
|
12880
|
-
return $(this).html($(this).attr('hover_content'));
|
12881
|
-
});
|
12882
|
-
$('body').on('mouseleave', '[hover_content]', function() {
|
12883
|
-
return $(this).html($(this).attr('hover_restore'));
|
12884
|
-
});
|
12885
|
-
return $('body').on('click', '.render-error-link', function(event) {
|
12886
|
-
var msg;
|
12887
|
-
msg = $(this).closest('.render-error').find('.render-error-message');
|
12888
|
-
msg.show();
|
12889
|
-
return event.preventDefault();
|
12890
|
-
});
|
12891
|
-
});
|
12892
|
-
|
12893
|
-
decko.slotReady(function(slot) {
|
12894
|
-
return slot.find('card-view-placeholder').each(function() {
|
12895
|
-
var $place;
|
12896
|
-
$place = $(this);
|
12897
|
-
if ($place.data("loading")) {
|
12898
|
-
return;
|
12899
|
-
}
|
12900
|
-
$place.data("loading", true);
|
12901
|
-
return $.get($place.data("url"), function(data, _status) {
|
12902
|
-
return $place.replaceWith(data);
|
12903
|
-
});
|
12904
|
-
});
|
12905
|
-
});
|
12906
|
-
|
12907
|
-
setSlotMode = function($el, mode) {
|
12908
|
-
var $slotter;
|
12909
|
-
if (mode == null) {
|
12910
|
-
mode = null;
|
12911
|
-
}
|
12912
|
-
$slotter = $el.closest(".slotter");
|
12913
|
-
if ($slotter.length && $slotter.attr('data-slotter-mode')) {
|
12914
|
-
$slotter.attr('data-original-slotter-mode', $slotter.attr('slotter-mode'));
|
12915
|
-
return $slotter.attr('data-slotter-mode', mode);
|
12916
|
-
}
|
12917
|
-
};
|
12918
|
-
|
12919
|
-
snakeCase = function(str) {
|
12920
|
-
return str.replace(/([a-z])([A-Z])/g, function(match) {
|
12921
|
-
return match[0] + '_' + match[1].toLowerCase();
|
12922
|
-
});
|
12923
|
-
};
|
12924
|
-
|
12925
|
-
warn = function(stuff) {
|
12926
|
-
if (typeof console !== "undefined" && console !== null) {
|
12927
|
-
return console.log(stuff);
|
12928
|
-
}
|
12929
|
-
};
|
12930
|
-
|
12931
|
-
$(window).ready(function() {
|
12932
|
-
$('body').on('click', '.btn-item', function() {
|
12933
|
-
return $(this).find('i').html('hourglass_full');
|
12934
|
-
});
|
12935
|
-
$('body').on('mouseenter', '.btn-item-delete', function() {
|
12936
|
-
$(this).find('i').html('remove');
|
12937
|
-
return $(this).addClass("btn-danger").removeClass("btn-primary");
|
12938
|
-
});
|
12939
|
-
$('body').on('mouseleave', '.btn-item-delete', function() {
|
12940
|
-
$(this).find('i').html('check');
|
12941
|
-
return $(this).addClass("btn-primary").removeClass("btn-danger");
|
12942
|
-
});
|
12943
|
-
$('body').on('click', '.follow-updater', function() {
|
12944
|
-
return $(this).closest('form').find('#card_update_all_users').val('true');
|
12945
|
-
});
|
12946
|
-
return $('body').on('submit', '.edit-view.SELF-Xfollow_default .card-form', function() {
|
12947
|
-
var confirmer;
|
12948
|
-
confirmer = $(this).find('.confirm_update_all-view');
|
12949
|
-
if (confirmer.is(':hidden')) {
|
12950
|
-
$(this).find('.follow-updater').show();
|
12951
|
-
confirmer.show('blind');
|
12952
|
-
return false;
|
12953
|
-
}
|
12954
|
-
});
|
12955
|
-
});
|
12956
|
-
|
12957
|
-
decko.isTouchDevice = function() {
|
12958
|
-
if ('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch) {
|
12959
|
-
return true;
|
12960
|
-
} else {
|
12961
|
-
return detectMobileBrowser();
|
12962
|
-
}
|
12963
|
-
};
|
12964
|
-
|
12965
|
-
detectMobileBrowser = function(userAgent) {
|
12966
|
-
userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
12967
|
-
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4));
|
12968
|
-
};
|
12969
|
-
|
12970
|
-
decko.slotReady(function(slot) {
|
12971
|
-
if (decko.isTouchDevice()) {
|
12972
|
-
return slot.find('._show-on-hover').removeClass('_show-on-hover');
|
12973
|
-
}
|
12974
|
-
});
|
12975
|
-
|
12976
|
-
$(window).ready(function() {
|
12977
|
-
$('body').on('show.bs.popover', '._card-menu-popover', function() {
|
12978
|
-
return $(this).closest(".card-menu._show-on-hover").removeClass("_show-on-hover").addClass("_show-on-hover-disabled");
|
12979
|
-
});
|
12980
|
-
return $('body').on('hide.bs.popover', '._card-menu-popover', function() {
|
12981
|
-
return $(this).closest(".card-menu._show-on-hover-disabled").removeClass("_show-on-hover-disabled").addClass("_show-on-hover");
|
12982
|
-
});
|
12983
|
-
});
|
12984
|
-
|
12985
|
-
decko.slotReady(function(slot) {
|
12986
|
-
slot.find('._disappear').delay(5000).animate({
|
12987
|
-
height: 0
|
12988
|
-
}, 1000, function() {
|
12989
|
-
return $(this).hide();
|
12990
|
-
});
|
12991
|
-
if (slot.hasClass("_refresh-timer")) {
|
12992
|
-
return setTimeout(function() {
|
12993
|
-
return slot.reloadSlot(slot.data("refresh-url"));
|
12994
|
-
}, 2000);
|
12995
|
-
}
|
12996
|
-
});
|
12997
|
-
|
12998
|
-
decko.filter = function(el) {
|
12999
|
-
var closest_widget;
|
13000
|
-
closest_widget = $(el).closest("._filter-widget");
|
13001
|
-
this.widget = closest_widget.length ? closest_widget : $(el).closest("._filtered-content").find("._filter-widget");
|
13002
|
-
this.activeContainer = this.widget.find("._filter-container");
|
13003
|
-
this.dropdown = this.widget.find("._add-filter-dropdown");
|
13004
|
-
this.dropdownItems = this.widget.find("._filter-category-select");
|
13005
|
-
this.form = this.widget.find("._filter-form");
|
13006
|
-
this.quickFilter = this.widget.find("._quick-filter");
|
13007
|
-
this.showWithStatus = function(status) {
|
13008
|
-
var f;
|
13009
|
-
f = this;
|
13010
|
-
return $.each(this.dropdownItems, function() {
|
13011
|
-
var item;
|
13012
|
-
item = $(this);
|
13013
|
-
if (item.data(status)) {
|
13014
|
-
return f.activate(item.data("category"));
|
13015
|
-
}
|
13016
|
-
});
|
13017
|
-
};
|
13018
|
-
this.reset = function() {
|
13019
|
-
this.dropdownItems.show();
|
13020
|
-
return this.restrict(this.form.find("._reset-filter").data("reset"));
|
13021
|
-
};
|
13022
|
-
this.clear = function() {
|
13023
|
-
return this.activeContainer.find(".input-group").remove();
|
13024
|
-
};
|
13025
|
-
this.activate = function(category, value) {
|
13026
|
-
this.activateField(category, value);
|
13027
|
-
return this.hideOption(category);
|
13028
|
-
};
|
13029
|
-
this.showOption = function(category) {
|
13030
|
-
this.dropdown.show();
|
13031
|
-
return this.option(category).show();
|
13032
|
-
};
|
13033
|
-
this.hideOption = function(category) {
|
13034
|
-
this.option(category).hide();
|
13035
|
-
if (this.dropdownItems.length <= this.activeFields().length) {
|
13036
|
-
return this.dropdown.hide();
|
13037
|
-
}
|
13038
|
-
};
|
13039
|
-
this.activeFields = function() {
|
13040
|
-
return this.activeContainer.find("._filter-input");
|
13041
|
-
};
|
13042
|
-
this.option = function(category) {
|
13043
|
-
return this.dropdownItems.filter("[data-category='" + category + "']");
|
13044
|
-
};
|
13045
|
-
this.findPrototype = function(category) {
|
13046
|
-
return this.widget.find("._filter-input-field-prototypes ._filter-input-" + category);
|
13047
|
-
};
|
13048
|
-
this.activateField = function(category, value) {
|
13049
|
-
var field;
|
13050
|
-
field = this.findPrototype(category).clone();
|
13051
|
-
this.fieldValue(field, value);
|
13052
|
-
this.dropdown.before(field);
|
13053
|
-
this.initField(field);
|
13054
|
-
return field.find("input, select").first().focus();
|
13055
|
-
};
|
13056
|
-
this.fieldValue = function(field, value) {
|
13057
|
-
if (typeof value === "object") {
|
13058
|
-
return this.compoundFieldValue(field, value);
|
13059
|
-
} else {
|
13060
|
-
return this.simpleFieldValue(field, value);
|
13061
|
-
}
|
13062
|
-
};
|
13063
|
-
this.simpleFieldValue = function(field, value) {
|
13064
|
-
var input;
|
13065
|
-
input = field.find("input, select");
|
13066
|
-
if (typeof value !== 'undefined') {
|
13067
|
-
return input.val(value);
|
13068
|
-
}
|
13069
|
-
};
|
13070
|
-
this.compoundFieldValue = function(field, vals) {
|
13071
|
-
var input, key, results1;
|
13072
|
-
results1 = [];
|
13073
|
-
for (key in vals) {
|
13074
|
-
input = field.find("#filter_value_" + key);
|
13075
|
-
results1.push(input.val(vals[key]));
|
13076
|
-
}
|
13077
|
-
return results1;
|
13078
|
-
};
|
13079
|
-
this.removeField = function(category) {
|
13080
|
-
this.activeField(category).remove();
|
13081
|
-
return this.showOption(category);
|
13082
|
-
};
|
13083
|
-
this.initField = function(field) {
|
13084
|
-
this.initSelectField(field);
|
13085
|
-
return decko.initAutoCardPlete(field.find("input"));
|
13086
|
-
};
|
13087
|
-
this.initSelectField = function(field) {
|
13088
|
-
return field.find("select").select2({
|
13089
|
-
containerCssClass: ":all:",
|
13090
|
-
width: "auto",
|
13091
|
-
dropdownAutoWidth: "true"
|
13092
|
-
});
|
13093
|
-
};
|
13094
|
-
this.activeField = function(category) {
|
13095
|
-
return this.activeContainer.find("._filter-input-" + category);
|
13096
|
-
};
|
13097
|
-
this.isActive = function(category) {
|
13098
|
-
return this.activeField(category).length;
|
13099
|
-
};
|
13100
|
-
this.restrict = function(data) {
|
13101
|
-
var key;
|
13102
|
-
this.clear();
|
13103
|
-
for (key in data) {
|
13104
|
-
this.activateField(key, data[key]);
|
13105
|
-
}
|
13106
|
-
return this.update();
|
13107
|
-
};
|
13108
|
-
this.addRestrictions = function(hash) {
|
13109
|
-
var category;
|
13110
|
-
for (category in hash) {
|
13111
|
-
this.removeField(category);
|
13112
|
-
this.activate(category, hash[category]);
|
13113
|
-
}
|
13114
|
-
return this.update();
|
13115
|
-
};
|
13116
|
-
this.removeRestrictions = function(hash) {
|
13117
|
-
var category;
|
13118
|
-
for (category in hash) {
|
13119
|
-
this.removeField(category);
|
13120
|
-
}
|
13121
|
-
return this.update();
|
13122
|
-
};
|
13123
|
-
this.setInputVal = function(field, value) {
|
13124
|
-
var select;
|
13125
|
-
select = field.find("select");
|
13126
|
-
if (select.length) {
|
13127
|
-
return this.setSelect2Val(select, value);
|
13128
|
-
} else {
|
13129
|
-
return this.setTextInputVal(field.find("input"), value);
|
13130
|
-
}
|
13131
|
-
};
|
13132
|
-
this.setSelect2Val = function(select, value) {
|
13133
|
-
if (select.attr("multiple") && !Array.isArray(value)) {
|
13134
|
-
value = [value];
|
13135
|
-
}
|
13136
|
-
return select.select2("val", value);
|
13137
|
-
};
|
13138
|
-
this.setTextInputVal = function(input, value) {
|
13139
|
-
input.val(value);
|
13140
|
-
return this.update();
|
13141
|
-
};
|
13142
|
-
this.updateLastVals = function() {
|
13143
|
-
return this.activeFields().find("input, select").each(function() {
|
13144
|
-
return $(this).data("lastVal", $(this).val());
|
13145
|
-
});
|
13146
|
-
};
|
13147
|
-
this.updateUrlBar = function() {
|
13148
|
-
if (this.widget.closest('._noFilterUrlUpdates')[0]) {
|
13149
|
-
return;
|
13150
|
-
}
|
13151
|
-
return window.history.pushState("filter", "filter", '?' + this.form.serialize());
|
13152
|
-
};
|
13153
|
-
this.update = function() {
|
13154
|
-
this.updateLastVals();
|
13155
|
-
this.updateQuickLinks();
|
13156
|
-
this.form.submit();
|
13157
|
-
return this.updateUrlBar();
|
13158
|
-
};
|
13159
|
-
this.updateQuickLinks = function() {
|
13160
|
-
var links, widget;
|
13161
|
-
widget = this;
|
13162
|
-
links = this.quickFilter.find("._filter-link");
|
13163
|
-
links.addClass("active");
|
13164
|
-
return links.each(function() {
|
13165
|
-
var key, link, opts, results1;
|
13166
|
-
link = $(this);
|
13167
|
-
opts = link.data("filter");
|
13168
|
-
results1 = [];
|
13169
|
-
for (key in opts) {
|
13170
|
-
results1.push(widget.deactivateQuickLink(link, key, opts[key]));
|
13171
|
-
}
|
13172
|
-
return results1;
|
13173
|
-
});
|
13174
|
-
};
|
13175
|
-
this.deactivateQuickLink = function(link, key, value) {
|
13176
|
-
var sel;
|
13177
|
-
sel = "._filter-input-" + key;
|
13178
|
-
return $.map([this.form.find(sel + " input, " + sel + " select").val()], function(arr) {
|
13179
|
-
arr = [arr].flat();
|
13180
|
-
if ($.inArray(value, arr) > -1) {
|
13181
|
-
return link.removeClass("active");
|
13182
|
-
}
|
13183
|
-
});
|
13184
|
-
};
|
13185
|
-
this.updateIfChanged = function() {
|
13186
|
-
if (this.changedSinceLastVal()) {
|
13187
|
-
return this.update();
|
13188
|
-
}
|
13189
|
-
};
|
13190
|
-
this.updateIfPresent = function(category) {
|
13191
|
-
var val;
|
13192
|
-
val = this.activeField(category).find("input, select").val();
|
13193
|
-
if (val && val.length > 0) {
|
13194
|
-
return this.update();
|
13195
|
-
}
|
13196
|
-
};
|
13197
|
-
this.changedSinceLastVal = function() {
|
13198
|
-
var changed;
|
13199
|
-
changed = false;
|
13200
|
-
this.activeFields().find("input, select").each(function() {
|
13201
|
-
if ($(this).val() !== $(this).data("lastVal")) {
|
13202
|
-
return changed = true;
|
13203
|
-
}
|
13204
|
-
});
|
13205
|
-
return changed;
|
13206
|
-
};
|
13207
|
-
return this;
|
13208
|
-
};
|
13209
|
-
|
13210
|
-
decko.slotReady(function(slot) {
|
13211
|
-
return slot.find("._filter-widget").each(function() {
|
13212
|
-
var filter;
|
13213
|
-
if (slot[0] === $(this).slot()[0]) {
|
13214
|
-
filter = new decko.filter(this);
|
13215
|
-
filter.showWithStatus("active");
|
13216
|
-
filter.updateLastVals();
|
13217
|
-
return filter.updateQuickLinks();
|
13218
|
-
}
|
13219
|
-
});
|
13220
|
-
});
|
13221
|
-
|
13222
|
-
$(window).ready(function() {
|
13223
|
-
var filterFor, filterableData, inactiveQuickfilter, keyupTimeout, onchangers, targetFilter, weirdoSelect2FilterBreaker;
|
13224
|
-
filterFor = function(el) {
|
13225
|
-
return new decko.filter(el);
|
13226
|
-
};
|
13227
|
-
weirdoSelect2FilterBreaker = function(el) {
|
13228
|
-
return $(el).hasClass("select2-search__field");
|
13229
|
-
};
|
13230
|
-
filterableData = function(filterable) {
|
13231
|
-
var f;
|
13232
|
-
f = $(filterable);
|
13233
|
-
return f.data("filter") || f.find("._filterable").data("filter");
|
13234
|
-
};
|
13235
|
-
targetFilter = function(filterable) {
|
13236
|
-
var selector;
|
13237
|
-
selector = $(filterable).closest("._filtering").data("filter-selector");
|
13238
|
-
return filterFor(selector || this);
|
13239
|
-
};
|
13240
|
-
$("body").on("click", "._filter-category-select", function(e) {
|
13241
|
-
var category, f;
|
13242
|
-
e.preventDefault();
|
13243
|
-
f = filterFor(this);
|
13244
|
-
category = $(this).data("category");
|
13245
|
-
f.activate(category);
|
13246
|
-
return f.updateIfPresent(category);
|
13247
|
-
});
|
13248
|
-
onchangers = "._filter-input input:not(.simple-text), ._filter-input select, ._filter-sort";
|
13249
|
-
$("body").on("change", onchangers, function() {
|
13250
|
-
if (weirdoSelect2FilterBreaker(this)) {
|
13251
|
-
return;
|
13252
|
-
}
|
13253
|
-
return filterFor(this).update();
|
13254
|
-
});
|
13255
|
-
keyupTimeout = null;
|
13256
|
-
$("body").on("keyup", "._filter-input input.simple-text", function() {
|
13257
|
-
var filter;
|
13258
|
-
clearTimeout(keyupTimeout);
|
13259
|
-
filter = filterFor(this);
|
13260
|
-
return keyupTimeout = setTimeout((function() {
|
13261
|
-
return filter.updateIfChanged();
|
13262
|
-
}), 333);
|
13263
|
-
});
|
13264
|
-
$("body").on("click", "._delete-filter-input", function() {
|
13265
|
-
var filter;
|
13266
|
-
filter = filterFor(this);
|
13267
|
-
filter.removeField($(this).closest("._filter-input").data("category"));
|
13268
|
-
return filter.update();
|
13269
|
-
});
|
13270
|
-
$('body').on('click', '._reset-filter', function() {
|
13271
|
-
var f;
|
13272
|
-
f = filterFor(this);
|
13273
|
-
f.reset();
|
13274
|
-
return f.update();
|
13275
|
-
});
|
13276
|
-
$('body').on('click', '._filtering ._filterable', function(e) {
|
13277
|
-
var f;
|
13278
|
-
f = targetFilter(this);
|
13279
|
-
if (f.widget.length) {
|
13280
|
-
f.restrict(filterableData(this));
|
13281
|
-
}
|
13282
|
-
e.preventDefault();
|
13283
|
-
return e.stopPropagation();
|
13284
|
-
});
|
13285
|
-
$('body').on('click', '._filter-link', function(e) {
|
13286
|
-
var f, filter_data, link;
|
13287
|
-
f = filterFor(this);
|
13288
|
-
link = $(this);
|
13289
|
-
filter_data = link.data("filter");
|
13290
|
-
if (inactiveQuickfilter(link)) {
|
13291
|
-
f.removeRestrictions(filter_data);
|
13292
|
-
} else {
|
13293
|
-
f.addRestrictions(filter_data);
|
13294
|
-
}
|
13295
|
-
e.preventDefault();
|
13296
|
-
return e.stopPropagation();
|
13297
|
-
});
|
13298
|
-
return inactiveQuickfilter = function(link) {
|
13299
|
-
return !link.hasClass("active") && link.closest(".quick-filter").length > 0;
|
13300
|
-
};
|
13301
|
-
});
|
13302
|
-
|
13303
|
-
$(window).ready(function() {
|
13304
|
-
$("body").on("click", "._filter-items ._add-selected", function() {
|
13305
|
-
var btn, content;
|
13306
|
-
btn = $(this);
|
13307
|
-
content = newFilteredListContent(btn);
|
13308
|
-
return btn.attr("href", addSelectedButtonUrl(btn, content));
|
13309
|
-
});
|
13310
|
-
$("body").on("click", "._select-all", function() {
|
13311
|
-
filterBox($(this)).find("._unselected input._checkbox-list-checkbox").each(function() {
|
13312
|
-
return selectFilteredItem($(this));
|
13313
|
-
});
|
13314
|
-
$(this).prop("checked", false);
|
13315
|
-
return updateAfterSelection($(this));
|
13316
|
-
});
|
13317
|
-
$("body").on("click", "._deselect-all", function() {
|
13318
|
-
filterBox($(this)).find("._selected input._checkbox-list-checkbox").each(function() {
|
13319
|
-
return $(this).slot().remove();
|
13320
|
-
});
|
13321
|
-
$(this).prop("checked", true);
|
13322
|
-
return updateAfterSelection($(this));
|
13323
|
-
});
|
13324
|
-
$("body").on("click", "._filter-items ._unselected input._checkbox-list-checkbox", function() {
|
13325
|
-
selectFilteredItem($(this));
|
13326
|
-
return updateAfterSelection($(this));
|
13327
|
-
});
|
13328
|
-
$("body").on("click", "._filter-items ._selected input._checkbox-list-checkbox", function() {
|
13329
|
-
var bin;
|
13330
|
-
bin = selectedBin($(this));
|
13331
|
-
$(this).slot().remove();
|
13332
|
-
return updateAfterSelection(bin);
|
13333
|
-
});
|
13334
|
-
return $('body').on('click', '._filtered-list-item-delete', function() {
|
13335
|
-
return $(this).closest('li').remove();
|
13336
|
-
});
|
13337
|
-
});
|
13338
|
-
|
13339
|
-
newFilteredListContent = function(el) {
|
13340
|
-
return $.map(prefilteredIds(el).concat(selectedIds(el)), function(id) {
|
13341
|
-
return "~" + id;
|
13342
|
-
}).join("\n");
|
13343
|
-
};
|
13344
|
-
|
13345
|
-
addSelectedButtonUrl = function(btn, content) {
|
13346
|
-
var card_args, path_base, query, view;
|
13347
|
-
view = btn.slot().data("slot")["view"];
|
13348
|
-
card_args = {
|
13349
|
-
content: content,
|
13350
|
-
type: "Pointer"
|
13351
|
-
};
|
13352
|
-
query = {
|
13353
|
-
assign: true,
|
13354
|
-
view: view,
|
13355
|
-
card: card_args
|
13356
|
-
};
|
13357
|
-
path_base = btn.attr("href") + "&" + $.param(query);
|
13358
|
-
return decko.slotPath(path_base, btn.slot());
|
13359
|
-
};
|
13360
|
-
|
13361
|
-
updateAfterSelection = function(el) {
|
13362
|
-
var f;
|
13363
|
-
trackSelectedIds(el);
|
13364
|
-
f = new decko.filter(filterBox(el).find('._filter-widget'));
|
13365
|
-
f.update();
|
13366
|
-
updateSelectedCount(el);
|
13367
|
-
return updateUnselectedCount(el);
|
13368
|
-
};
|
13369
|
-
|
13370
|
-
updateSelectedCount = function(el) {
|
13371
|
-
var count;
|
13372
|
-
count = selectedBin(el).children().length;
|
13373
|
-
filterBox(el).find("._selected-items").html(count);
|
13374
|
-
deselectAllLink(el).attr("disabled", count === 0);
|
13375
|
-
if (count > 0) {
|
13376
|
-
addSelectedButton(el).removeClass("disabled");
|
13377
|
-
} else {
|
13378
|
-
addSelectedButton(el).addClass("disabled");
|
13379
|
-
}
|
13380
|
-
return updateSelectedSectionVisibility(el, count > 0);
|
13381
|
-
};
|
13382
|
-
|
13383
|
-
updateSelectedSectionVisibility = function(el, items_present) {
|
13384
|
-
var box, help_text, selected_items;
|
13385
|
-
box = filterBox(el);
|
13386
|
-
selected_items = box.find("._selected-item-list");
|
13387
|
-
help_text = box.find("._filter-help");
|
13388
|
-
if (items_present) {
|
13389
|
-
selected_items.show();
|
13390
|
-
return help_text.hide();
|
13391
|
-
} else {
|
13392
|
-
selected_items.hide();
|
13393
|
-
return help_text.show();
|
13394
|
-
}
|
13395
|
-
};
|
13396
|
-
|
13397
|
-
updateUnselectedCount = function(el) {
|
13398
|
-
var box, count;
|
13399
|
-
box = filterBox(el);
|
13400
|
-
count = box.find("._search-checkbox-list").children().length;
|
13401
|
-
box.find("._unselected-items").html(count);
|
13402
|
-
return box.find("._select-all").attr("disabled", count > 0);
|
13403
|
-
};
|
13404
|
-
|
13405
|
-
selectFilteredItem = function(checkbox) {
|
13406
|
-
checkbox.prop("checked", true);
|
13407
|
-
return selectedBin(checkbox).append(checkbox.slot());
|
13408
|
-
};
|
13409
|
-
|
13410
|
-
selectedBin = function(el) {
|
13411
|
-
return filterBox(el).find("._selected-bin");
|
13412
|
-
};
|
13413
|
-
|
13414
|
-
filterBox = function(el) {
|
13415
|
-
return el.closest("._filter-items");
|
13416
|
-
};
|
13417
|
-
|
13418
|
-
addSelectedButton = function(el) {
|
13419
|
-
return filterBox(el).find("._add-selected");
|
13420
|
-
};
|
13421
|
-
|
13422
|
-
deselectAllLink = function(el) {
|
13423
|
-
return filterBox(el).find("._deselect-all");
|
13424
|
-
};
|
13425
|
-
|
13426
|
-
selectedIds = function(el) {
|
13427
|
-
return selectedData(el, "cardId");
|
13428
|
-
};
|
13429
|
-
|
13430
|
-
prefilteredIds = function(el) {
|
13431
|
-
return prefilteredData(el, "cardId");
|
13432
|
-
};
|
13433
|
-
|
13434
|
-
prefilteredNames = function(el) {
|
13435
|
-
return prefilteredData(el, "cardName");
|
13436
|
-
};
|
13437
|
-
|
13438
|
-
prefilteredData = function(el, field) {
|
13439
|
-
var btn, selector;
|
13440
|
-
btn = addSelectedButton(el);
|
13441
|
-
selector = btn.data("itemSelector");
|
13442
|
-
return arrayFromField(btn.slot().find(selector), field);
|
13443
|
-
};
|
13444
|
-
|
13445
|
-
selectedNames = function(el) {
|
13446
|
-
return selectedData(el, "cardName");
|
13447
|
-
};
|
13448
|
-
|
13449
|
-
selectedData = function(el, field) {
|
13450
|
-
return arrayFromField(selectedBin(el).children(), field);
|
13451
|
-
};
|
13452
|
-
|
13453
|
-
arrayFromField = function(rows, field) {
|
13454
|
-
return rows.map(function() {
|
13455
|
-
return $(this).data(field);
|
13456
|
-
}).toArray();
|
13457
|
-
};
|
13458
|
-
|
13459
|
-
trackSelectedIds = function(el) {
|
13460
|
-
var box, ids;
|
13461
|
-
ids = prefilteredIds(el).concat(selectedIds(el));
|
13462
|
-
box = filterBox(el);
|
13463
|
-
return box.find("._not-ids").val(ids.toString());
|
13464
|
-
};
|
13465
|
-
|
13466
|
-
$(window).ready(function() {
|
13467
|
-
return $("body").on("click", "._selectable-filtered-content .bar-body", function(e) {
|
13468
|
-
var container, input, item, name;
|
13469
|
-
item = $(this);
|
13470
|
-
name = item.slot().data("card-name");
|
13471
|
-
container = item.closest("._selectable-filtered-content");
|
13472
|
-
input = $(container.data("input-selector"));
|
13473
|
-
input.val(name);
|
13474
|
-
item.closest('.modal').modal('hide');
|
13475
|
-
e.preventDefault();
|
13476
|
-
return e.stopPropagation();
|
13477
|
-
});
|
13478
|
-
});
|
13479
|
-
|
13480
|
-
}).call(this);
|
13481
|
-
|
10924
|
+
(function(){var n,o,i,r,a,s,e,l,t,d,c,u,f,h,p,m,v,g,b,y,w,_,k,x,C,S,F,O,T,P,R,I,N,M,A,j,D,E,L,z,V,B,q;window.decko||(window.decko={}),$(window).ready(function(){var t;return $("body").on("click","._stop_propagation",function(t){return t.stopPropagation()}),$("body").on("click","._prevent_default",function(t){return t.preventDefault()}),$("body").on("mouseenter","a[data-hover-text]",function(){var t;return t=$(this).text(),$(this).data("original-text",t),$(this).text($(this).data("hover-text"))}),$("body").on("mouseleave","a[data-hover-text]",function(){return $(this).text($(this).data("original-text"))}),$("body").on("click",".shade-view h1",function(){var t;if(t=$(this).slot().find(".shade-content").is(":hidden"),decko.toggleShade($(this).closest(".pointer-list").find(".shade-content:visible").parent()),t)return decko.toggleShade($(this).slot())}),(t=$(".shade-view h1")[0])&&$(t).trigger("click"),$("body").on("click",".open-slow-items",function(){var t;return(t=$(this).closest(".panel-group")).find(".open-slow-items").removeClass("open-slow-items").addClass("close-slow-items"),t.find(".toggle-fast-items").text("show < 100ms"),t.find(".duration-ok").hide(),t.find(".panel-danger > .panel-collapse").collapse("show").find("a > span").addClass("show-fast-items")}),$("body").on("click",".close-slow-items",function(){var t;return(t=$(this).closest(".panel-group")).find(".close-slow-items").removeClass("close-slow-items").addClass("open-slow-items"),t.find(".toggle-fast-items").text("hide < 100ms"),t.find(".panel-danger > .panel-collapse").collapse("hide").removeClass("show-fast-items"),t.find(".duration-ok").show()}),$("body").on("click",".toggle-fast-items",function(){var t;return t=$(this).closest(".panel-group"),"hide < 100ms"===$(this).text()?(t.find(".duration-ok").hide(),$(this).text("show < 100ms")):(t.find(".duration-ok").show(),$(this).text("hide < 100ms"))}),$("body").on("click",".show-fast-items",function(t){var e;return $(this).removeClass("show-fast-items"),(e=$(this).closest(".panel-group")).find(".duration-ok").show(),e.find(".show-fast-items").removeClass("show-fast-items"),e.find(".panel-collapse").collapse("show"),t.stopPropagation()})}),$.extend(decko,{toggleShade:function(t){return t.find(".shade-content").slideToggle(1e3),t.find(".glyphicon").toggleClass("glyphicon-triangle-right glpyphicon-triangle-bottom")}}),$.extend(decko,{initializeEditors:function(n,t){return null==t&&(t=decko.editorInitFunctionMap),$.each(t,function(t,e){return $.each(n.find(t),function(){return e.call($(this))})})},editorContentFunctionMap:{},editorInitFunctionMap:{textarea:function(){return $(this).autosize()},".file-upload":function(){return decko.upload_file(this)},".etherpad-textarea":function(){return $(this).closest("form").find(".edit-submit-button").attr("class","etherpad-submit-button")}},addEditor:function(t,e,n){return decko.editorContentFunctionMap[t]=n,decko.editorInitFunctionMap[t]=e}}),jQuery.fn.extend({setContentFieldsFromMap:function(t){var n;return null==t&&(t=decko.editorContentFunctionMap),n=$(this),$.each(t,function(t,e){return n.setContentFields(t,e)})},setContentFields:function(t,e){return $.each(this.find(t),function(){return $(this).setContentField(e)})},setContentField:function(t){var e,n,i;if(n=(e=this.closest(".card-editor").find(".d0-card-content")).val(),i=t.call(this),e.val(i),n!==i)return e.change()}}),$(window).ready(function(){return setTimeout(function(){return decko.initializeEditors($("body > :not(.modal)"))},10),$("body").on("submit",".card-form",function(){return $(this).setContentFieldsFromMap(),$(this).find(".d0-card-content").attr("no-autosave","true"),!0})}),setInterval(function(){return $(".card-form").setContentFieldsFromMap()},2e4),s=null,$(window).ready(function(){return $("body").on("click","._renamer-updater",function(){return $(this).closest("form").find("#card_update_referers").val("true")}),$("body").on("submit","._rename-form",function(){var t,e;if((t=(e=$(this)).find(".alert")).is(":hidden"))return C(e),t.show("blind"),!1}),$("body").on("keyup",".name-editor input",function(t){var e;return s&&clearTimeout(s),e=$(this),13===t.which?(a(e),s=null):s=setTimeout(function(){return a(e),s=null},400)})}),C=function(t){var e,n;if(0<(n=t.find("._rename-reference-confirm")).data("referer-count"))return n.show(),(e=t.find("._renamer-updater")).show(),e.focus()},a=function(l){var d;return d=l.val(),decko.pingName(d,function(t){var e,n,i,o,r,a,s;return l.val()!==d?null:(s=t.status)?(e=l.parent(),(o=(i=l.closest("fieldset").find("legend")).find(".name-messages"))[0]||(o=$('<span class="name-messages"></span>'),i.append(null!=o)),e.removeClass("real-name virtual-name known-name"),a=l.slot().data("cardId"),"unknown"===s||a&&parseInt(a)===t.id?o.html(""):(e.addClass(s+"-name known-name"),r="virtual"===s?"in virtual":"already in",n=decko.path(t.url_key),o.html("\"<a href='"+n+"'>"+d+'</a>" '+r+" use"))):void 0})},jQuery.fn.extend({autosave:function(){var t,e,n,i,o;if(i=this.slot(),!this.attr("no-autosave")){if((n=this.closest(".form-group"))[0]){if(!(e=n.data("cardId")))return;": "+n.data("cardName")}else e=i.data("cardId"),"";if(e)return o=decko.path("update/~"+e),t=$("#edit_card_"+e).serializeArray().reduce(function(t,e){return t[e.name]=e.value,t},{draft:"true","success[view]":"blank"}),$.ajax(o,{data:t,type:"POST"})}}}),$(window).ready(function(){return $("body").on("change",".autosave .d0-card-content",function(){var t;return t=$(this),setTimeout(function(){return t.autosave()},500)})}),c={off:!1,on:!0,signed_in:decko.currentUserId},d=function(){return c[decko.doubleClick]},u=function(e){return![".nodblclick",".d0-card-header",".card-editor"].some(function(t){return e.closest(t)[0]})&&null==e.slot().find(".card-editor")[0]},D=function(t){var e,n,i,o;return i=t.slot(),(e=decko.slotEditLink(i))?e.click():(n=decko.slotEditView(i),o=decko.path("~"+i.data("cardId")+"?view="+n),i.reloadSlot(o))},$(window).ready(function(){if(d())return $("body").on("dblclick","div",function(){return u($(this))&&D($(this)),!1})}),B=function(){var t;if(t=$("body > footer").first(),$("body > article, body > aside").wrapAll("<div class='"+e()+"'/>"),$("body > div > article, body > div > aside").wrapAll('<div class="row row-offcanvas">'),t)return $("body").append(t)},q=function(t,e){return"<div class='container'><div class='row "+e+"'>"+t+"</div></div>"},e=function(){return $("body").hasClass("fluid")?"container-fluid":"container"},A=function(t){return"<button class='offcanvas-toggle btn btn-secondary d-sm-none' data-toggle='offcanvas-"+t+"'><i class='material-icons'>chevron_"+("left"===t?"right":"left")+"</i></button>"},R=function(t){return"both"===t?q(A("left")+A("right"),"flex-row justify-content-between"):"left"===t?q(A("left"),"flex-row"):q(A("right"),"flex-row-reverse")},I=function(t){var e,n;return e=$("body > article").first(),n=$("body > aside").first(),e.addClass("col-xs-12 col-sm-9"),n.addClass("col-xs-6 col-sm-3 sidebar-offcanvas sidebar-offcanvas-"+t),"left"===t?$("body").append(n).append(e):$("body").append(e).append(n),B(),e.prepend(R(t))},f=function(){var t,e,n,i,o;return t=$("body > article").first(),e=$("body > aside").first(),n=$($("body > aside")[1]),t.addClass("col-xs-12 col-sm-6"),i="col-xs-6 col-sm-3 sidebar-offcanvas",e.addClass(i+" sidebar-offcanvas-left"),n.addClass(i+" sidebar-offcanvas-right"),$("body").append(e).append(t).append(n),B(),o=R("both"),t.prepend(o)},$.fn.extend({toggleText:function(t,e){return this.text(this.text()===e?t:e),this}}),$(window).ready(function(){switch(!1){case!$("body").hasClass("right-sidebar"):I("right");break;case!$("body").hasClass("left-sidebar"):I("left");break;case!$("body").hasClass("two-sidebar"):f()}return $('[data-toggle="offcanvas-left"]').click(function(){return $(".row-offcanvas").removeClass("right-active").toggleClass("left-active"),$(this).find("i.material-icons").toggleText("chevron_left","chevron_right")}),$('[data-toggle="offcanvas-right"]').click(function(){return $(".row-offcanvas").removeClass("left-active").toggleClass("right-active"),$(this).find("i.material-icons").toggleText("chevron_left","chevron_right")})}),$(window).ready(function(){var t;return(t=$("._navbox")).select2({placeholder:t.attr("placeholder"),escapeMarkup:function(t){return t},minimumInputLength:1,maximumSelectionSize:1,ajax:{delay:200,url:decko.path(":search.json"),data:function(t){return{query:{keyword:t.term},view:"complete"}},processResults:function(t){return{results:b(t)}},cache:!0},templateResult:p,templateSelection:m,multiple:!0,containerCssClass:"select2-navbox-autocomplete",dropdownCssClass:"select2-navbox-dropdown",width:"100%!important"}),t.on("select2:select",function(t){return g(t)})}),p=function(t){return t.loading?t.text:'<i class="material-icons">'+t.icon+'</i><span class="navbox-item-label">'+t.prefix+':</span> <span class="navbox-item-value">'+t.label+"</span>"},m=function(t){return t.icon?'<i class="material-icons">'+t.icon+'</i><span class="navbox-item-value">'+t.label+"</span>":t.text},b=function(i){var o,t;return o=[],t=i.term,i.search&&o.push(v({prefix:"search",id:t,text:t})),$.each(["add","new"],function(t,e){var n;if(n=i[e])return o.push(v({prefix:e,icon:"add",text:n[0],href:n[1]}))}),$.each(i["goto"],function(t,e){var n;return n=v({prefix:"go to",id:t,icon:"arrow_forward",text:e[0],href:e[1],label:e[2]}),o.push(n)}),o},v=function(t){return t.id||(t.id=t.prefix),t.icon||(t.icon=t.prefix),t.label||(t.label='<strong class="highlight">'+t.text+"</strong>"),t},g=function(t){var e;return(e=t.params.data).href?window.location=decko.path(e.href):$(t.target).closest("form").submit(),$(t.target).attr("disabled","disabled")},$.extend(decko,{upload_file:function(t){var e;return $(t).on("fileuploadsubmit",function(t,e){var n,i,o;return i=(n=$(this)).siblings(".attachment_card_name:first").attr("name"),o=n.siblings("#attachment_type_id").val(),e.formData={"card[type_id]":o,attachment_upload:i}}),e=-1<$(t).closest("form").attr("action").indexOf("update")?"card/update/"+$(t).siblings("#file_card_name").val():"card/create",$(t).fileupload({url:decko.path(e),dataType:"html",done:decko.doneFile,add:decko.chooseFile,progressall:decko.progressallFile})},chooseFile:function(t,e){var n;return e.form.find("button[type=submit]").attr("disabled",!0),n=$(this).closest(".card-editor"),$("#progress").show(),n.append('<input type="hidden" class="extra_upload_param" value="true" name="attachment_upload">'),n.append('<input type="hidden" class="extra_upload_param" value="preview_editor" name="view">'),e.submit(),n.find(".choose-file").hide(),n.find(".extra_upload_param").remove()},progressallFile:function(t,e){var n;return n=parseInt(e.loaded/e.total*100,10),$("#progress .progress-bar").css("width",n+"%")},doneFile:function(t,e){return $(this).closest(".card-editor").find(".chosen-file").replaceWith(e.result),e.form.find("button[type=submit]").attr("disabled",!1)}}),$(window).ready(function(){return $("body").on("click",".cancel-upload",function(){var t;return(t=$(this).closest(".card-editor")).find(".choose-file").show(),t.find(".chosen-file").empty(),t.find(".progress").show(),t.find("#progress .progress-bar").css("width","0%"),t.find("#progress").hide()})}),$.extend(decko,{slotPath:function(t,e){var n;return n=decko.slotData(e),decko.path(t)+(t.match(/\?/)?"&":"?")+$.param(n)},slotData:function(t){var e,n,i;return i={},null!=(e=$("#main").children(".card-slot").data("cardName"))&&(i.main=e),t&&(t.isMain()&&(i.is_main=!0),null!=(n=t.data("slot"))&&(decko.slotParams(n,i,"slot"),n.type&&(i.type=n.type))),i},slotEditView:function(t){switch(decko.slotData(t)["slot[edit]"]){case"inline":return"edit_inline";case"full":return"bridge";default:return"edit"}},slotEditLink:function(n){var t;return!!(t=n.find(".edit-link").filter(function(t,e){return $(e).slot().data("slotId")===n.data("slotId")}))[0]&&$(t[0])},slotParams:function(t,i,o){return $.each(t,function(t,e){var n;return n=o+"["+N(t)+"]","items"===t?decko.slotParams(e,i,n):i[n]=e})},contentLoaded:function(t,e){var n;return decko.initializeEditors(t),null!=(n=e.attr("notify-success"))&&t.notify(n,"success"),t.triggerSlotReady(e)},slotReady:function(n){return $("document").ready(function(){return $("body").on("slotReady",".card-slot",function(t,e){return t.stopPropagation(),null!=e?n.call(this,$(this),$(e)):n.call(this,$(this))})})},slotDestroy:function(e){return $("document").ready(function(){return $("body").on("slotDestroy",".card-slot, ._modal-slot",function(t){return t.stopPropagation(),e.call(this,$(this))})})}}),jQuery.fn.extend({slot:function(t,e){return null==t&&(t="success"),null==e&&(e="replace"),"modal"===e?this.modalSlot():this.selectSlot("slot-"+t+"-selector")||this.selectSlot("slot-selector")||this.closest(".card-slot")},selectSlot:function(t){var e,n;if(e=this.data(t))return(n=this.findSlot(e))&&n[0]&&n},isSlot:function(){return $(this).hasClass("card-slot")},isMain:function(){return this.slot().parent("#main")[0]},isMainOrMainModal:function(){var t;return(t=$(this)).closest(".modal")[0]&&(t=t.findOriginSlot("modal")),t.isMain()},findSlot:function(t){var e,n;if("modal-origin"===t)return this.findOriginSlot("modal");if("overlay-origin"===t)return this.findOriginSlot("overlay");for(n=this.closest(t),e=this.closest(".card-slot");0===n.length&&0<e.length;)n=$(e).find(t),e=$(e).parent().closest(".card-slot");return 0===n.length?$(t):n},findOriginSlot:function(t){var e,n;return n=this.closest("[data-"+t+"-origin-slot-id]").data(t+"-origin-slot-id"),null!=(e=$("[data-slot-id="+n+"]"))[0]?e:console.log("couldn't find origin with slot id "+n)},reloadSlot:function(t){var e;if(1<(e=$(this)).length)e.each(function(){return $(this).reloadSlot(t)});else if(e.isSlot||(e=e.slot()),e[0])return null==t&&(t=e.slotUrl()),e.addClass("slotter"),e.attr("href",t),e.data("url",t),this[0].href=t,e.data("remote",!0),$.rails.handleRemote(e)},clearSlot:function(){return this.triggerSlotDestroy(),this.empty()},slotUrl:function(){return decko.slotPath(this.slotMark()+"?view="+this.data("slot").view)},slotMark:function(){return this.data("cardId")?"~"+this.data("cardId"):this.data("cardName")},setSlotContent:function(t,e,n){var i;return"string"==typeof(i=$(t)[0]&&$(t)||t)?this.slot("success",e).replaceWith(i):(i.hasClass("_overlay")?e="overlay":i.hasClass("_modal")&&(e="modal"),this.slot("success",e).setSlotContentFromElement(i,e,n)),i},setSlotContentFromElement:function(t,e,n){var i;return"overlay"===e?this.addOverlay(t,n):t.hasClass("_modal-slot")||"modal"===e?t.showAsModal(n):((i=this.data("slot-id"))&&t.attr("data-slot-id",i),this.triggerSlotDestroy(),this.replaceWith(t),decko.contentLoaded(t,n))},triggerSlotReady:function(t){return this.isSlot()&&this.trigger("slotReady",t),this.find(".card-slot").trigger("slotReady",t)},triggerSlotDestroy:function(){return this.trigger("slotDestroy")}}),$(window).ready(function(){return $("body").on("hidden.bs.modal",function(){return decko.removeModal()}),$("body").on("show.bs.modal","._modal-slot",function(t){var e;return e=$(t.relatedTarget),n($(this),e),$(this).modal("handleUpdate"),decko.contentLoaded($(t.target),e)}),$("._modal-slot").each(function(){return _($(this)),n($(this))}),$("body").on("click",".submit-modal",function(){return $(this).closest(".modal-content").find("form").submit()})}),_=function(t){var e;if(0<(e=t.find(".modal-content")).length&&0<e.html().length)return $("#main > .card-slot").registerAsOrigin("modal",t),t.modal("show")},n=function(t,e){var n,i;if(i=t.find(".modal-dialog"),null!=(n=null!=e?e.data("modal-class"):t.data("modal-class"))&&null!=i)return i.addClass(n)},jQuery.fn.extend({showAsModal:function(t){var e;return null!=t&&(e=this.modalify(t)),$("body > ._modal-slot").is(":visible")?this.addModal(e,t):($("body > ._modal-slot")[0]?($("._modal-slot").trigger("slotDestroy"),$("body > ._modal-slot").replaceWith(e)):$("body").append(e),t.registerAsOrigin("modal",e),e.modal("show",t))},addModal:function(t,e){var n;return"modal-replace"===e.data("slotter-mode")?(n=t.find(".modal-dialog"),t.adoptModalOrigin(),$("._modal-slot").trigger("slotDestroy"),$("body > ._modal-slot > .modal-dialog").replaceWith(n),decko.contentLoaded(n,e)):(decko.pushModal(t),e.registerAsOrigin("modal",t),t.modal("show",e))},adoptModalOrigin:function(){var t;return t=$("body > ._modal-slot .card-slot[data-modal-origin-slot-id]").data("modal-origin-slot-id"),this.find(".modal-body .card-slot").attr("data-modal-origin-slot-id",t)},modalOriginSlot:function(){},modalSlot:function(){var t;return 0<(t=$("#modal-container")).length?t:decko.createModalSlot()},modalify:function(t){var e;return null!=t.data("modal-body")&&this.find(".modal-body").append(t.data("modal-body")),this.hasClass("_modal-slot")?this:((e=$("<div/>",{id:"modal-container","class":"modal fade _modal-slot"})).append($("<div/>",{"class":"modal-dialog"}).append($("<div/>",{"class":"modal-content"}).append(this))),e)}}),$.extend(decko,{createModalSlot:function(){var t;return t=$("<div/>",{id:"modal-container","class":"modal fade _modal-slot"}),$("body").append(t),t},removeModal:function(){return $("._modal-stack")[0]?decko.popModal():($("._modal-slot").trigger("slotDestroy"),$(".modal-dialog").empty())},pushModal:function(t){var e;return(e=$("body > ._modal-slot")).removeAttr("id"),e.removeClass("_modal-slot").addClass("_modal-stack").removeClass("modal").addClass("background-modal"),t.insertBefore(e),$(".modal-backdrop").removeClass("show")},popModal:function(){return $(".modal-backdrop").addClass("show"),$("body > ._modal-slot").trigger("slotDestroy"),$("body > ._modal-slot").remove(),$($("._modal-stack")[0]).addClass("_modal-slot").removeClass("_modal-stack").attr("id","modal-container").addClass("modal").removeClass("background-modal"),$(document.body).addClass("modal-open")}}),jQuery.fn.extend({overlaySlot:function(){var t;return null!=(t=this.closest(".card-slot._overlay"))[0]?t:null!=(t=this.closest(".overlay-container").find("._overlay"))[0]&&$(t[0])},addOverlay:function(t,e){return this.parent().hasClass("overlay-container")?$(t).hasClass("_stack-overlay")?this.before(t):($("._overlay-origin").removeClass("_overlay-origin"),this.replaceOverlay(t)):(this.parent().hasClass("_overlay-container-placeholder")?this.parent().addClass("overlay-container"):this.wrapAll('<div class="overlay-container">'),this.addClass("_bottomlay-slot"),this.before(t)),e.registerAsOrigin("overlay",t),decko.contentLoaded(t,e)},replaceOverlay:function(t){return this.overlaySlot().trigger("slotDestroy"),this.overlaySlot().replaceWith(t),$(".bridge-sidebar .tab-pane:not(.active) .bridge-pills > .nav-item > .nav-link.active").removeClass("active")},isInOverlay:function(){return this.closest(".card-slot._overlay").length},removeOverlay:function(){var t;if(t=this.overlaySlot())return t.removeOverlaySlot()},removeOverlaySlot:function(){var t;return this.trigger("slotDestroy"),1===this.siblings().length&&(t=$(this.siblings()[0])).hasClass("_bottomlay-slot")&&(t.parent().hasClass("_overlay-container-placeholder")?t.parent().removeClass("overlay-container"):t.unwrap(),t.removeClass("_bottomlay-slot").updateBridge(!0,t)),this.remove()}}),jQuery.fn.extend({updateRecaptchaToken:function(e){var n,i;return null==(i=this.find("input._recaptcha-token"))[0]?i.val("recaptcha-token-field-missing"):"undefined"==typeof grecaptcha||null===grecaptcha?i.val("grecaptcha-undefined"):(n=$(this),e&&e.stopPropagation(),grecaptcha.execute(i.data("site-key"),{action:i.data("action")}).then(function(t){if(i.val(t),i.addClass("_token-updated"),e)return n.submit()}),!1)}}),$(window).ready(function(){return $("body").on("ajax:success",".slotter",function(t,e){return $(this).slotterSuccess(t,e)}),$("body").on("ajax:error",".slotter",function(t,e){return $(this).showErrorResponse(e.status,e.responseText)}),$("body").on("click","button.slotter",function(){return!!$.rails.allowAction($(this))&&$.rails.handleRemote($(this))}),$("body").on("click","._clickable.slotter",function(){return $(this)[0].href=$(this).attr("href"),$.rails.handleRemote($(this))}),$("body").on("click",'[data-dismiss="overlay"]',function(){return $(this).findSlot(".card-slot._overlay").removeOverlay()}),$("body").on("click","._close-overlay-on-success",function(){return $(this).closeOnSuccess("overlay")}),$("body").on("click","._close-modal-on-success",function(){return $(this).closeOnSuccess("modal")}),$("body").on("click","._close-on-success",function(){return $(this).closeOnSuccess()}),$("body").on("click","._update-origin",function(){return $(this).closest(".slotter").data("slotter-mode","update-origin")}),$("body").on("submit","form.slotter",function(t){var e;if((e=$(this)).data("main-success")&&e.isMainOrMainModal()&&e.mainSuccess(),"on"===e.data("recaptcha"))return e.handleRecaptchaBeforeSubmit(t)}),$("body").on("ajax:beforeSend",".slotter",function(t,e,n){return $(this).slotterBeforeSend(n)})}),jQuery.fn.extend({mainSuccess:function(){var o;return o=$(this),$.each(o.data("main-success"),function(t,e){var n,i;return i="[name=success\\["+t+"\\]]",(n=o.find(i))[0]||(n=$('<input type="hidden" name="success['+t+']"/>'),o.append(n)),n.val(e)})},slotterSuccess:function(t,e){var n,i,o,r;if(this.hasClass("slotter")){if(!t.slotSuccessful)return this.data("reload")&&window.location.reload(!0),this.data("update-modal-origin")&&this.updateModalOrigin(),this.data("update-origin")&&this.updateOrigin(),this.data("original-slotter-mode")&&this.attr("data-slotter-mode",this.data("original-slotter-mode")),i=this.data("slotter-mode"),this.showSuccessResponse(e,i),this.hasClass("_close-overlay")&&this.removeOverlay(),this.hasClass("_close-modal")&&this.closest(".modal").modal("hide"),this.hasClass("card-paging-link")&&(r=this.slot().offset().top,$("body").scrollTop(r)),this.data("update-foreign-slot")&&(n=this.findSlot(this.data("update-foreign-slot")),o=this.data("update-foreign-slot-url"),n.reloadSlot(o)),t.slotSuccessful=!0}else console.log("warning: slotterSuccess called on non-slotter element "+this)},showSuccessResponse:function(t,e){if("silent-success"!==e)return"update-modal-origin"===e?this.updateModalOrigin():"update-origin"===e?this.updateOrigin():t.redirect?window.location=t.redirect:t.reload?window.location.reload(!0):this.updateSlot(t,e)},showErrorResponse:function(t,e){return 403===t?$(e).showAsModal($(this)):900===t?$(e).showAsModal($(this)):(this.notify(e,"error"),409===t?this.slot().find(".current_revision_id").val(this.slot().find(".new-current-revision-id").text()):void 0)},updateModalOrigin:function(){return this.overlaySlot()?this.findOriginSlot("overlay").updateOrigin():this.closest("#modal-container")[0]?this.updateOrigin():void 0},updateOrigin:function(){var t,e;if(null!=(e=this.overlaySlot()?"overlay":this.closest("#modal-container")[0]?"modal":void 0))return(t=this.findOriginSlot(e))&&null!=t[0]?t.reloadSlot():void 0},registerAsOrigin:function(t,e){return e.hasClass("_modal-slot")&&(e=e.find(".modal-body .card-slot")),e.attr("data-"+t+"-origin-slot-id",this.closest(".card-slot").data("slot-id"))},updateSlot:function(t,e){return e||(e="replace"),this.setSlotContent(t,e,$(this))},closeOnSuccess:function(t){var e;return e=this.closest(".slotter"),null==t&&(t=this.isInOverlay()?"overlay":"modal"),e.addClass("_close-"+t)},slotterBeforeSend:function(t){var e;if(!t.skip_before_send)return t.url.match(/home_view/)||"modal"===this.data("slotter-mode")||(t.url=decko.slotPath(t.url,this.slot())),this.is("form")&&(e=this.data("file-data"))?(this.uploadWithBlueimp(e,t),!1):void 0},uploadWithBlueimp:function(t,e){var n,i,o,r;return(o=this.find(".file-upload"))[1]?(this.notify("Decko does not yet support multiple files in a single form.","error"),!1):((r=o.data("blueimpFileupload"))._isXHRUpload(r.options)||(this.find("[name=success]").val("_self"),e.url+="&simulate_xhr=true",i=function(t){return t.find("body").html()},e.dataFilter=i),(n=$.extend(e,r._getAJAXSettings(t),{url:e.url})).skip_before_send=!0,$.ajax(n))},handleRecaptchaBeforeSubmit:function(t){var e;return null==(e=this.find("input._recaptcha-token"))[0]?e.val("recaptcha-token-field-missing"):e.hasClass("_token-updated")?e.removeClass("_token-updated"):"undefined"==typeof grecaptcha||null===grecaptcha?e.val("grecaptcha-undefined"):this.updateRecaptchaToken(t)}}),decko.slotReady(function(t,e){var n;if(t.updateBridge(!1,e),1===(n=t.find("ul._auto-single-select > li.nav-item > a.nav-link")).length)return $(n[0]).click()}),jQuery.fn.extend({updateBridge:function(t,e){if(null==t&&(t=!1),0<this.closest(".bridge").length)return this.data("breadcrumb")?this.updateBreadcrumb():e&&$(e).data("breadcrumb")&&$(e).updateBreadcrumb(),t?$(".bridge-pills > .nav-item > .nav-link.active").removeClass("active"):void 0},updateBreadcrumb:function(){var t;return(t=$(".modal-header ._bridge-breadcrumb li:last-child")).text(this.data("breadcrumb")),t.attr("class","breadcrumb-item active "+this.data("breadcrumb-class"))}}),$(window).ready(function(){return $("body").on("select2:select","._close-rule-overlay-on-select",function(){return $(".overlay-container > ._overlay.card-slot.overlay_rule-view.RULE").removeOverlay()}),$("body").on("click","._update-history-pills",function(){return $(this).closest(".slotter").data("update-foreign-slot",".card-slot.history_tab-view")})}),$(document).ready(function(){return $("body").on("click","button._nest-apply",function(){return null!=$(this).data("index")?nest.applyNestToNestListEditor($(this).data("index")):nest.applyNestToTinymceEditor($(this).data("tinymce-id"),$(this).data("tm-snippet-start"),$(this).data("tm-snippet-size"))}),$("body").on("click","button._change-create-to-update",function(){var t;return t=$(this).closest("form").find("#success_tinymce_id").val(),nest.changeCreateToUpdate(t)}),$("body").on("click","button._open-nest-editor",function(){var t,e,n,i;return i=(e=$(this).closest("._nest-form")).find("._reference").val(),n=e.find("._nest-options").val(),t=encodeURIComponent("{{"+i+"|"+n+"}}"),nest.openNestEditorForSlot($(this).closest(".card-slot"),$(this).closest(".slotter"),"index="+e.data("index")+"&tm_snippet_raw="+t)})}),window.nest||(window.nest={}),$.extend(nest,{openNestEditor:function(t,e){return null==e&&(e=nest.editParams(t)),this.openEditorForTm(t,e,"nest_editor","modal_nest_editor")},openNestEditorForSlot:function(t,e,n){var i;return i=t[0]?$(t[0]).attr("data-card-name"):":update",nest.request(i,"nest_editor","modal_nest_editor",e,n)},openEditorForTm:function(t,e,n,i){var o,r,a;return e+="&tinymce_id="+t.id,r=$("#"+t.id).closest(".card-slot"),a=$("#"+t.id),o=r[0]?$(r[0]).attr("data-card-name"):":update",nest.request(o,n,i,a,e)},openImageEditor:function(t){var e;return null==e&&(e=nest.editParams(t,"{{","}}",!1)),this.openEditorForTm(t,e,"nest_image","modal_nest_image")},changeCreateToUpdate:function(t){var e,n;return n=(e=$("#"+t).closest("form")).attr("action").replace("card/create","card/update"),e.attr("action",n)},insertNest:function(t,e){return t.insertContent(e)},request:function(t,e,n,i,o){var r,a,s;return(a=$(".bridge-sidebar > ._overlay-container-placeholder > .card-slot"))[0]?(s=e,r="overlay"):(a=$($(".card-slot")[0]),s=n,r="modal"),nest.sendRequest(i,a,r,t,s,o)},sendRequest:function(e,n,i,t,o,r){var a;return null==r&&(r=""),a="/"+t+"?view="+o+"&"+r,$.ajax({url:a,type:"GET",success:function(t){return n.setSlotContent(t,i,e)}})},editParams:function(t,e,n,i){var o,r,a,s,l,d,c,u,f;return null==e&&(e="{{"),null==n&&(n="}}"),null==i&&(i=!0),null==(u=t.selection.getSel())||null==u.anchorNode?nest.paramsStr(0):(f=u.anchorNode.data)?(c=u.anchorOffset,r=f.substr(0,c),o=f.substr(c),(a={before:{close:r.lastIndexOf(n),open:r.lastIndexOf(e)},after:{close:o.indexOf(n),open:o.indexOf(e)}}).before.open>a.before.close&&-1!==a.after.close&&(-1===a.after.open||a.after.close<a.after.open)?(d=a.before.open,null==s&&(l=a.after.close+c+2-d,s=f.substr(d,l)),i?nest.paramsStr(d,s):nest.paramsStr(d+l)):nest.paramsStr(c)):nest.paramsStr(u.anchorOffset)},paramsStr:function(t,e){var n;return n="",null!=t&&(n+="&tm_snippet_start="+t),null!=e&&0<e.length&&(n+="&tm_snippet_raw="+encodeURIComponent(e)),n},offsetAfterInsert:function(t,e){return t.selection.getSel().anchorOffset-e.lengthr},applyNestToTinymceEditor:function(t,e,n){return nest.applySnippet("nest",t,e,n)},applyNestToNestListEditor:function(t){var e;return(e=$("._nest-form[data-index='"+t+"']")).find("._reference").val(nest.name()),e.find("._nest-options").val(nest.options()),decko.updateAddItemButton(e)},applySnippet:function(t,e,n,i){var o,r,a;return o=$("._"+t+"-preview").val(),r=tinymce.get(e),null!=n?nest.replaceSnippet(r,n,i,o):(r.insertContent(o),a=nest.offsetAfterInsert(r,o),$("button._"+t+"-apply").attr("data-tm-snippet-start",a)),$("button._"+t+"-apply").attr("data-tm-snippet-size",o.length)},replaceSnippet:function(t,e,n,i){var o,r;return null!=(o=t.selection.getSel())&&null!=o.anchorNode&&null!=o.anchorNode.data?(null==n&&(n=0),r=""+(r=o.anchorNode.data).substr(0,e)+i+r.substr(e+n),o.anchorNode.data=r):t.insertContent(i)},updatePreview:function(t){var e;return null==t&&(t="{{"+nest.name()+"|"+nest.options()+"}}"),(e=$("._nest-preview")).val(t),e.data("nest-options",nest.options()),e.data("reference",nest.name())}}),$(document).ready(function(){return $("body").on("keyup","input._nest-option-value",function(){return nest.updatePreview()}),$("body").on("select2:select","._nest-option-name",function(){return nest.toggleOptionName($(this).closest("._options-select"),$(this).val(),!0),nest.updatePreview()}),$("body").on("select2:selecting","._nest-option-name",function(){return nest.toggleOptionName($(this).closest("._options-select"),$(this).val(),!1)}),$("body").on("select2:select","._nest-option-name._new-row",function(){var t,e;return $(this).closest(".input-group").find(".input-group-prepend").removeClass("d-none"),(t=$(this).closest("._nest-option-row")).find("._nest-option-value").removeAttr("disabled"),e=t.parent().find("._nest-option-row._template"),$(this).removeClass("_new-row"),nest.addRow(e)}),$("body").on("click","._configure-items-button",function(){return nest.addItemsOptions($(this))}),$("body").on("click","button._nest-delete-option",function(){return nest.removeRow($(this).closest("._nest-option-row"))})}),$.extend(nest,{showTemplate:function(t){return t.removeClass("_template")},addRow:function(t){var e,n;return(n=t.find("select")).select2("destroy"),n.removeAttr("data-select2-id"),e=t.clone(),decko.initSelect2(n),nest.showTemplate(t),t.after(e),decko.initSelect2(e.find("select"))},removeRow:function(t){var e;return e=t.find("._nest-option-name").val(),nest.toggleOptionName(t.closest("._options-select"),e,!1),t.remove(),nest.updatePreview()},addItemsOptions:function(t){var e,n,i;return n=(e=t.closest("._configure-items")).cloneSelect2(!0),i=t.text(),t.replaceWith($("<h6>"+i.substr(9)+"<h6>")),nest.showTemplate(e.find("._options-select._template")),n.find("._configure-items-button").text(i.replace("items","subitems")),e.after(n),nest.updatePreview()},options:function(){var t,e,n,i,o;for(i=[],e=0,n=(o=$("._options-select:not(._template")).length;e<n;e++)t=o[e],i.push(nest.extractOptions($(t)));return i.map(function(t){return nest.toNestSyntax(t)}).join("|")},extractOptions:function(t){var e,n,i,o,r;for(i={},e=0,n=(o=t.find("._nest-option-row:not(.template)")).length;e<n;e++)r=o[e],nest.addOption(i,$(r));return i},addOption:function(t,e){var n,i;if(null!=(i=e.find("._nest-option-value").val())&&0<i.length)return null!=t[n=e.find("._nest-option-name").val()]?t[n].push(i):t[n]=[i]},toggleOptionName:function(t,e,n){var i,o,r,a,s;if("show"===e||"hide"===e)return!0;for(a=[],i=0,o=(r=t.find("._nest-option-name")).length;i<o;i++)s=r[i],$(s).val()!==e&&$(s).find("option[value="+e+"]").attr("disabled",n),a.push(decko.initSelect2($(s)));return a},toNestSyntax:function(t){var e,n,i;for(e in n=[],t)i=t[e],n.push(e+": "+i.join(", "));return n.join("; ")}}),y=null,$(document).ready(function(){return $("body").on("click","._nest-field-toggle",function(){return $(this).is(":checked")?nest.addPlus():nest.removePlus()}),$("body").on("input","input._nest-name",function(t){if(nest.nameChanged(),13!==t.which)return y&&clearTimeout(y),y=setTimeout(function(){return nest.updateNameRelatedTabs()},700)}),$("body").on("keydown","input._nest-name",function(t){if(13===t.which)return y&&clearTimeout(y),nest.updateNameRelatedTabs()})}),$.extend(nest,{name:function(){return nest.evalFieldOption($("input._nest-name").val())},nameChanged:function(){var t;return t=$("._nest-preview").val().replace(/^\{\{[^}|]*/,"{{"+nest.name()),nest.updatePreview(t)},evalFieldOption:function(t){return nest.isField()?"+"+t:t},isField:function(){return $("._nest-field-toggle").is(":checked")},addPlus:function(){var t;return t=$(
|
10925
|
+
"._nest-preview").val().replace(/^\{\{\+?/,"{{+"),nest.updatePreview(t),$(".input-group.hide-prefix").removeClass("hide-prefix").addClass("show-prefix")},removePlus:function(){var t;return t=$("._nest-preview").val().replace(/^\{\{\+?/,"{{"),nest.updatePreview(t),$(".input-group.show-prefix").removeClass("show-prefix").addClass("hide-prefix")},rulesTabSlot:function(){return $("._nest-editor .tab-pane-rules > .card-slot")},contentTabSlot:function(){return $("._nest-editor .tab-pane-content > .card-slot")},emptyNameAlert:function(t){return t?$("._empty-nest-name-alert").removeClass("d-none"):$("._empty-nest-name-alert:not(.d-none)").addClass("d-none")},updateNameRelatedTabs:function(){return nest.updateRulesTab(),nest.updateContentTab()},updateContentTab:function(){var t,e;if(0<(t=nest.contentTabSlot()).length)return e=decko.path(nest.fullName()+"?view=nest_content"),nest.updateNameDependentSlot(t,e)},updateRulesTab:function(){var t,e;return t=nest.rulesTabSlot(),e=decko.path(nest.setNameForRules()+"?view=nest_rules"),nest.updateNameDependentSlot(t,e)},updateNameDependentSlot:function(t,e){var n;return null!=(n=$("input._nest-name").val())&&0<n.length?(nest.emptyNameAlert(!1),t.reloadSlot(e)):(t.clearSlot(),nest.emptyNameAlert(!0))},fullName:function(){var t,e;return e=(t=$("input._nest-name")).val(),nest.isField()&&t.attr("data-left-name")?t.attr("data-left-name")+"+"+e:e},setNameForRules:function(){var t,e;return e=(t=$("input._nest-name")).val(),nest.isField()?t.attr("data-left-type")?t.attr("data-left-type")+"+"+e+"+*type plus right":e+"+*right":e+"+*self"}}),$(document).ready(function(){return $("body").on("click","button._link-apply",function(){return link.applyLink($(this).data("tinymce-id"),$(this).data("tm-snippet-start"),$(this).data("tm-snippet-size"))})}),window.link||(window.link={}),$(document).ready(function(){return $("body").on("click","._link-field-toggle",function(){return $(this).is(":checked")?link.addPlus():link.removePlus()}),$("body").on("input","input._link-target",function(){return link.targetChanged()}),$("body").on("input","input._link-title",function(){return link.titleChanged()})}),$.extend(link,{openLinkEditor:function(t){var e;return null==e&&(e=nest.editParams(t,"[[","]]")),nest.openEditorForTm(t,e,"link_editor","modal_link_editor")},applyLink:function(t,e,n){return nest.applySnippet("link",t,e,n)},target:function(){return link.evalFieldOption($("input._link-target").val())},title:function(){return $("input._link-title").val()},titleChanged:function(){var t;return t=$("._link-preview").val().replace(/^\[\[[^\]]*/,"[["+link.target()+"|"+link.title()),link.updatePreview(t)},targetChanged:function(){var t;return t=$("._link-preview").val().replace(/^\[\[[^\]|]*/,"[["+link.target()),link.updatePreview(t)},evalFieldOption:function(t){return link.isField()?"+"+t:t},isField:function(){return $("._link-field-toggle").is(":checked")},addPlus:function(){var t;return t=$("._link-preview").val().replace(/^\[\[\+?/,"[[+"),link.updatePreview(t),$(".input-group.hide-prefix").removeClass("hide-prefix").addClass("show-prefix")},removePlus:function(){var t;return t=$("._link-preview").val().replace(/^\[\[\+?/,"[["),link.updatePreview(t),$(".input-group.show-prefix").removeClass("show-prefix").addClass("hide-prefix")},updatePreview:function(t){return null==t&&(t="[["+link.target()+"|"+link.title()+"]]"),$("._link-preview").val(t)}}),decko.slotReady(function(){return $('[data-toggle="popover"]').popover({html:!0}),$(".colorpicker-component").colorpicker()}),M=null,$(window).ready(function(){return $("body").on("show.bs.tab",'a.load[data-toggle="tab"][data-url]',function(t){var e,n;return e=$(t.target).attr("href"),n=$(t.target).data("url"),$(t.target).removeClass("load"),$.ajax({url:n,type:"GET",success:function(t){return $(e).append(t),decko.contentLoaded($(e),$(this))}})}),$("body").on("input","._submit-after-typing",function(t){return $(t.target).closest("form").slot().find(".autosubmit-success-notification").remove(),M&&clearTimeout(M),M=setTimeout(function(){return $(t.target).closest("form").submit(),M=null},1e3)}),$("body").on("keydown","._submit-after-typing",function(t){if(13===t.which)return M&&clearTimeout(M),M=null,$(t.target).closest("form").submit(),!1}),$("body").on("change","._submit-on-change",function(t){return $(t.target).closest("form").submit(),!1}),$("body").on("change","._edit-item",function(t){var e;return(e=$(t.target)).is(":checked")?e.attr("name","add_item"):e.attr("name","drop_item"),$(t.target).closest("form").submit(),!1})}),$.extend(decko,{path:function(t){return t.match(/^\/|:\/\//)?t:decko.rootUrl+t},pingName:function(t,e){return $.getJSON(decko.path(""),{format:"json",view:"status","card[name]":t},e)}}),jQuery.fn.extend({notify:function(t,e){var n,i,o;return(i=(o=this.slot(e)).find(".card-notice"))[0]||(i=$('<div class="card-notice"></div>'),(n=o.find(".card-form"))[0]?$(n[0]).append(i):o.append(i)),i.html(t),i.show("blind")},report:function(t){var e;return!!(e=this.slot().find(".card-report"))[0]&&(e.hide(),e.html(t),e.show("drop",750),setTimeout(function(){return e.hide("drop",750)},3e3))}}),$(window).ready(function(){return $.ajaxSetup({cache:!1}),$("body").on("click",".submitter",function(){return $(this).closest("form").submit()}),$("body").on("click","button.redirecter",function(){return window.location=$(this).attr("href")}),$("body").on("change",".live-type-field",function(){var t;return t=$(this),P(t),t.data("params",$(this).closest("form").serialize()),t.data("url",$(this).attr("href"))}),$("body").on("change",".edit-type-field",function(){return $(this).closest("form").submit()}),$("body").on("mouseenter","[hover_content]",function(){return $(this).attr("hover_restore",$(this).html()),$(this).html($(this).attr("hover_content"))}),$("body").on("mouseleave","[hover_content]",function(){return $(this).html($(this).attr("hover_restore"))}),$("body").on("click",".render-error-link",function(t){return $(this).closest(".render-error").find(".render-error-message").show(),t.preventDefault()})}),decko.slotReady(function(t){return t.find("card-view-placeholder").each(function(){var e;if(!(e=$(this)).data("loading"))return e.data("loading",!0),$.get(e.data("url"),function(t){return e.replaceWith(t)})})}),P=function(t,e){var n;if(null==e&&(e=null),(n=t.closest(".slotter")).length&&n.attr("data-slotter-mode"))return n.attr("data-original-slotter-mode",n.attr("slotter-mode")),n.attr("data-slotter-mode",e)},N=function(t){return t.replace(/([a-z])([A-Z])/g,function(t){return t[0]+"_"+t[1].toLowerCase()})},$(window).ready(function(){return $("body").on("click",".btn-item",function(){return $(this).find("i").html("hourglass_full")}),$("body").on("mouseenter",".btn-item-delete",function(){return $(this).find("i").html("remove"),$(this).addClass("btn-danger").removeClass("btn-primary")}),$("body").on("mouseleave",".btn-item-delete",function(){return $(this).find("i").html("check"),$(this).addClass("btn-primary").removeClass("btn-danger")}),$("body").on("click",".follow-updater",function(){return $(this).closest("form").find("#card_update_all_users").val("true")}),$("body").on("submit",".edit-view.SELF-Xfollow_default .card-form",function(){var t;if((t=$(this).find(".confirm_update_all-view")).is(":hidden"))return $(this).find(".follow-updater").show(),t.show("blind"),!1})}),decko.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)||t()},t=function(t){return t=navigator.userAgent||navigator.vendor||window.opera,/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))},decko.slotReady(function(t){if(decko.isTouchDevice())return t.find("._show-on-hover").removeClass("_show-on-hover")}),$(window).ready(function(){return $("body").on("show.bs.popover","._card-menu-popover",function(){return $(this).closest(".card-menu._show-on-hover").removeClass("_show-on-hover").addClass("_show-on-hover-disabled")}),$("body").on("hide.bs.popover","._card-menu-popover",function(){return $(this).closest(".card-menu._show-on-hover-disabled").removeClass("_show-on-hover-disabled").addClass("_show-on-hover")})}),decko.slotReady(function(t){if(t.find("._disappear").delay(5e3).animate({height:0},1e3,function(){return $(this).hide()}),t.hasClass("_refresh-timer"))return setTimeout(function(){return t.reloadSlot(t.data("refresh-url"))},2e3)}),decko.filter=function(t){var e;return e=$(t).closest("._filter-widget"),this.widget=e.length?e:$(t).closest("._filtered-content").find("._filter-widget"),this.activeContainer=this.widget.find("._filter-container"),this.dropdown=this.widget.find("._add-filter-dropdown"),this.dropdownItems=this.widget.find("._filter-category-select"),this.form=this.widget.find("._filter-form"),this.quickFilter=this.widget.find("._quick-filter"),this.showWithStatus=function(e){var n;return n=this,$.each(this.dropdownItems,function(){var t;if((t=$(this)).data(e))return n.activate(t.data("category"))})},this.reset=function(){return this.dropdownItems.show(),this.restrict(this.form.find("._reset-filter").data("reset"))},this.clear=function(){return this.activeContainer.find(".input-group").remove()},this.activate=function(t,e){return this.activateField(t,e),this.hideOption(t)},this.showOption=function(t){return this.dropdown.show(),this.option(t).show()},this.hideOption=function(t){if(this.option(t).hide(),this.dropdownItems.length<=this.activeFields().length)return this.dropdown.hide()},this.activeFields=function(){return this.activeContainer.find("._filter-input")},this.option=function(t){return this.dropdownItems.filter("[data-category='"+t+"']")},this.findPrototype=function(t){return this.widget.find("._filter-input-field-prototypes ._filter-input-"+t)},this.activateField=function(t,e){var n;return n=this.findPrototype(t).clone(),this.fieldValue(n,e),this.dropdown.before(n),this.initField(n),n.find("input, select").first().focus()},this.fieldValue=function(t,e){return"object"==typeof e?this.compoundFieldValue(t,e):this.simpleFieldValue(t,e)},this.simpleFieldValue=function(t,e){var n;if(n=t.find("input, select"),void 0!==e)return n.val(e)},this.compoundFieldValue=function(t,e){var n,i,o;for(i in o=[],e)n=t.find("#filter_value_"+i),o.push(n.val(e[i]));return o},this.removeField=function(t){return this.activeField(t).remove(),this.showOption(t)},this.initField=function(t){return this.initSelectField(t),decko.initAutoCardPlete(t.find("input"))},this.initSelectField=function(t){return t.find("select").select2({containerCssClass:":all:",width:"auto",dropdownAutoWidth:"true"})},this.activeField=function(t){return this.activeContainer.find("._filter-input-"+t)},this.isActive=function(t){return this.activeField(t).length},this.restrict=function(t){var e;for(e in this.clear(),t)this.activateField(e,t[e]);return this.update()},this.addRestrictions=function(t){var e;for(e in t)this.removeField(e),this.activate(e,t[e]);return this.update()},this.removeRestrictions=function(t){var e;for(e in t)this.removeField(e);return this.update()},this.setInputVal=function(t,e){var n;return(n=t.find("select")).length?this.setSelect2Val(n,e):this.setTextInputVal(t.find("input"),e)},this.setSelect2Val=function(t,e){return t.attr("multiple")&&!Array.isArray(e)&&(e=[e]),t.select2("val",e)},this.setTextInputVal=function(t,e){return t.val(e),this.update()},this.updateLastVals=function(){return this.activeFields().find("input, select").each(function(){return $(this).data("lastVal",$(this).val())})},this.updateUrlBar=function(){if(!this.widget.closest("._noFilterUrlUpdates")[0])return window.history.pushState("filter","filter","?"+this.form.serialize())},this.update=function(){return this.updateLastVals(),this.updateQuickLinks(),this.form.submit(),this.updateUrlBar()},this.updateQuickLinks=function(){var t,o;return(t=(o=this).quickFilter.find("._filter-link")).addClass("active"),t.each(function(){var t,e,n,i;for(t in i=[],n=(e=$(this)).data("filter"))i.push(o.deactivateQuickLink(e,t,n[t]));return i})},this.deactivateQuickLink=function(e,t,n){var i;return i="._filter-input-"+t,$.map([this.form.find(i+" input, "+i+" select").val()],function(t){if(t=[t].flat(),-1<$.inArray(n,t))return e.removeClass("active")})},this.updateIfChanged=function(){if(this.changedSinceLastVal())return this.update()},this.updateIfPresent=function(t){var e;if((e=this.activeField(t).find("input, select").val())&&0<e.length)return this.update()},this.changedSinceLastVal=function(){var t;return t=!1,this.activeFields().find("input, select").each(function(){if($(this).val()!==$(this).data("lastVal"))return t=!0}),t},this},decko.slotReady(function(e){return e.find("._filter-widget").each(function(){var t;if(e[0]===$(this).slot()[0])return(t=new decko.filter(this)).showWithStatus("active"),t.updateLastVals(),t.updateQuickLinks()})}),$(window).ready(function(){var o,n,r,e,t,i,a;return o=function(t){return new decko.filter(t)},a=function(t){return $(t).hasClass("select2-search__field")},n=function(t){var e;return(e=$(t)).data("filter")||e.find("._filterable").data("filter")},i=function(t){var e;return e=$(t).closest("._filtering").data("filter-selector"),o(e||this)},$("body").on("click","._filter-category-select",function(t){var e,n;return t.preventDefault(),n=o(this),e=$(this).data("category"),n.activate(e),n.updateIfPresent(e)}),t="._filter-input input:not(.simple-text), ._filter-input select, ._filter-sort",$("body").on("change",t,function(){if(!a(this))return o(this).update()}),e=null,$("body").on("keyup","._filter-input input.simple-text",function(){var t;return clearTimeout(e),t=o(this),e=setTimeout(function(){return t.updateIfChanged()},333)}),$("body").on("click","._delete-filter-input",function(){var t;return(t=o(this)).removeField($(this).closest("._filter-input").data("category")),t.update()}),$("body").on("click","._reset-filter",function(){var t;return(t=o(this)).reset(),t.update()}),$("body").on("click","._filtering ._filterable",function(t){var e;return(e=i(this)).widget.length&&e.restrict(n(this)),t.preventDefault(),t.stopPropagation()}),$("body").on("click","._filter-link",function(t){var e,n,i;return e=o(this),n=(i=$(this)).data("filter"),r(i)?e.removeRestrictions(n):e.addRestrictions(n),t.preventDefault(),t.stopPropagation()}),r=function(t){return!t.hasClass("active")&&0<t.closest(".quick-filter").length}}),$(window).ready(function(){return $("body").on("click","._filter-items ._add-selected",function(){var t,e;return t=$(this),e=w(t),t.attr("href",i(t,e))}),$("body").on("click","._select-all",function(){return h($(this)).find("._unselected input._checkbox-list-checkbox").each(function(){return S($(this))}),$(this).prop("checked",!1),E($(this))}),$("body").on("click","._deselect-all",function(){return h($(this)).find("._selected input._checkbox-list-checkbox").each(function(){return $(this).slot().remove()}),$(this).prop("checked",!0),E($(this))}),$("body").on("click","._filter-items ._unselected input._checkbox-list-checkbox",function(){return S($(this)),E($(this))}),$("body").on("click","._filter-items ._selected input._checkbox-list-checkbox",function(){var t;return t=F($(this)),$(this).slot().remove(),E(t)}),$("body").on("click","._filtered-list-item-delete",function(){return $(this).closest("li").remove()})}),w=function(t){return $.map(x(t).concat(T(t)),function(t){return"~"+t}).join("\n")},i=function(t,e){var n,i;return i={assign:!0,view:t.slot().data("slot").view,card:{content:e,type:"Pointer"}},n=t.attr("href")+"&"+$.param(i),decko.slotPath(n,t.slot())},E=function(t){return j(t),new decko.filter(h(t).find("._filter-widget")).update(),L(t),V(t)},L=function(t){var e;return e=F(t).children().length,h(t).find("._selected-items").html(e),l(t).attr("disabled",0===e),0<e?o(t).removeClass("disabled"):o(t).addClass("disabled"),z(t,0<e)},z=function(t,e){var n,i,o;return o=(n=h(t)).find("._selected-item-list"),i=n.find("._filter-help"),e?(o.show(),i.hide()):(o.hide(),i.show())},V=function(t){var e,n;return n=(e=h(t)).find("._search-checkbox-list").children().length,e.find("._unselected-items").html(n),e.find("._select-all").attr("disabled",0<n)},S=function(t){return t.prop("checked",!0),F(t).append(t.slot())},F=function(t){return h(t).find("._selected-bin")},h=function(t){return t.closest("._filter-items")},o=function(t){return h(t).find("._add-selected")},l=function(t){return h(t).find("._deselect-all")},T=function(t){return O(t,"cardId")},x=function(t){return k(t,"cardId")},k=function(t,e){var n,i;return i=(n=o(t)).data("itemSelector"),r(n.slot().find(i),e)},O=function(t,e){return r(F(t).children(),e)},r=function(t,e){return t.map(function(){return $(this).data(e)}).toArray()},j=function(t){var e;return e=x(t).concat(T(t)),h(t).find("._not-ids").val(e.toString())},$(window).ready(function(){return $("body").on("click","._selectable-filtered-content .bar-body",function(t){var e,n,i;return i=(n=$(this)).slot().data("card-name"),e=n.closest("._selectable-filtered-content"),$(e.data("input-selector")).val(i),n.closest(".modal").modal("hide"),t.preventDefault(),t.stopPropagation()})})}).call(this);
|
13482
10926
|
//script: jquery helper
|
13483
10927
|
/*! jQuery UI - v1.12.1 - 2018-05-16
|
13484
10928
|
* http://jqueryui.com
|