Sha256: 2ed1f251c4046f8c656ae6b89decead93451d01436e2c284f7ab4300192b7c35

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

// = require jquery
// = require foundation
// = require rails-ujs
// = require ./tab_focus
// = require ./toggle_nav
// = require ./sort_list.component
// = require decidim/editor
// = require foundation-datepicker
// = require form_datepicker
// = require moment.min
// = require ./select2
// = require ./scopes
// = require_self

window.Decidim = window.Decidim || {};

const pageLoad = () => {
  const { toggleNav, createSortList } = window.DecidimAdmin;

  $(document).foundation();

  toggleNav();

  createSortList('#steps tbody', {
    placeholder: $('<tr style="border-style: dashed; border-color: #000"><td colspan="4">&nbsp;</td></tr>')[0],
    onSortUpdate: ($children) => {
      const sortUrl = $('#steps tbody').data('sort-url')
      const order = $children.map((index, child) => $(child).data('id')).toArray();

      $.ajax({
        method: 'POST',
        url: sortUrl,
        contentType: 'application/json',
        data: JSON.stringify({ items_ids: order }) }, // eslint-disable-line camelcase
      );
    }
  })
};

$(() => {
  pageLoad();

  if (window.Decidim.formDatePicker) {
    window.Decidim.formDatePicker();
  }
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-admin-0.8.4 app/assets/javascripts/decidim/admin/application.js.es6
decidim-admin-0.8.3 app/assets/javascripts/decidim/admin/application.js.es6
decidim-admin-0.8.2 app/assets/javascripts/decidim/admin/application.js.es6
decidim-admin-0.8.1 app/assets/javascripts/decidim/admin/application.js.es6
decidim-admin-0.8.0 app/assets/javascripts/decidim/admin/application.js.es6