Sha256: afb5f8df4d940497b5e143f045545c881d5541dc2c2593a616ce49f9b9cb366f
Contents?: true
Size: 1.49 KB
Versions: 37
Compression:
Stored size: 1.49 KB
Contents
document.observe("dom:loaded", function() { shop_product_index = new ShopProductIndex(); shop_product_index.initialize(); }) var ShopProductIndex = Class.create({ initialize: function() { this.sortCategories(); this.sortProducts(); }, sortCategories: function() { var route = shop.getRoute('sort_admin_shop_categories_path'); Sortable.create('categories', { overlap: 'vertical', only: 'category', handle: 'move', onUpdate: function() { new Ajax.Request(route, { method: 'put', parameters: { 'categories': Sortable.serialize('categories') } }) } }) }, sortProducts: function() { var route = shop.getRoute('sort_admin_shop_products_path'); var categories = new Array(); $$('li.category').each(function(el) { categories.push($(el).id + '_products'); }) categories.each(function(category) { Sortable.create(category, { overlap: 'vertical', only: 'product', handle: 'move', dropOnEmpty: true, hoverclass: 'hover', containment: categories, onUpdate: function() { new Ajax.Request(route, { method: 'put', parameters: { 'category_id': $(category).readAttribute('data-id'), 'products': Sortable.serialize(category) } }) }.bind(this) }) }) } })
Version data entries
37 entries across 37 versions & 1 rubygems