mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
68eb6b67b0
Closes #4540 - Implements drag & drop to reorder navigation items - Adds a `sort` property to navigation items - Adds a tiny library to enable touch events for drag & drop. It hooks onto jQuery UI. - Sort nav items before being saved - Adds `settings-view-navigation` to route for body class
30 lines
738 B
JavaScript
30 lines
738 B
JavaScript
var NavItemComponent = Ember.Component.extend({
|
|
classNames: 'navigation-item',
|
|
|
|
attributeBindings: ['order:data-order'],
|
|
order: Ember.computed.readOnly('navItem.order'),
|
|
|
|
keyPress: function (event) {
|
|
// enter key
|
|
if (event.keyCode === 13) {
|
|
event.preventDefault();
|
|
this.get('controller').send('addItem');
|
|
}
|
|
},
|
|
|
|
actions: {
|
|
addItem: function () {
|
|
this.sendAction('addItem');
|
|
},
|
|
|
|
deleteItem: function (item) {
|
|
this.sendAction('deleteItem', item);
|
|
},
|
|
|
|
updateUrl: function (value) {
|
|
this.sendAction('updateUrl', value, this.get('navItem'));
|
|
}
|
|
}
|
|
});
|
|
|
|
export default NavItemComponent;
|