Subclass CMS.Models.SystemFeedback

To create handy WarningMessage, ErrorMessage, and ConfirmationMessage classes
This commit is contained in:
David Baumgold
2013-05-10 14:38:45 -04:00
parent 4e41c8060b
commit f5f7cf705f
3 changed files with 23 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
CMS.Models.SystemFeedback = Backbone.Model.extend({
defaults: {
"type": null, // "warning", "confirmation", "error", "announcement", "step-required"
"type": null, // "warning", "confirmation", "error", "announcement", "step-required", etc
"title": null,
"message": null,
"shown": true,
@@ -38,3 +38,21 @@ CMS.Models.SystemFeedback = Backbone.Model.extend({
this.set("shown", false);
}
});
CMS.Models.WarningMessage = CMS.Models.SystemFeedback.extend({
defaults: $.extend({}, CMS.Models.SystemFeedback.prototype.defaults, {
"type": "warning"
})
});
CMS.Models.ErrorMessage = CMS.Models.SystemFeedback.extend({
defaults: $.extend({}, CMS.Models.SystemFeedback.prototype.defaults, {
"type": "error"
})
});
CMS.Models.ConfirmationMessage = CMS.Models.SystemFeedback.extend({
defaults: $.extend({}, CMS.Models.SystemFeedback.prototype.defaults, {
"type": "confirmation"
})
});