Sha256: a8cf249f14936de15d9ffde2d7ce584af238a175eba175198aa0f40dc96ab8d5

Contents?: true

Size: 1.01 KB

Versions: 37

Compression:

Stored size: 1.01 KB

Contents

$(() => {
  const $content = $(".picker-content"),
      pickerMore = $content.data("picker-more"),
      pickerPath = $content.data("picker-path"),
      toggleNoPollingOfficers = () => {
        const showNoPollingOfficers = $("#polling_officers_list li:visible").length === 0
        $("#no_polling_officers").toggle(showNoPollingOfficers)
      }

  let jqxhr = null

  toggleNoPollingOfficers()

  $(".data_picker-modal-content").on("change keyup", "#polling_officers_filter", (event) => {
    const filter = event.target.value.toLowerCase()

    if (pickerMore) {
      if (jqxhr !== null) {
        jqxhr.abort()
      }

      $content.html("<div class='loading-spinner'></div>")
      jqxhr = $.get(`${pickerPath}?q=${filter}`, (data) => {
        $content.html(data)
        jqxhr = null
        toggleNoPollingOfficers()
      })
    } else {
      $("#polling_officers_list li").each((index, li) => {
        $(li).toggle(li.textContent.toLowerCase().includes(filter))
      })
      toggleNoPollingOfficers()
    }
  })
})

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
decidim-elections-0.27.9 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.8 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.7 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.6 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.10 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.9 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.5 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.8 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.4 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.3 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.7 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.5 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.2 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.1 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.4 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.0 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.3 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.0.rc2 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.27.0.rc1 app/packs/src/decidim/votings/admin/polling_officers_picker.js
decidim-elections-0.26.2 app/packs/src/decidim/votings/admin/polling_officers_picker.js