mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 18:52:05 +03:00
42166c8d9f
- 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');
|
|
}
|
|
});
|