Sha256: e96ca1f2053919ec79ef70d068a483bbcadfc60cdc34833f28bef1688a3ee640

Contents?: true

Size: 1.58 KB

Versions: 38

Compression:

Stored size: 1.58 KB

Contents

import "src/decidim/admin/scope_picker_enabler.component"
import "src/decidim/admin/proposal_infinite_edit"

import BudgetRuleTogglerComponent from "src/decidim/admin/budget_rule_toggler.component"

// Checks if the form contains fields with special CSS classes added in
// Decidim::Admin::SettingsHelper and acts accordingly.
$(() => {
  const budgetRuleToggler = new BudgetRuleTogglerComponent({
    ruleCheckboxes: $("input[id^='component_settings_vote_rule_']")
  });

  budgetRuleToggler.run();

  // Prevents readonly containers from being modified.
  const $readonlyContainer = $(".readonly_container input");

  $readonlyContainer.click((event) => {
    event.preventDefault();
    return false;
  });

  // Target fields:
  // - amendments_wizard_help_text
  // - amendments_visibility
  // - amendment_creation_enabled
  // - amendment_reaction_enabled
  // - amendment_promotion_enabled

  // (1) Hides target fields if amendments_enabled component setting is NOT checked.
  // (2) Toggles visibilty of target fields when amendments_enabled component setting is clicked.
  const $amendmentsEnabled = $("input#component_settings_amendments_enabled");

  if ($amendmentsEnabled.length > 0) {
    const $amendmentStepSettings = $(".amendments_wizard_help_text_container, .amendments_visibility_container, .amendment_creation_enabled_container, .amendment_reaction_enabled_container, .amendment_promotion_enabled_container");

    if ($amendmentsEnabled.is(":not(:checked)")) {
      $amendmentStepSettings.hide();
    }

    $amendmentsEnabled.click(() => {
      $amendmentStepSettings.toggle();
    });
  }
});

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
decidim-admin-0.28.4 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.9 app/packs/src/decidim/admin/form.js
decidim-admin-0.28.3 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.8 app/packs/src/decidim/admin/form.js
decidim-admin-0.28.2 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.7 app/packs/src/decidim/admin/form.js
decidim-admin-0.28.1 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.6 app/packs/src/decidim/admin/form.js
decidim-admin-0.26.10 app/packs/src/decidim/admin/form.js
decidim-admin-0.26.9 app/packs/src/decidim/admin/form.js
decidim-admin-0.28.0 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.5 app/packs/src/decidim/admin/form.js
decidim-admin-0.28.0.rc5 app/packs/src/decidim/admin/form.js
decidim-admin-0.28.0.rc4 app/packs/src/decidim/admin/form.js
decidim-admin-0.26.8 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.4 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.3 app/packs/src/decidim/admin/form.js
decidim-admin-0.26.7 app/packs/src/decidim/admin/form.js
decidim-admin-0.26.5 app/packs/src/decidim/admin/form.js
decidim-admin-0.27.2 app/packs/src/decidim/admin/form.js