2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2015-01-18 00:16:54 +00:00
|
|
|
var NavItemComponent = Ember.Component.extend({
|
2015-05-25 14:17:14 +01:00
|
|
|
classNames: 'gh-blognav-item',
|
2015-01-18 00:16:54 +00:00
|
|
|
|
2015-02-03 16:29:01 +00:00
|
|
|
attributeBindings: ['order:data-order'],
|
|
|
|
order: Ember.computed.readOnly('navItem.order'),
|
|
|
|
|
2015-01-18 00:16:54 +00:00
|
|
|
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;
|