Merge pull request #464 from ZogStriP/fix-issues-when-a-failure-happen-while-creating-a-new-category

displays a message when a failure happen while creating a new category
This commit is contained in:
Robin Ward
2013-03-17 04:47:44 -07:00
5 changed files with 10 additions and 3 deletions
@@ -1,7 +1,7 @@
<div class="modal-body">
<form>
<label>{{i18n category.name}}</label>
{{view Discourse.TextField valueBinding="view.category.name" placeholderKey="category.name_placeholder"}}
{{view Discourse.TextField valueBinding="view.category.name" placeholderKey="category.name_placeholder" maxlength="50"}}
<div class='description-controls' style="margin-bottom: 20px">
<label>{{i18n category.description}}</label>
@@ -67,7 +67,12 @@ Discourse.EditCategoryView = Discourse.ModalBodyView.extend({
_this.saveSuccess(result);
},
error: function(errors) {
// displays a generic error message when none is sent from the server
// this might happen when some "after" callbacks throws an exception server-side
if(errors.length === 0) errors.push(Em.String.i18n("category.creation_error"));
// display the errors
_this.displayErrors(errors);
// not saving anymore
_this.set('saving', false);
}
});