0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/client/app/views/settings/navigation.js
John O'Nolan ef81feebdb Refactor blog-navigation settings screen
- Better markup
- Cleaner CSS
- Fixed icon implementation
- New grab handle icon
- Better mobile styles
2015-05-25 14:23:49 +01:00

36 lines
1 KiB
JavaScript

import Ember from 'ember';
import BaseView from 'ghost/views/settings/content-base';
var SettingsNavigationView = BaseView.extend({
didInsertElement: function () {
var navContainer = Ember.$('.js-gh-blognav'),
navElements = '.gh-blognav-item:not(.gh-blognav-item:last-child)',
self = this;
navContainer.sortable({
handle: '.gh-blognav-grab',
items: navElements,
start: function (event, ui) {
Ember.run(function () {
ui.item.data('start-index', ui.item.index());
});
},
update: function (event, ui) {
Ember.run(function () {
self.get('controller').send('moveItem', ui.item.data('start-index'), ui.item.index());
ui.item.remove();
});
}
});
},
willDestroyElement: function () {
Ember.$('.js-gh-blognav').sortable('destroy');
}
});
export default SettingsNavigationView;