Backbone notifications secondary actions

Handle secondary actions on notifications either specified as a single object,
or as a list of objects. Under the hood, the initialize method converts a single
object to a list containing a single object.
This commit is contained in:
David Baumgold
2013-06-24 13:44:48 -04:00
parent 2fadd655f4
commit 72ffe2d8f2
2 changed files with 46 additions and 2 deletions

View File

@@ -49,6 +49,11 @@ CMS.Views.SystemFeedback = Backbone.View.extend({
}
this.template = _.template(tpl);
this.setElement($("#page-"+this.options.type));
// handle single "secondary" action
if (this.options.actions && this.options.actions.secondary &&
!_.isArray(this.options.actions.secondary)) {
this.options.actions.secondary = [this.options.actions.secondary];
}
return this;
},
// public API: show() and hide()