Sha256: 826a85c07c5b5881e98453974c71390b71da3afea3a77baf1aaf65d96a134a14

Contents?: true

Size: 721 Bytes

Versions: 52

Compression:

Stored size: 721 Bytes

Contents

// = require_self

$(() => {
  const { pushState, registerCallback } = window.Decidim.History;

  $(document).on("click", ".order-by a", (event) => {
    const $target = $(event.target);

    $target.parents('.menu').find('a:first').text($target.text());

    pushState($target.attr('href'));
  })

  registerCallback("orders", () => {
    const url = window.location.toString();
    const match = url.match(/order=([^&]*)/);
    const $orderMenu = $('.order-by .menu');
    let order = $orderMenu.find('.menu a:first').data('order');

    if (match) {
      order = match[1];
    }

    const linkText = $orderMenu.find(`.menu a[data-order="${order}"]`).text();

    $orderMenu.find('a:first').text(linkText);
  });
});

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
decidim-core-0.10.1 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.10.0 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.9.3 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.9.2 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.9.1 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.9.0 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.8.4 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.8.3 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.8.2 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.8.1 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.8.0 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.7.4 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.7.3 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.7.2 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.7.1 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.7.0 app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.6.8 app/assets/javascripts/decidim/orders.js.es6
decidim-0.6.8 decidim-core/app/assets/javascripts/decidim/orders.js.es6
decidim-core-0.6.7 app/assets/javascripts/decidim/orders.js.es6
decidim-0.6.7 decidim-core/app/assets/javascripts/decidim/orders.js.es6