headmin 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +27 -23
- data/app/assets/images/document.docx +0 -0
- data/app/assets/images/document.pdf +0 -0
- data/app/assets/images/image.jpg +0 -0
- data/app/assets/images/spreadsheet.xls +0 -0
- data/app/assets/images/video.mp4 +0 -0
- data/app/assets/javascripts/headmin/controllers/table_actions_controller.js +2 -2
- data/app/assets/javascripts/headmin/controllers/table_controller.js +28 -13
- data/app/assets/javascripts/headmin/index.js +0 -4
- data/app/assets/javascripts/headmin.js +33 -696
- data/app/assets/stylesheets/headmin/form.scss +4 -4
- data/app/assets/stylesheets/headmin/vendor/tom-select-bootstrap.css +1 -2
- data/app/assets/stylesheets/headmin.css +3 -3
- data/app/controllers/concerns/headmin/authentication.rb +1 -1
- data/app/controllers/concerns/headmin/searchable.rb +1 -1
- data/app/controllers/concerns/headmin/sortable.rb +7 -7
- data/app/helpers/headmin/admin_helper.rb +1 -1
- data/app/helpers/headmin/bootstrap_helper.rb +2 -24
- data/app/helpers/headmin/documentation_helper.rb +1 -1
- data/app/helpers/headmin/filter_helper.rb +1 -1
- data/app/helpers/headmin/form_helper.rb +3 -3
- data/app/helpers/headmin/notification_helper.rb +21 -21
- data/app/helpers/headmin/request_helper.rb +3 -3
- data/app/models/concerns/headmin/block.rb +1 -2
- data/app/models/concerns/headmin/blockable.rb +1 -1
- data/app/models/concerns/headmin/field.rb +1 -1
- data/app/models/concerns/headmin/fieldable.rb +8 -8
- data/app/models/headmin/documentation_renderer.rb +4 -4
- data/app/models/headmin/form/base.rb +1 -2
- data/app/models/headmin/form/text.rb +5 -7
- data/app/models/headmin/thumbnail.rb +61 -0
- data/app/services/block_service.rb +53 -53
- data/app/views/headmin/_thumbnail.html.erb +42 -40
- data/app/views/headmin/dropdown/_item.html.erb +1 -1
- data/app/views/headmin/forms/_checkbox.html.erb +1 -1
- data/app/views/headmin/forms/_file.html.erb +1 -1
- data/app/views/headmin/forms/_repeater.html.erb +1 -1
- data/app/views/headmin/forms/actions/_destroy.html.erb +3 -3
- data/app/views/headmin/forms/fields/_group.html.erb +1 -1
- data/app/views/headmin/nav/item/_devise.html.erb +1 -1
- data/app/views/headmin/table/_actions.html.erb +1 -1
- data/app/views/headmin/views/devise/registrations/_edit.html.erb +2 -2
- data/config/initializers/customize_input_error.rb +4 -4
- data/lib/generators/headmin/blocks_generator.rb +8 -8
- data/lib/generators/headmin/devise_generator.rb +4 -4
- data/lib/generators/headmin/fields_generator.rb +9 -9
- data/lib/generators/templates/controllers/auth/confirmations_controller.rb +1 -1
- data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +1 -1
- data/lib/generators/templates/controllers/auth/passwords_controller.rb +1 -1
- data/lib/generators/templates/controllers/auth/registrations_controller.rb +1 -1
- data/lib/generators/templates/controllers/auth/sessions_controller.rb +1 -1
- data/lib/generators/templates/controllers/auth/unlocks_controller.rb +1 -1
- data/lib/generators/templates/models/block.rb +1 -1
- data/lib/headmin/engine.rb +6 -6
- data/lib/headmin/version.rb +1 -1
- data/package.json +0 -1
- data/yarn.lock +1 -258
- metadata +9 -4
- data/.rubocop.yml +0 -13
@@ -3096,680 +3096,6 @@ var require_tom_select_complete = __commonJS({
|
|
3096
3096
|
}
|
3097
3097
|
});
|
3098
3098
|
|
3099
|
-
// node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js
|
3100
|
-
var require_rails_ujs = __commonJS({
|
3101
|
-
"node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js"(exports, module) {
|
3102
|
-
(function() {
|
3103
|
-
var context = this;
|
3104
|
-
(function() {
|
3105
|
-
(function() {
|
3106
|
-
this.Rails = {
|
3107
|
-
linkClickSelector: "a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",
|
3108
|
-
buttonClickSelector: {
|
3109
|
-
selector: "button[data-remote]:not([form]), button[data-confirm]:not([form])",
|
3110
|
-
exclude: "form button"
|
3111
|
-
},
|
3112
|
-
inputChangeSelector: "select[data-remote], input[data-remote], textarea[data-remote]",
|
3113
|
-
formSubmitSelector: "form:not([data-turbo=true])",
|
3114
|
-
formInputClickSelector: "form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",
|
3115
|
-
formDisableSelector: "input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled",
|
3116
|
-
formEnableSelector: "input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled",
|
3117
|
-
fileInputSelector: "input[name][type=file]:not([disabled])",
|
3118
|
-
linkDisableSelector: "a[data-disable-with], a[data-disable]",
|
3119
|
-
buttonDisableSelector: "button[data-remote][data-disable-with], button[data-remote][data-disable]"
|
3120
|
-
};
|
3121
|
-
}).call(this);
|
3122
|
-
}).call(context);
|
3123
|
-
var Rails3 = context.Rails;
|
3124
|
-
(function() {
|
3125
|
-
(function() {
|
3126
|
-
var nonce;
|
3127
|
-
nonce = null;
|
3128
|
-
Rails3.loadCSPNonce = function() {
|
3129
|
-
var ref;
|
3130
|
-
return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
|
3131
|
-
};
|
3132
|
-
Rails3.cspNonce = function() {
|
3133
|
-
return nonce != null ? nonce : Rails3.loadCSPNonce();
|
3134
|
-
};
|
3135
|
-
}).call(this);
|
3136
|
-
(function() {
|
3137
|
-
var expando2, m;
|
3138
|
-
m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
|
3139
|
-
Rails3.matches = function(element, selector) {
|
3140
|
-
if (selector.exclude != null) {
|
3141
|
-
return m.call(element, selector.selector) && !m.call(element, selector.exclude);
|
3142
|
-
} else {
|
3143
|
-
return m.call(element, selector);
|
3144
|
-
}
|
3145
|
-
};
|
3146
|
-
expando2 = "_ujsData";
|
3147
|
-
Rails3.getData = function(element, key) {
|
3148
|
-
var ref;
|
3149
|
-
return (ref = element[expando2]) != null ? ref[key] : void 0;
|
3150
|
-
};
|
3151
|
-
Rails3.setData = function(element, key, value) {
|
3152
|
-
if (element[expando2] == null) {
|
3153
|
-
element[expando2] = {};
|
3154
|
-
}
|
3155
|
-
return element[expando2][key] = value;
|
3156
|
-
};
|
3157
|
-
Rails3.$ = function(selector) {
|
3158
|
-
return Array.prototype.slice.call(document.querySelectorAll(selector));
|
3159
|
-
};
|
3160
|
-
}).call(this);
|
3161
|
-
(function() {
|
3162
|
-
var $2, csrfParam, csrfToken;
|
3163
|
-
$2 = Rails3.$;
|
3164
|
-
csrfToken = Rails3.csrfToken = function() {
|
3165
|
-
var meta;
|
3166
|
-
meta = document.querySelector("meta[name=csrf-token]");
|
3167
|
-
return meta && meta.content;
|
3168
|
-
};
|
3169
|
-
csrfParam = Rails3.csrfParam = function() {
|
3170
|
-
var meta;
|
3171
|
-
meta = document.querySelector("meta[name=csrf-param]");
|
3172
|
-
return meta && meta.content;
|
3173
|
-
};
|
3174
|
-
Rails3.CSRFProtection = function(xhr) {
|
3175
|
-
var token;
|
3176
|
-
token = csrfToken();
|
3177
|
-
if (token != null) {
|
3178
|
-
return xhr.setRequestHeader("X-CSRF-Token", token);
|
3179
|
-
}
|
3180
|
-
};
|
3181
|
-
Rails3.refreshCSRFTokens = function() {
|
3182
|
-
var param, token;
|
3183
|
-
token = csrfToken();
|
3184
|
-
param = csrfParam();
|
3185
|
-
if (token != null && param != null) {
|
3186
|
-
return $2('form input[name="' + param + '"]').forEach(function(input) {
|
3187
|
-
return input.value = token;
|
3188
|
-
});
|
3189
|
-
}
|
3190
|
-
};
|
3191
|
-
}).call(this);
|
3192
|
-
(function() {
|
3193
|
-
var CustomEvent2, fire, matches2, preventDefault;
|
3194
|
-
matches2 = Rails3.matches;
|
3195
|
-
CustomEvent2 = window.CustomEvent;
|
3196
|
-
if (typeof CustomEvent2 !== "function") {
|
3197
|
-
CustomEvent2 = function(event, params) {
|
3198
|
-
var evt;
|
3199
|
-
evt = document.createEvent("CustomEvent");
|
3200
|
-
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
3201
|
-
return evt;
|
3202
|
-
};
|
3203
|
-
CustomEvent2.prototype = window.Event.prototype;
|
3204
|
-
preventDefault = CustomEvent2.prototype.preventDefault;
|
3205
|
-
CustomEvent2.prototype.preventDefault = function() {
|
3206
|
-
var result;
|
3207
|
-
result = preventDefault.call(this);
|
3208
|
-
if (this.cancelable && !this.defaultPrevented) {
|
3209
|
-
Object.defineProperty(this, "defaultPrevented", {
|
3210
|
-
get: function() {
|
3211
|
-
return true;
|
3212
|
-
}
|
3213
|
-
});
|
3214
|
-
}
|
3215
|
-
return result;
|
3216
|
-
};
|
3217
|
-
}
|
3218
|
-
fire = Rails3.fire = function(obj, name, data) {
|
3219
|
-
var event;
|
3220
|
-
event = new CustomEvent2(name, {
|
3221
|
-
bubbles: true,
|
3222
|
-
cancelable: true,
|
3223
|
-
detail: data
|
3224
|
-
});
|
3225
|
-
obj.dispatchEvent(event);
|
3226
|
-
return !event.defaultPrevented;
|
3227
|
-
};
|
3228
|
-
Rails3.stopEverything = function(e) {
|
3229
|
-
fire(e.target, "ujs:everythingStopped");
|
3230
|
-
e.preventDefault();
|
3231
|
-
e.stopPropagation();
|
3232
|
-
return e.stopImmediatePropagation();
|
3233
|
-
};
|
3234
|
-
Rails3.delegate = function(element, selector, eventType, handler) {
|
3235
|
-
return element.addEventListener(eventType, function(e) {
|
3236
|
-
var target;
|
3237
|
-
target = e.target;
|
3238
|
-
while (!(!(target instanceof Element) || matches2(target, selector))) {
|
3239
|
-
target = target.parentNode;
|
3240
|
-
}
|
3241
|
-
if (target instanceof Element && handler.call(target, e) === false) {
|
3242
|
-
e.preventDefault();
|
3243
|
-
return e.stopPropagation();
|
3244
|
-
}
|
3245
|
-
});
|
3246
|
-
};
|
3247
|
-
}).call(this);
|
3248
|
-
(function() {
|
3249
|
-
var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;
|
3250
|
-
cspNonce = Rails3.cspNonce, CSRFProtection = Rails3.CSRFProtection, fire = Rails3.fire;
|
3251
|
-
AcceptHeaders = {
|
3252
|
-
"*": "*/*",
|
3253
|
-
text: "text/plain",
|
3254
|
-
html: "text/html",
|
3255
|
-
xml: "application/xml, text/xml",
|
3256
|
-
json: "application/json, text/javascript",
|
3257
|
-
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
|
3258
|
-
};
|
3259
|
-
Rails3.ajax = function(options) {
|
3260
|
-
var xhr;
|
3261
|
-
options = prepareOptions(options);
|
3262
|
-
xhr = createXHR(options, function() {
|
3263
|
-
var ref, response;
|
3264
|
-
response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader("Content-Type"));
|
3265
|
-
if (Math.floor(xhr.status / 100) === 2) {
|
3266
|
-
if (typeof options.success === "function") {
|
3267
|
-
options.success(response, xhr.statusText, xhr);
|
3268
|
-
}
|
3269
|
-
} else {
|
3270
|
-
if (typeof options.error === "function") {
|
3271
|
-
options.error(response, xhr.statusText, xhr);
|
3272
|
-
}
|
3273
|
-
}
|
3274
|
-
return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
|
3275
|
-
});
|
3276
|
-
if (options.beforeSend != null && !options.beforeSend(xhr, options)) {
|
3277
|
-
return false;
|
3278
|
-
}
|
3279
|
-
if (xhr.readyState === XMLHttpRequest.OPENED) {
|
3280
|
-
return xhr.send(options.data);
|
3281
|
-
}
|
3282
|
-
};
|
3283
|
-
prepareOptions = function(options) {
|
3284
|
-
options.url = options.url || location.href;
|
3285
|
-
options.type = options.type.toUpperCase();
|
3286
|
-
if (options.type === "GET" && options.data) {
|
3287
|
-
if (options.url.indexOf("?") < 0) {
|
3288
|
-
options.url += "?" + options.data;
|
3289
|
-
} else {
|
3290
|
-
options.url += "&" + options.data;
|
3291
|
-
}
|
3292
|
-
}
|
3293
|
-
if (AcceptHeaders[options.dataType] == null) {
|
3294
|
-
options.dataType = "*";
|
3295
|
-
}
|
3296
|
-
options.accept = AcceptHeaders[options.dataType];
|
3297
|
-
if (options.dataType !== "*") {
|
3298
|
-
options.accept += ", */*; q=0.01";
|
3299
|
-
}
|
3300
|
-
return options;
|
3301
|
-
};
|
3302
|
-
createXHR = function(options, done) {
|
3303
|
-
var xhr;
|
3304
|
-
xhr = new XMLHttpRequest();
|
3305
|
-
xhr.open(options.type, options.url, true);
|
3306
|
-
xhr.setRequestHeader("Accept", options.accept);
|
3307
|
-
if (typeof options.data === "string") {
|
3308
|
-
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
3309
|
-
}
|
3310
|
-
if (!options.crossDomain) {
|
3311
|
-
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
3312
|
-
CSRFProtection(xhr);
|
3313
|
-
}
|
3314
|
-
xhr.withCredentials = !!options.withCredentials;
|
3315
|
-
xhr.onreadystatechange = function() {
|
3316
|
-
if (xhr.readyState === XMLHttpRequest.DONE) {
|
3317
|
-
return done(xhr);
|
3318
|
-
}
|
3319
|
-
};
|
3320
|
-
return xhr;
|
3321
|
-
};
|
3322
|
-
processResponse = function(response, type) {
|
3323
|
-
var parser, script;
|
3324
|
-
if (typeof response === "string" && typeof type === "string") {
|
3325
|
-
if (type.match(/\bjson\b/)) {
|
3326
|
-
try {
|
3327
|
-
response = JSON.parse(response);
|
3328
|
-
} catch (error2) {
|
3329
|
-
}
|
3330
|
-
} else if (type.match(/\b(?:java|ecma)script\b/)) {
|
3331
|
-
script = document.createElement("script");
|
3332
|
-
script.setAttribute("nonce", cspNonce());
|
3333
|
-
script.text = response;
|
3334
|
-
document.head.appendChild(script).parentNode.removeChild(script);
|
3335
|
-
} else if (type.match(/\b(xml|html|svg)\b/)) {
|
3336
|
-
parser = new DOMParser();
|
3337
|
-
type = type.replace(/;.+/, "");
|
3338
|
-
try {
|
3339
|
-
response = parser.parseFromString(response, type);
|
3340
|
-
} catch (error2) {
|
3341
|
-
}
|
3342
|
-
}
|
3343
|
-
}
|
3344
|
-
return response;
|
3345
|
-
};
|
3346
|
-
Rails3.href = function(element) {
|
3347
|
-
return element.href;
|
3348
|
-
};
|
3349
|
-
Rails3.isCrossDomain = function(url) {
|
3350
|
-
var e, originAnchor, urlAnchor;
|
3351
|
-
originAnchor = document.createElement("a");
|
3352
|
-
originAnchor.href = location.href;
|
3353
|
-
urlAnchor = document.createElement("a");
|
3354
|
-
try {
|
3355
|
-
urlAnchor.href = url;
|
3356
|
-
return !((!urlAnchor.protocol || urlAnchor.protocol === ":") && !urlAnchor.host || originAnchor.protocol + "//" + originAnchor.host === urlAnchor.protocol + "//" + urlAnchor.host);
|
3357
|
-
} catch (error2) {
|
3358
|
-
e = error2;
|
3359
|
-
return true;
|
3360
|
-
}
|
3361
|
-
};
|
3362
|
-
}).call(this);
|
3363
|
-
(function() {
|
3364
|
-
var matches2, toArray2;
|
3365
|
-
matches2 = Rails3.matches;
|
3366
|
-
toArray2 = function(e) {
|
3367
|
-
return Array.prototype.slice.call(e);
|
3368
|
-
};
|
3369
|
-
Rails3.serializeElement = function(element, additionalParam) {
|
3370
|
-
var inputs, params;
|
3371
|
-
inputs = [element];
|
3372
|
-
if (matches2(element, "form")) {
|
3373
|
-
inputs = toArray2(element.elements);
|
3374
|
-
}
|
3375
|
-
params = [];
|
3376
|
-
inputs.forEach(function(input) {
|
3377
|
-
if (!input.name || input.disabled) {
|
3378
|
-
return;
|
3379
|
-
}
|
3380
|
-
if (matches2(input, "fieldset[disabled] *")) {
|
3381
|
-
return;
|
3382
|
-
}
|
3383
|
-
if (matches2(input, "select")) {
|
3384
|
-
return toArray2(input.options).forEach(function(option2) {
|
3385
|
-
if (option2.selected) {
|
3386
|
-
return params.push({
|
3387
|
-
name: input.name,
|
3388
|
-
value: option2.value
|
3389
|
-
});
|
3390
|
-
}
|
3391
|
-
});
|
3392
|
-
} else if (input.checked || ["radio", "checkbox", "submit"].indexOf(input.type) === -1) {
|
3393
|
-
return params.push({
|
3394
|
-
name: input.name,
|
3395
|
-
value: input.value
|
3396
|
-
});
|
3397
|
-
}
|
3398
|
-
});
|
3399
|
-
if (additionalParam) {
|
3400
|
-
params.push(additionalParam);
|
3401
|
-
}
|
3402
|
-
return params.map(function(param) {
|
3403
|
-
if (param.name != null) {
|
3404
|
-
return encodeURIComponent(param.name) + "=" + encodeURIComponent(param.value);
|
3405
|
-
} else {
|
3406
|
-
return param;
|
3407
|
-
}
|
3408
|
-
}).join("&");
|
3409
|
-
};
|
3410
|
-
Rails3.formElements = function(form, selector) {
|
3411
|
-
if (matches2(form, "form")) {
|
3412
|
-
return toArray2(form.elements).filter(function(el) {
|
3413
|
-
return matches2(el, selector);
|
3414
|
-
});
|
3415
|
-
} else {
|
3416
|
-
return toArray2(form.querySelectorAll(selector));
|
3417
|
-
}
|
3418
|
-
};
|
3419
|
-
}).call(this);
|
3420
|
-
(function() {
|
3421
|
-
var allowAction, fire, stopEverything;
|
3422
|
-
fire = Rails3.fire, stopEverything = Rails3.stopEverything;
|
3423
|
-
Rails3.handleConfirm = function(e) {
|
3424
|
-
if (!allowAction(this)) {
|
3425
|
-
return stopEverything(e);
|
3426
|
-
}
|
3427
|
-
};
|
3428
|
-
Rails3.confirm = function(message, element) {
|
3429
|
-
return confirm(message);
|
3430
|
-
};
|
3431
|
-
allowAction = function(element) {
|
3432
|
-
var answer, callback, message;
|
3433
|
-
message = element.getAttribute("data-confirm");
|
3434
|
-
if (!message) {
|
3435
|
-
return true;
|
3436
|
-
}
|
3437
|
-
answer = false;
|
3438
|
-
if (fire(element, "confirm")) {
|
3439
|
-
try {
|
3440
|
-
answer = Rails3.confirm(message, element);
|
3441
|
-
} catch (error2) {
|
3442
|
-
}
|
3443
|
-
callback = fire(element, "confirm:complete", [answer]);
|
3444
|
-
}
|
3445
|
-
return answer && callback;
|
3446
|
-
};
|
3447
|
-
}).call(this);
|
3448
|
-
(function() {
|
3449
|
-
var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches2, setData, stopEverything;
|
3450
|
-
matches2 = Rails3.matches, getData = Rails3.getData, setData = Rails3.setData, stopEverything = Rails3.stopEverything, formElements = Rails3.formElements;
|
3451
|
-
Rails3.handleDisabledElement = function(e) {
|
3452
|
-
var element;
|
3453
|
-
element = this;
|
3454
|
-
if (element.disabled) {
|
3455
|
-
return stopEverything(e);
|
3456
|
-
}
|
3457
|
-
};
|
3458
|
-
Rails3.enableElement = function(e) {
|
3459
|
-
var element;
|
3460
|
-
if (e instanceof Event) {
|
3461
|
-
if (isXhrRedirect(e)) {
|
3462
|
-
return;
|
3463
|
-
}
|
3464
|
-
element = e.target;
|
3465
|
-
} else {
|
3466
|
-
element = e;
|
3467
|
-
}
|
3468
|
-
if (matches2(element, Rails3.linkDisableSelector)) {
|
3469
|
-
return enableLinkElement(element);
|
3470
|
-
} else if (matches2(element, Rails3.buttonDisableSelector) || matches2(element, Rails3.formEnableSelector)) {
|
3471
|
-
return enableFormElement(element);
|
3472
|
-
} else if (matches2(element, Rails3.formSubmitSelector)) {
|
3473
|
-
return enableFormElements(element);
|
3474
|
-
}
|
3475
|
-
};
|
3476
|
-
Rails3.disableElement = function(e) {
|
3477
|
-
var element;
|
3478
|
-
element = e instanceof Event ? e.target : e;
|
3479
|
-
if (matches2(element, Rails3.linkDisableSelector)) {
|
3480
|
-
return disableLinkElement(element);
|
3481
|
-
} else if (matches2(element, Rails3.buttonDisableSelector) || matches2(element, Rails3.formDisableSelector)) {
|
3482
|
-
return disableFormElement(element);
|
3483
|
-
} else if (matches2(element, Rails3.formSubmitSelector)) {
|
3484
|
-
return disableFormElements(element);
|
3485
|
-
}
|
3486
|
-
};
|
3487
|
-
disableLinkElement = function(element) {
|
3488
|
-
var replacement;
|
3489
|
-
if (getData(element, "ujs:disabled")) {
|
3490
|
-
return;
|
3491
|
-
}
|
3492
|
-
replacement = element.getAttribute("data-disable-with");
|
3493
|
-
if (replacement != null) {
|
3494
|
-
setData(element, "ujs:enable-with", element.innerHTML);
|
3495
|
-
element.innerHTML = replacement;
|
3496
|
-
}
|
3497
|
-
element.addEventListener("click", stopEverything);
|
3498
|
-
return setData(element, "ujs:disabled", true);
|
3499
|
-
};
|
3500
|
-
enableLinkElement = function(element) {
|
3501
|
-
var originalText;
|
3502
|
-
originalText = getData(element, "ujs:enable-with");
|
3503
|
-
if (originalText != null) {
|
3504
|
-
element.innerHTML = originalText;
|
3505
|
-
setData(element, "ujs:enable-with", null);
|
3506
|
-
}
|
3507
|
-
element.removeEventListener("click", stopEverything);
|
3508
|
-
return setData(element, "ujs:disabled", null);
|
3509
|
-
};
|
3510
|
-
disableFormElements = function(form) {
|
3511
|
-
return formElements(form, Rails3.formDisableSelector).forEach(disableFormElement);
|
3512
|
-
};
|
3513
|
-
disableFormElement = function(element) {
|
3514
|
-
var replacement;
|
3515
|
-
if (getData(element, "ujs:disabled")) {
|
3516
|
-
return;
|
3517
|
-
}
|
3518
|
-
replacement = element.getAttribute("data-disable-with");
|
3519
|
-
if (replacement != null) {
|
3520
|
-
if (matches2(element, "button")) {
|
3521
|
-
setData(element, "ujs:enable-with", element.innerHTML);
|
3522
|
-
element.innerHTML = replacement;
|
3523
|
-
} else {
|
3524
|
-
setData(element, "ujs:enable-with", element.value);
|
3525
|
-
element.value = replacement;
|
3526
|
-
}
|
3527
|
-
}
|
3528
|
-
element.disabled = true;
|
3529
|
-
return setData(element, "ujs:disabled", true);
|
3530
|
-
};
|
3531
|
-
enableFormElements = function(form) {
|
3532
|
-
return formElements(form, Rails3.formEnableSelector).forEach(enableFormElement);
|
3533
|
-
};
|
3534
|
-
enableFormElement = function(element) {
|
3535
|
-
var originalText;
|
3536
|
-
originalText = getData(element, "ujs:enable-with");
|
3537
|
-
if (originalText != null) {
|
3538
|
-
if (matches2(element, "button")) {
|
3539
|
-
element.innerHTML = originalText;
|
3540
|
-
} else {
|
3541
|
-
element.value = originalText;
|
3542
|
-
}
|
3543
|
-
setData(element, "ujs:enable-with", null);
|
3544
|
-
}
|
3545
|
-
element.disabled = false;
|
3546
|
-
return setData(element, "ujs:disabled", null);
|
3547
|
-
};
|
3548
|
-
isXhrRedirect = function(event) {
|
3549
|
-
var ref, xhr;
|
3550
|
-
xhr = (ref = event.detail) != null ? ref[0] : void 0;
|
3551
|
-
return (xhr != null ? xhr.getResponseHeader("X-Xhr-Redirect") : void 0) != null;
|
3552
|
-
};
|
3553
|
-
}).call(this);
|
3554
|
-
(function() {
|
3555
|
-
var stopEverything;
|
3556
|
-
stopEverything = Rails3.stopEverything;
|
3557
|
-
Rails3.handleMethod = function(e) {
|
3558
|
-
var csrfParam, csrfToken, form, formContent, href, link, method;
|
3559
|
-
link = this;
|
3560
|
-
method = link.getAttribute("data-method");
|
3561
|
-
if (!method) {
|
3562
|
-
return;
|
3563
|
-
}
|
3564
|
-
href = Rails3.href(link);
|
3565
|
-
csrfToken = Rails3.csrfToken();
|
3566
|
-
csrfParam = Rails3.csrfParam();
|
3567
|
-
form = document.createElement("form");
|
3568
|
-
formContent = "<input name='_method' value='" + method + "' type='hidden' />";
|
3569
|
-
if (csrfParam != null && csrfToken != null && !Rails3.isCrossDomain(href)) {
|
3570
|
-
formContent += "<input name='" + csrfParam + "' value='" + csrfToken + "' type='hidden' />";
|
3571
|
-
}
|
3572
|
-
formContent += '<input type="submit" />';
|
3573
|
-
form.method = "post";
|
3574
|
-
form.action = href;
|
3575
|
-
form.target = link.target;
|
3576
|
-
form.innerHTML = formContent;
|
3577
|
-
form.style.display = "none";
|
3578
|
-
document.body.appendChild(form);
|
3579
|
-
form.querySelector('[type="submit"]').click();
|
3580
|
-
return stopEverything(e);
|
3581
|
-
};
|
3582
|
-
}).call(this);
|
3583
|
-
(function() {
|
3584
|
-
var ajax, fire, getData, isCrossDomain, isRemote, matches2, serializeElement, setData, stopEverything, slice = [].slice;
|
3585
|
-
matches2 = Rails3.matches, getData = Rails3.getData, setData = Rails3.setData, fire = Rails3.fire, stopEverything = Rails3.stopEverything, ajax = Rails3.ajax, isCrossDomain = Rails3.isCrossDomain, serializeElement = Rails3.serializeElement;
|
3586
|
-
isRemote = function(element) {
|
3587
|
-
var value;
|
3588
|
-
value = element.getAttribute("data-remote");
|
3589
|
-
return value != null && value !== "false";
|
3590
|
-
};
|
3591
|
-
Rails3.handleRemote = function(e) {
|
3592
|
-
var button, data, dataType, element, method, url, withCredentials;
|
3593
|
-
element = this;
|
3594
|
-
if (!isRemote(element)) {
|
3595
|
-
return true;
|
3596
|
-
}
|
3597
|
-
if (!fire(element, "ajax:before")) {
|
3598
|
-
fire(element, "ajax:stopped");
|
3599
|
-
return false;
|
3600
|
-
}
|
3601
|
-
withCredentials = element.getAttribute("data-with-credentials");
|
3602
|
-
dataType = element.getAttribute("data-type") || "script";
|
3603
|
-
if (matches2(element, Rails3.formSubmitSelector)) {
|
3604
|
-
button = getData(element, "ujs:submit-button");
|
3605
|
-
method = getData(element, "ujs:submit-button-formmethod") || element.method;
|
3606
|
-
url = getData(element, "ujs:submit-button-formaction") || element.getAttribute("action") || location.href;
|
3607
|
-
if (method.toUpperCase() === "GET") {
|
3608
|
-
url = url.replace(/\?.*$/, "");
|
3609
|
-
}
|
3610
|
-
if (element.enctype === "multipart/form-data") {
|
3611
|
-
data = new FormData(element);
|
3612
|
-
if (button != null) {
|
3613
|
-
data.append(button.name, button.value);
|
3614
|
-
}
|
3615
|
-
} else {
|
3616
|
-
data = serializeElement(element, button);
|
3617
|
-
}
|
3618
|
-
setData(element, "ujs:submit-button", null);
|
3619
|
-
setData(element, "ujs:submit-button-formmethod", null);
|
3620
|
-
setData(element, "ujs:submit-button-formaction", null);
|
3621
|
-
} else if (matches2(element, Rails3.buttonClickSelector) || matches2(element, Rails3.inputChangeSelector)) {
|
3622
|
-
method = element.getAttribute("data-method");
|
3623
|
-
url = element.getAttribute("data-url");
|
3624
|
-
data = serializeElement(element, element.getAttribute("data-params"));
|
3625
|
-
} else {
|
3626
|
-
method = element.getAttribute("data-method");
|
3627
|
-
url = Rails3.href(element);
|
3628
|
-
data = element.getAttribute("data-params");
|
3629
|
-
}
|
3630
|
-
ajax({
|
3631
|
-
type: method || "GET",
|
3632
|
-
url,
|
3633
|
-
data,
|
3634
|
-
dataType,
|
3635
|
-
beforeSend: function(xhr, options) {
|
3636
|
-
if (fire(element, "ajax:beforeSend", [xhr, options])) {
|
3637
|
-
return fire(element, "ajax:send", [xhr]);
|
3638
|
-
} else {
|
3639
|
-
fire(element, "ajax:stopped");
|
3640
|
-
return false;
|
3641
|
-
}
|
3642
|
-
},
|
3643
|
-
success: function() {
|
3644
|
-
var args;
|
3645
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
3646
|
-
return fire(element, "ajax:success", args);
|
3647
|
-
},
|
3648
|
-
error: function() {
|
3649
|
-
var args;
|
3650
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
3651
|
-
return fire(element, "ajax:error", args);
|
3652
|
-
},
|
3653
|
-
complete: function() {
|
3654
|
-
var args;
|
3655
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
3656
|
-
return fire(element, "ajax:complete", args);
|
3657
|
-
},
|
3658
|
-
crossDomain: isCrossDomain(url),
|
3659
|
-
withCredentials: withCredentials != null && withCredentials !== "false"
|
3660
|
-
});
|
3661
|
-
return stopEverything(e);
|
3662
|
-
};
|
3663
|
-
Rails3.formSubmitButtonClick = function(e) {
|
3664
|
-
var button, form;
|
3665
|
-
button = this;
|
3666
|
-
form = button.form;
|
3667
|
-
if (!form) {
|
3668
|
-
return;
|
3669
|
-
}
|
3670
|
-
if (button.name) {
|
3671
|
-
setData(form, "ujs:submit-button", {
|
3672
|
-
name: button.name,
|
3673
|
-
value: button.value
|
3674
|
-
});
|
3675
|
-
}
|
3676
|
-
setData(form, "ujs:formnovalidate-button", button.formNoValidate);
|
3677
|
-
setData(form, "ujs:submit-button-formaction", button.getAttribute("formaction"));
|
3678
|
-
return setData(form, "ujs:submit-button-formmethod", button.getAttribute("formmethod"));
|
3679
|
-
};
|
3680
|
-
Rails3.preventInsignificantClick = function(e) {
|
3681
|
-
var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;
|
3682
|
-
link = this;
|
3683
|
-
method = (link.getAttribute("data-method") || "GET").toUpperCase();
|
3684
|
-
data = link.getAttribute("data-params");
|
3685
|
-
metaClick = e.metaKey || e.ctrlKey;
|
3686
|
-
insignificantMetaClick = metaClick && method === "GET" && !data;
|
3687
|
-
nonPrimaryMouseClick = e.button != null && e.button !== 0;
|
3688
|
-
if (nonPrimaryMouseClick || insignificantMetaClick) {
|
3689
|
-
return e.stopImmediatePropagation();
|
3690
|
-
}
|
3691
|
-
};
|
3692
|
-
}).call(this);
|
3693
|
-
(function() {
|
3694
|
-
var $2, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
|
3695
|
-
fire = Rails3.fire, delegate = Rails3.delegate, getData = Rails3.getData, $2 = Rails3.$, refreshCSRFTokens = Rails3.refreshCSRFTokens, CSRFProtection = Rails3.CSRFProtection, loadCSPNonce = Rails3.loadCSPNonce, enableElement = Rails3.enableElement, disableElement = Rails3.disableElement, handleDisabledElement = Rails3.handleDisabledElement, handleConfirm = Rails3.handleConfirm, preventInsignificantClick = Rails3.preventInsignificantClick, handleRemote = Rails3.handleRemote, formSubmitButtonClick = Rails3.formSubmitButtonClick, handleMethod = Rails3.handleMethod;
|
3696
|
-
if (typeof jQuery !== "undefined" && jQuery !== null && jQuery.ajax != null) {
|
3697
|
-
if (jQuery.rails) {
|
3698
|
-
throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");
|
3699
|
-
}
|
3700
|
-
jQuery.rails = Rails3;
|
3701
|
-
jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
|
3702
|
-
if (!options.crossDomain) {
|
3703
|
-
return CSRFProtection(xhr);
|
3704
|
-
}
|
3705
|
-
});
|
3706
|
-
}
|
3707
|
-
Rails3.start = function() {
|
3708
|
-
if (window._rails_loaded) {
|
3709
|
-
throw new Error("rails-ujs has already been loaded!");
|
3710
|
-
}
|
3711
|
-
window.addEventListener("pageshow", function() {
|
3712
|
-
$2(Rails3.formEnableSelector).forEach(function(el) {
|
3713
|
-
if (getData(el, "ujs:disabled")) {
|
3714
|
-
return enableElement(el);
|
3715
|
-
}
|
3716
|
-
});
|
3717
|
-
return $2(Rails3.linkDisableSelector).forEach(function(el) {
|
3718
|
-
if (getData(el, "ujs:disabled")) {
|
3719
|
-
return enableElement(el);
|
3720
|
-
}
|
3721
|
-
});
|
3722
|
-
});
|
3723
|
-
delegate(document, Rails3.linkDisableSelector, "ajax:complete", enableElement);
|
3724
|
-
delegate(document, Rails3.linkDisableSelector, "ajax:stopped", enableElement);
|
3725
|
-
delegate(document, Rails3.buttonDisableSelector, "ajax:complete", enableElement);
|
3726
|
-
delegate(document, Rails3.buttonDisableSelector, "ajax:stopped", enableElement);
|
3727
|
-
delegate(document, Rails3.linkClickSelector, "click", preventInsignificantClick);
|
3728
|
-
delegate(document, Rails3.linkClickSelector, "click", handleDisabledElement);
|
3729
|
-
delegate(document, Rails3.linkClickSelector, "click", handleConfirm);
|
3730
|
-
delegate(document, Rails3.linkClickSelector, "click", disableElement);
|
3731
|
-
delegate(document, Rails3.linkClickSelector, "click", handleRemote);
|
3732
|
-
delegate(document, Rails3.linkClickSelector, "click", handleMethod);
|
3733
|
-
delegate(document, Rails3.buttonClickSelector, "click", preventInsignificantClick);
|
3734
|
-
delegate(document, Rails3.buttonClickSelector, "click", handleDisabledElement);
|
3735
|
-
delegate(document, Rails3.buttonClickSelector, "click", handleConfirm);
|
3736
|
-
delegate(document, Rails3.buttonClickSelector, "click", disableElement);
|
3737
|
-
delegate(document, Rails3.buttonClickSelector, "click", handleRemote);
|
3738
|
-
delegate(document, Rails3.inputChangeSelector, "change", handleDisabledElement);
|
3739
|
-
delegate(document, Rails3.inputChangeSelector, "change", handleConfirm);
|
3740
|
-
delegate(document, Rails3.inputChangeSelector, "change", handleRemote);
|
3741
|
-
delegate(document, Rails3.formSubmitSelector, "submit", handleDisabledElement);
|
3742
|
-
delegate(document, Rails3.formSubmitSelector, "submit", handleConfirm);
|
3743
|
-
delegate(document, Rails3.formSubmitSelector, "submit", handleRemote);
|
3744
|
-
delegate(document, Rails3.formSubmitSelector, "submit", function(e) {
|
3745
|
-
return setTimeout(function() {
|
3746
|
-
return disableElement(e);
|
3747
|
-
}, 13);
|
3748
|
-
});
|
3749
|
-
delegate(document, Rails3.formSubmitSelector, "ajax:send", disableElement);
|
3750
|
-
delegate(document, Rails3.formSubmitSelector, "ajax:complete", enableElement);
|
3751
|
-
delegate(document, Rails3.formInputClickSelector, "click", preventInsignificantClick);
|
3752
|
-
delegate(document, Rails3.formInputClickSelector, "click", handleDisabledElement);
|
3753
|
-
delegate(document, Rails3.formInputClickSelector, "click", handleConfirm);
|
3754
|
-
delegate(document, Rails3.formInputClickSelector, "click", formSubmitButtonClick);
|
3755
|
-
document.addEventListener("DOMContentLoaded", refreshCSRFTokens);
|
3756
|
-
document.addEventListener("DOMContentLoaded", loadCSPNonce);
|
3757
|
-
return window._rails_loaded = true;
|
3758
|
-
};
|
3759
|
-
if (window.Rails === Rails3 && fire(document, "rails:attachBindings")) {
|
3760
|
-
Rails3.start();
|
3761
|
-
}
|
3762
|
-
}).call(this);
|
3763
|
-
}).call(this);
|
3764
|
-
if (typeof module === "object" && module.exports) {
|
3765
|
-
module.exports = Rails3;
|
3766
|
-
} else if (typeof define === "function" && define.amd) {
|
3767
|
-
define(Rails3);
|
3768
|
-
}
|
3769
|
-
}).call(exports);
|
3770
|
-
}
|
3771
|
-
});
|
3772
|
-
|
3773
3099
|
// node_modules/@hotwired/stimulus/dist/stimulus.js
|
3774
3100
|
var EventListener = class {
|
3775
3101
|
constructor(eventTarget, eventName, eventOptions) {
|
@@ -4334,13 +3660,13 @@ var StringMapObserver = class {
|
|
4334
3660
|
}
|
4335
3661
|
};
|
4336
3662
|
function add(map, key, value) {
|
4337
|
-
|
3663
|
+
fetch2(map, key).add(value);
|
4338
3664
|
}
|
4339
3665
|
function del(map, key, value) {
|
4340
|
-
|
3666
|
+
fetch2(map, key).delete(value);
|
4341
3667
|
prune(map, key);
|
4342
3668
|
}
|
4343
|
-
function
|
3669
|
+
function fetch2(map, key) {
|
4344
3670
|
let values = map.get(key);
|
4345
3671
|
if (!values) {
|
4346
3672
|
values = /* @__PURE__ */ new Set();
|
@@ -15778,11 +15104,11 @@ var table_actions_controller_default = class extends Controller {
|
|
15778
15104
|
}
|
15779
15105
|
updateButton() {
|
15780
15106
|
const option2 = this.selectedOption();
|
15781
|
-
const
|
15782
|
-
if (
|
15783
|
-
this.
|
15107
|
+
const confirm = option2.dataset.confirm;
|
15108
|
+
if (confirm) {
|
15109
|
+
this.formTarget.dataset.turboConfirm = confirm;
|
15784
15110
|
} else {
|
15785
|
-
this.
|
15111
|
+
this.formTarget.removeAttribute("data-turbo-confirm");
|
15786
15112
|
}
|
15787
15113
|
this.enableButton();
|
15788
15114
|
}
|
@@ -15805,7 +15131,6 @@ var table_actions_controller_default = class extends Controller {
|
|
15805
15131
|
};
|
15806
15132
|
|
15807
15133
|
// app/assets/javascripts/headmin/controllers/table_controller.js
|
15808
|
-
var import_ujs = __toESM(require_rails_ujs());
|
15809
15134
|
var table_controller_default = class extends Controller {
|
15810
15135
|
static get values() {
|
15811
15136
|
return {
|
@@ -15820,22 +15145,36 @@ var table_controller_default = class extends Controller {
|
|
15820
15145
|
new sortable_esm_default(this.bodyTarget, {
|
15821
15146
|
handle: ".table-drag-sort-handle",
|
15822
15147
|
onEnd: (event) => {
|
15823
|
-
|
15824
|
-
url: this.urlValue,
|
15825
|
-
type: "PATCH",
|
15826
|
-
data: this.getIdsDataString()
|
15827
|
-
});
|
15148
|
+
this.submitPositions();
|
15828
15149
|
}
|
15829
15150
|
});
|
15830
15151
|
}
|
15831
|
-
|
15832
|
-
|
15833
|
-
|
15834
|
-
|
15835
|
-
|
15836
|
-
|
15152
|
+
submitPositions() {
|
15153
|
+
fetch(this.urlValue, {
|
15154
|
+
method: "PATCH",
|
15155
|
+
body: this.idsFormData(),
|
15156
|
+
headers: {
|
15157
|
+
"X-CSRF-Token": document.querySelector('meta[name="csrf-token"]').content
|
15158
|
+
}
|
15159
|
+
}).then((response) => {
|
15160
|
+
return response.text();
|
15161
|
+
}).catch((err) => {
|
15162
|
+
console.warn("Fetch went wrong", err);
|
15163
|
+
});
|
15164
|
+
}
|
15165
|
+
positions() {
|
15166
|
+
const handles = [...this.tableTarget.querySelectorAll(".table-drag-sort-handle")];
|
15167
|
+
return handles.map((handle) => {
|
15168
|
+
return handle.dataset.id;
|
15169
|
+
});
|
15170
|
+
}
|
15171
|
+
idsFormData() {
|
15172
|
+
let formData = new FormData();
|
15173
|
+
console.log(this.positions());
|
15174
|
+
this.positions().forEach((id) => {
|
15175
|
+
formData.append("ids[]", id);
|
15837
15176
|
});
|
15838
|
-
return
|
15177
|
+
return formData;
|
15839
15178
|
}
|
15840
15179
|
toggleIds(event) {
|
15841
15180
|
const checkbox = event.target;
|
@@ -15896,7 +15235,6 @@ var table_controller_default = class extends Controller {
|
|
15896
15235
|
};
|
15897
15236
|
|
15898
15237
|
// app/assets/javascripts/headmin/index.js
|
15899
|
-
var import_ujs2 = __toESM(require_rails_ujs());
|
15900
15238
|
var Headmin = class {
|
15901
15239
|
static start() {
|
15902
15240
|
window.Stimulus = window.Stimulus || Application.start();
|
@@ -15915,7 +15253,6 @@ var Headmin = class {
|
|
15915
15253
|
Stimulus.register("select", select_controller_default);
|
15916
15254
|
Stimulus.register("table", table_controller_default);
|
15917
15255
|
Stimulus.register("table-actions", table_actions_controller_default);
|
15918
|
-
import_ujs2.default.start();
|
15919
15256
|
}
|
15920
15257
|
};
|
15921
15258
|
export {
|