From f9a10855d9c6c496038a9380993e413606c5eb5a Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Tue, 2 Jul 2013 13:23:32 -0400 Subject: [PATCH] Add notes about JS validation functions returning non-i18n error messages --- cms/static/js/models/textbook.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cms/static/js/models/textbook.js b/cms/static/js/models/textbook.js index 54bbbc2d74..104d9ae55b 100644 --- a/cms/static/js/models/textbook.js +++ b/cms/static/js/models/textbook.js @@ -57,6 +57,8 @@ CMS.Models.Textbook = Backbone.AssociatedModel.extend({ chapters: this.get('chapters').toJSON() }; }, + // NOTE: validation functions should return non-internationalized error + // messages. The messages will be passed through gettext in the template. validate: function(attrs, options) { if (!attrs.name) { return { @@ -129,6 +131,8 @@ CMS.Models.Chapter = Backbone.AssociatedModel.extend({ url: this.get('asset_path') }; }, + // NOTE: validation functions should return non-internationalized error + // messages. The messages will be passed through gettext in the template. validate: function(attrs, options) { if(!attrs.name && !attrs.asset_path) { return { @@ -169,6 +173,8 @@ CMS.Models.FileUpload = Backbone.Model.extend({ "totalBytes": 0, "finished": false }, + // NOTE: validation functions should return non-internationalized error + // messages. The messages will be passed through gettext in the template. validate: function(attrs, options) { if(attrs.selectedFile && attrs.selectedFile.type !== "application/pdf") { return {