Sha256: 51b9e358d217a10dcb187ba76cf3b7e8be43ffbcd7a238be5e98bfc846604034

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

if (typeof(Alchemy) === 'undefined') {
  var Alchemy = {};
}

(function($) {

  var PageSorter = {};
  $.extend(Alchemy, PageSorter);

  Alchemy.PageSorter = {

    init: function() {
      var $sortables = $('ul#sitemap').find('ul.level_1_children');
      $sortables.nestedSortable({
        disableNesting: 'no-nest',
        forcePlaceholderSize: true,
        handle: '.handle',
        items: 'li',
        listType: 'ul',
        opacity: 0.5,
        placeholder: 'placeholder',
        tabSize: 16,
        tolerance: 'pointer',
        toleranceElement: '> div'
      });
      $('#save_page_order').click(function(e) {
        Alchemy.pleaseWaitOverlay();
        e.preventDefault();
        var params = {
          set: JSON.stringify($sortables.nestedSortable('toHierarchy'))
        };
        $.post(Alchemy.routes.order_admin_pages_path, params);
        return false;
      });
      $('#sort_panel .button').click(Alchemy.pleaseWaitOverlay);
      Alchemy.PageSorter.disableButton();
      Alchemy.resizeFrame();
    },

    disableButton: function() {
      var $buttonLink = $('#page_sorting_button a');
      $buttonLink.removeAttr('onclick');
      $('#page_sorting_button').addClass('active');
      $buttonLink.css({
        cursor: 'default'
      });
    }

  }

})(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alchemy_cms-2.5.0.b9 app/assets/javascripts/alchemy/alchemy.page_sorter.js