Sha256: d46e4d95a63e416276398c3c61ae35c91f93ab308e62525b14449ca8c19341c6
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 KB
Contents
((exports) => { class BudgetRuleTogglerComponent { constructor(options = {}) { this.ruleCheckboxes = options.ruleCheckboxes; this._runAll(); } _runAll() { this.ruleCheckboxes. each((_i, checkbox) => { this._bindEvent(checkbox); this.run(checkbox); }); } _bindEvent(target) { $(target). on("change", (event) => { this.run(event.target); }); } run(target) { this.toggleTextInput(target); if ($(target).prop("checked")) { this.ruleCheckboxes. filter( (_i, checkbox) => { return checkbox !== target; }). prop("checked", false). each( (_i, checkbox) => { this.toggleTextInput(checkbox); }); } } toggleTextInput(target) { let input = $(target).closest("div").next(); if ($(target).prop("checked")) { input.slideDown(); } else { input.slideUp(); } } } exports.DecidimAdmin = exports.DecidimAdmin || {}; exports.DecidimAdmin.BudgetRuleTogglerComponent = BudgetRuleTogglerComponent; })(window);
Version data entries
9 entries across 9 versions & 1 rubygems