Sha256: 06da4abf2ec38aed700b110c9515f7ca3afbace1c02bec499f54537f2d80d446

Contents?: true

Size: 927 Bytes

Versions: 44

Compression:

Stored size: 927 Bytes

Contents

import attachGeocoding from "src/decidim/geocoding/attach_input"

$(() => {
  const $form = $(".proposal_form_admin");

  if ($form.length > 0) {
    const $proposalCreatedInMeeting = $form.find("#proposal_created_in_meeting");
    const $proposalMeeting = $form.find("#proposal_meeting");

    const toggleDisabledHiddenFields = () => {
      const enabledMeeting = $proposalCreatedInMeeting.prop("checked");
      $proposalMeeting.find("select").attr("disabled", "disabled");
      $proposalMeeting.hide();

      if (enabledMeeting) {
        $proposalMeeting.find("select").attr("disabled", !enabledMeeting);
        $proposalMeeting.show();
      }
    };

    $proposalCreatedInMeeting.on("change", toggleDisabledHiddenFields);
    toggleDisabledHiddenFields();

    const $proposalAddress = $form.find("#proposal_address");
    if ($proposalAddress.length !== 0) {
      attachGeocoding($proposalAddress);
    }
  }
});

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-proposals-0.25.0.rc4 app/packs/src/decidim/proposals/admin/proposals_form.js
decidim-proposals-0.25.0.rc3 app/packs/src/decidim/proposals/admin/proposals_form.js
decidim-proposals-0.25.0.rc2 app/packs/src/decidim/proposals/admin/proposals_form.js
decidim-proposals-0.25.0.rc1 app/packs/src/decidim/proposals/admin/proposals_form.js