mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Disable save button when new group form is empty.
https://meta.discourse.org/t/adding-owners-members-ux-is-inconsistent-and-misleading/58084/26?u=tgxworld
This commit is contained in:
@@ -4,13 +4,18 @@ import InputValidation from 'discourse/models/input-validation';
|
||||
import debounce from 'discourse/lib/debounce';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
saving: null,
|
||||
disableSave: null,
|
||||
nameInput: null,
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
const name = this.get('model.name');
|
||||
if (name) this.set("nameInput", name);
|
||||
|
||||
if (name) {
|
||||
this.set("nameInput", name);
|
||||
} else {
|
||||
this.set('disableSave', true);
|
||||
}
|
||||
},
|
||||
|
||||
@computed('basicNameValidation', 'uniqueNameValidation')
|
||||
@@ -58,7 +63,7 @@ export default Ember.Component.extend({
|
||||
reason: I18n.t('admin.groups.new.name.available')
|
||||
}));
|
||||
|
||||
this.set('saving', false);
|
||||
this.set('disableSave', false);
|
||||
this.set('model.name', this.get('nameInput'));
|
||||
} else {
|
||||
let reason;
|
||||
@@ -75,7 +80,7 @@ export default Ember.Component.extend({
|
||||
}, 500),
|
||||
|
||||
_failedInputValidation(reason) {
|
||||
this.set('saving', true);
|
||||
this.set('disableSave', true);
|
||||
|
||||
const options = { failed: true };
|
||||
if (reason) options.reason = reason;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<form class="groups-form form-vertical">
|
||||
{{groups-form-profile-fields model=model saving=saving}}
|
||||
{{groups-form-profile-fields model=model disableSave=saving}}
|
||||
{{group-manage-save-button model=model saving=saving}}
|
||||
</form>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<hr/>
|
||||
|
||||
<form class="groups-form form-vertical">
|
||||
{{#groups-form-profile-fields model=model saving=saving}}
|
||||
{{#groups-form-profile-fields model=model disableSave=saving}}
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="owner-selector">{{i18n 'admin.groups.add_owners'}}</label>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user