Example #1
0
//var key = require('keymaster');


module.exports = View.extend({

  stateTriggers: [
    ['page.name', function(pageName) { 
      return pageName + 'Page' === this.name;
    }]
  ],

  // register keyboard handlers
  registerKeyboardShortcuts: function () {
    /*
       var self = this;
       _.each(this.keyboardShortcuts, function (value, k) {
                               // register key handler scoped to this page
                               key(k, self.cid, _.bind(self[value], self));
                               });
                               key.setScope(this.cid);
     */
  },
  unregisterKeyboardShortcuts: function () {
  //key.deleteScope(this.cid);
  }

  // shouldUpdate: function() {
  //   return true;
  // }
});
module.exports = View.extend({

  name: 'person',

  template: templates.includes.person,

  derivedState: {
    person: ['persisted.people[]', function(p) { return p.toJS().id === this.model.id; }],
    fullName: 'person.fullName',
    avatar: 'person.avatar',
    editUrl: 'person.editUrl',
    viewUrl: 'person.viewUrl'
  },

  bindings: {
    'fullName': '[data-hook~=name]',
    'avatar': {
      type: 'attribute',
      hook: 'avatar',
      name: 'src'
    },
    'editUrl': {
      type: 'attribute',
      hook: 'action-edit',
      name: 'href'
    },
    'viewUrl': {
      type: 'attribute',
      hook: 'name',
      name: 'href'
    }
  },

  events: {
    'click [data-hook~=action-delete]': 'handleRemoveClick'
  }

  // handleRemoveClick: function () {
  //   this.model.destroy();
  //   return false;
  // }

});