Sha256: 1ddd79d2a97f66a9770cb27468f0f5f984fffe336766d409167bc8979c4a5ffa

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

// = require jquery
// = require jquery_ujs
// = require foundation
// = 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 ./participatory_processes
// = 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

4 entries across 4 versions & 2 rubygems

Version Path
decidim-admin-0.5.1 app/assets/javascripts/decidim/admin/application.js.es6
decidim-0.5.1 decidim-admin/app/assets/javascripts/decidim/admin/application.js.es6
decidim-admin-0.5.0 app/assets/javascripts/decidim/admin/application.js.es6
decidim-0.5.0 decidim-admin/app/assets/javascripts/decidim/admin/application.js.es6