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