Skip to content

Commit

Permalink
Implement ability to augment uiActions in subclass
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuhuynh committed Oct 24, 2013
1 parent 92506f9 commit 0399b6a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ElementView.subclass.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ maria.ElementView.subclass(checkit, 'TodoView', {
*/
maria.ElementView.subclass = function(namespace, name, options) {
options = options || {};
var key, superUIActions;
var template = options.template;
var templateName = options.templateName || name.replace(/(View|)$/, 'Template');
var uiActions = options.uiActions;
Expand Down Expand Up @@ -111,6 +112,16 @@ maria.ElementView.subclass = function(namespace, name, options) {
}
}
}
if (Object.prototype.hasOwnProperty.call(this.prototype, 'getUIActions') &&
typeof this.prototype.getUIActions === 'function') {
superUIActions = this.prototype.getUIActions();

for (key in superUIActions) {
if (Object.prototype.hasOwnProperty.call(superUIActions, key)) {
uiActions[key] = superUIActions[key];
}
}
}
}
maria.View.subclass.call(this, namespace, name, options);
};

0 comments on commit 0399b6a

Please sign in to comment.