mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Merge pull request #5783 from kevinansfield/validation-fixes
Minor validations fixes
This commit is contained in:
commit
6cdc8be756
3 changed files with 6 additions and 0 deletions
|
@ -58,6 +58,7 @@ export default Ember.Controller.extend(SettingsSaveMixin, {
|
|||
}).readOnly(),
|
||||
|
||||
generatePassword: Ember.observer('model.isPrivate', function () {
|
||||
this.get('model.errors').remove('password');
|
||||
if (this.get('model.isPrivate') && this.get('model.isDirty')) {
|
||||
this.get('model').set('password', randomPassword());
|
||||
}
|
||||
|
|
|
@ -111,10 +111,12 @@ export default Ember.Controller.extend(PaginationMixin, SettingsMenuMixin, {
|
|||
actions: {
|
||||
newTag: function () {
|
||||
this.set('activeTag', this.store.createRecord('tag', {post_count: 0}));
|
||||
this.get('activeTag.errors').clear();
|
||||
this.send('openSettingsMenu');
|
||||
},
|
||||
|
||||
editTag: function (tag) {
|
||||
tag.validate();
|
||||
this.set('activeTag', tag);
|
||||
this.send('openSettingsMenu');
|
||||
},
|
||||
|
|
|
@ -11,6 +11,9 @@ var TagSettingsValidator = BaseValidator.create({
|
|||
} else if (name.match(/^,/)) {
|
||||
model.get('errors').add('name', 'Tag names can\'t start with commas.');
|
||||
this.invalidate();
|
||||
} else if (!validator.isLength(name, 0, 150)) {
|
||||
model.get('errors').add('name', 'Tag names cannot be longer than 150 characters.');
|
||||
this.invalidate();
|
||||
}
|
||||
},
|
||||
metaTitle: function (model) {
|
||||
|
|
Loading…
Add table
Reference in a new issue