Sha256: 6b5c5039a47808cf55aad97dc41ddeaf3f8b9c8023e0fdac2afc56c1ceb56622

Contents?: true

Size: 710 Bytes

Versions: 8

Compression:

Stored size: 710 Bytes

Contents

$(() => {
  const { attachGeocoding } = window.Decidim;

  window.DecidimProposals = window.DecidimProposals || {};

  window.DecidimProposals.bindProposalAddress = () => {
    const $checkbox = $("input:checkbox[name$='[has_address]']");
    const $addressInput = $("#address_input");

    if ($checkbox.length > 0) {
      const toggleInput = () => {
        if ($checkbox[0].checked) {
          $addressInput.show();
        } else {
          $addressInput.hide();
        }
      }
      toggleInput();
      $checkbox.on("change", toggleInput);
    }

    if ($addressInput.length > 0) {
      attachGeocoding($("input", $addressInput));
    }
  };

  window.DecidimProposals.bindProposalAddress();
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-proposals-0.23.6 app/assets/javascripts/decidim/proposals/add_proposal.js.es6
decidim-proposals-0.23.5 app/assets/javascripts/decidim/proposals/add_proposal.js.es6
decidim-proposals-0.23.4 app/assets/javascripts/decidim/proposals/add_proposal.js.es6
decidim-proposals-0.23.3 app/assets/javascripts/decidim/proposals/add_proposal.js.es6
decidim-proposals-0.23.2 app/assets/javascripts/decidim/proposals/add_proposal.js.es6
decidim-proposals-0.23.1 app/assets/javascripts/decidim/proposals/add_proposal.js.es6
decidim-proposals-0.23.1.rc1 app/assets/javascripts/decidim/proposals/add_proposal.js.es6
decidim-proposals-0.23.0 app/assets/javascripts/decidim/proposals/add_proposal.js.es6