Ghost/ghost/admin/app/components/gh-navigation.js
Jason Williams feac9682d0 Update Ember to 1.13.2
- Refactor to handle deprecations including removal of
  all Views, ArrayControllers, and ItemControllers.
2015-06-24 11:47:28 -05:00

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');
}
});