Sha256: 04387c8361a08cb6d688777074b70d565c0ba0ea4022e7ee92705b05e1359234

Contents?: true

Size: 783 Bytes

Versions: 6

Compression:

Stored size: 783 Bytes

Contents

(() => {
  const $creatorSelect = $("#import_creator");
  const $creatorGuidances = $(".creator-guidances").find(".guidance");

  const showGuidance = (text) => {
    const formatted = text.replace(/\s/g, "").toLocaleLowerCase();
    $.each($creatorGuidances, (_index, currentValue) => {
      if (currentValue.className.includes(formatted)) {
        const elem = $(currentValue)
        elem.show();
      }
    })
  }

  $creatorSelect.on("change", function() {
    const text = $("#import_creator option:selected").text()
    $creatorGuidances.hide();
    if (text) {
      showGuidance(text)
    }
  })

  if ($creatorSelect.children("option").length < 2) {
    $("label[for='import_creator']").hide();
  }
  $creatorGuidances.hide();
  $creatorGuidances.first().show();
})();

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.24.3 app/assets/javascripts/decidim/admin/import_guidance.js.es6
decidim-admin-0.24.2 app/assets/javascripts/decidim/admin/import_guidance.js.es6
decidim-admin-0.24.1 app/assets/javascripts/decidim/admin/import_guidance.js.es6
decidim-admin-0.24.0 app/assets/javascripts/decidim/admin/import_guidance.js.es6
decidim-admin-0.24.0.rc2 app/assets/javascripts/decidim/admin/import_guidance.js.es6
decidim-admin-0.24.0.rc1 app/assets/javascripts/decidim/admin/import_guidance.js.es6