Sha256: 1d59216a480b49569f3e07a1bfd0b4a3cbd90eb0f99ad2f704ed50fb7e5ca0c0

Contents?: true

Size: 976 Bytes

Versions: 22

Compression:

Stored size: 976 Bytes

Contents

$(() => {
  const $content = $(".picker-content"),
      pickerMore = $content.data("picker-more"),
      pickerPath = $content.data("picker-path"),
      toggleNoProposals = () => {
        const showNoProposals = $("#proposals_list li:visible").length === 0
        $("#no_proposals").toggle(showNoProposals)
      }

  let jqxhr = null

  toggleNoProposals()

  $(".data_picker-modal-content").on("change keyup", "#proposals_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
        toggleNoProposals()
      })
    } else {
      $("#proposals_list li").each((index, li) => {
        $(li).toggle(li.textContent.toLowerCase().indexOf(filter) > -1)
      })
      toggleNoProposals()
    }
  })
})

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
decidim-proposals-0.25.2 app/packs/src/decidim/proposals/admin/proposals_picker.js
decidim-proposals-0.25.1 app/packs/src/decidim/proposals/admin/proposals_picker.js
decidim-proposals-0.25.0 app/packs/src/decidim/proposals/admin/proposals_picker.js
decidim-proposals-0.25.0.rc4 app/packs/src/decidim/proposals/admin/proposals_picker.js
decidim-proposals-0.25.0.rc3 app/packs/src/decidim/proposals/admin/proposals_picker.js
decidim-proposals-0.25.0.rc2 app/packs/src/decidim/proposals/admin/proposals_picker.js
decidim-proposals-0.25.0.rc1 app/packs/src/decidim/proposals/admin/proposals_picker.js
decidim-proposals-0.24.3 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.23.6 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.24.2 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.23.5 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.24.1 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.24.0 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.24.0.rc2 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.23.4 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.24.0.rc1 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.23.3 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.23.2 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.23.1 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6
decidim-proposals-0.23.1.rc1 app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6