1/** 2 * ISMS.online extensions to the `rails.js` file. 3 * 4 * Some alterations also had to be made to the `rails.js` file. 5 * In the case that `rails.js` is upgraded, run 6 * `git apply public/javascripts/rails.patch` to re-apply our changes. 7 */ 8(function () { 9 /** 10 * Our custom version of the `allowAction` function from `rails.js`. 11 * This permits buttons/links with the `data-confirm` attribute to 12 * use a modal for confirmation instead of a `confirm()` call. 13 */ 14 function allowAction(element) { 15 const message = element.data('confirm'); 16 const opts = { 17 title: element.data('confirm-title'), 18 submitBtnText: element.data('confirm-button-text'), 19 cancelBtnText: element.data('confirm-cancel-text') 20 }; 21 let answer = false, 22 callback; 23 if (!message) { return true; } 24 25 if ($.rails.fire(element, 'confirm')) { 26 try { 27 answer = dialogs.confirmClick(message, element[0], true, opts); 28 } catch (e) { 29 (console.error || console.log).call(console, e.stack || e); 30 } 31 callback = $.rails.fire(element, 'confirm:complete', [answer]); 32 } 33 return answer && callback; 34 } 35 36 window.railsExtensions = { allowAction: allowAction }; 37})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.