mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
feac9682d0
- Refactor to handle deprecations including removal of all Views, ArrayControllers, and ItemControllers.
34 lines
937 B
JavaScript
34 lines
937 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Component.extend({
|
|
tagName: 'section',
|
|
classNames: 'gh-view',
|
|
|
|
didInsertElement: function () {
|
|
var navContainer = this.$('.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.sendAction('moveItem', ui.item.data('start-index'), ui.item.index());
|
|
});
|
|
}
|
|
});
|
|
},
|
|
|
|
willDestroyElement: function () {
|
|
this.$('.js-gh-blognav').sortable('destroy');
|
|
}
|
|
});
|