Sha256: 89d35571ffe00897fea55ec992bde22af73a5e3544479f086a35e0886a14ef4a

Contents?: true

Size: 942 Bytes

Versions: 6

Compression:

Stored size: 942 Bytes

Contents

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

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

  if ($form.length > 0) {
    const $paragraphCreatedInMeeting = $form.find("#paragraph_created_in_meeting");
    const $paragraphMeeting = $form.find("#paragraph_meeting");

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

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-enhanced_textwork-1.0.5 app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js
decidim-enhanced_textwork-1.0.4 app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js
decidim-enhanced_textwork-1.0.3 app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js
decidim-enhanced_textwork-1.0.2 app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js
decidim-enhanced_textwork-1.0.1 app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js
decidim-enhanced_textwork-1.0.0 app/packs/src/decidim/enhanced_textwork/admin/paragraphs_form.js