2015-01-11 22:55:52 +03:00
|
|
|
import BaseView from 'ghost/views/settings/content-base';
|
|
|
|
|
2015-01-14 17:46:29 +03:00
|
|
|
var SettingsNavigationView = BaseView.extend({
|
2015-02-03 19:29:01 +03:00
|
|
|
|
|
|
|
didInsertElement: function () {
|
|
|
|
var controller = this.get('controller'),
|
|
|
|
navContainer = Ember.$('.js-settings-navigation'),
|
|
|
|
navElements = '.navigation-item:not(.navigation-item:last-child)';
|
|
|
|
|
|
|
|
navContainer.sortable({
|
|
|
|
handle: '.navigation-item-drag-handle',
|
|
|
|
items: navElements,
|
|
|
|
|
|
|
|
update: function () {
|
|
|
|
var indexes = [];
|
|
|
|
navContainer.find(navElements).each(function () {
|
|
|
|
var order = Ember.$(this).data('order');
|
|
|
|
indexes.push(order);
|
|
|
|
});
|
|
|
|
controller.updateOrder(indexes);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
willDestroyElement: function () {
|
|
|
|
Ember.$('.js-settings-navigation').sortable('destroy');
|
|
|
|
}
|
|
|
|
|
2015-01-14 17:46:29 +03:00
|
|
|
});
|
2015-01-11 22:55:52 +03:00
|
|
|
|
|
|
|
export default SettingsNavigationView;
|