UX: Move group delete button to details container.
This commit is contained in:
parent
a89d7ef851
commit
9df4f7bf8e
|
@ -2,7 +2,6 @@ import { default as computed } from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
application: Ember.inject.controller(),
|
application: Ember.inject.controller(),
|
||||||
destroying: null,
|
|
||||||
|
|
||||||
@computed("model.automatic")
|
@computed("model.automatic")
|
||||||
tabs(automatic) {
|
tabs(automatic) {
|
||||||
|
@ -23,27 +22,4 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
return defaultTabs;
|
return defaultTabs;
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
|
||||||
destroy() {
|
|
||||||
const group = this.get('model');
|
|
||||||
this.set('destroying', true);
|
|
||||||
|
|
||||||
bootbox.confirm(
|
|
||||||
I18n.t("admin.groups.delete_confirm"),
|
|
||||||
I18n.t("no_value"),
|
|
||||||
I18n.t("yes_value"),
|
|
||||||
confirmed => {
|
|
||||||
if (confirmed) {
|
|
||||||
group.destroy().then(() => {
|
|
||||||
self.transitionToRoute('groups.index');
|
|
||||||
}).catch(() => bootbox.alert(I18n.t("admin.groups.delete_failed")))
|
|
||||||
.finally(() => this.set('destroying', false));
|
|
||||||
} else {
|
|
||||||
this.set('destroying', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,7 @@ export default Ember.Controller.extend({
|
||||||
application: Ember.inject.controller(),
|
application: Ember.inject.controller(),
|
||||||
counts: null,
|
counts: null,
|
||||||
showing: 'members',
|
showing: 'members',
|
||||||
|
destroying: null,
|
||||||
|
|
||||||
@computed('showMessages', 'model.user_count', 'canManageGroup')
|
@computed('showMessages', 'model.user_count', 'canManageGroup')
|
||||||
tabs(showMessages, userCount, canManageGroup) {
|
tabs(showMessages, userCount, canManageGroup) {
|
||||||
|
@ -92,6 +93,29 @@ export default Ember.Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
messageGroup() {
|
messageGroup() {
|
||||||
this.send('createNewMessageViaParams', this.get('model.name'));
|
this.send('createNewMessageViaParams', this.get('model.name'));
|
||||||
|
},
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
const group = this.get('model');
|
||||||
|
this.set('destroying', true);
|
||||||
|
|
||||||
|
bootbox.confirm(
|
||||||
|
I18n.t("admin.groups.delete_confirm"),
|
||||||
|
I18n.t("no_value"),
|
||||||
|
I18n.t("yes_value"),
|
||||||
|
confirmed => {
|
||||||
|
if (confirmed) {
|
||||||
|
group.destroy().then(() => {
|
||||||
|
this.transitionToRoute('groups.index');
|
||||||
|
}).catch(error => {
|
||||||
|
Ember.Logger.error(error);
|
||||||
|
bootbox.alert(I18n.t("admin.groups.delete_failed"));
|
||||||
|
}).finally(() => this.set('destroying', false));
|
||||||
|
} else {
|
||||||
|
this.set('destroying', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,6 +43,14 @@
|
||||||
icon="envelope"
|
icon="envelope"
|
||||||
label="groups.message"}}
|
label="groups.message"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if currentUser.admin}}
|
||||||
|
{{d-button action="destroy"
|
||||||
|
disabled=destroying
|
||||||
|
icon="trash"
|
||||||
|
class='btn-danger'
|
||||||
|
label="admin.groups.delete"}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,6 @@
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
<li>
|
|
||||||
{{d-button action="destroy"
|
|
||||||
disabled=destroying
|
|
||||||
icon="trash"
|
|
||||||
class='btn-danger'
|
|
||||||
label="admin.groups.delete"}}
|
|
||||||
</li>
|
|
||||||
{{/mobile-nav}}
|
{{/mobile-nav}}
|
||||||
|
|
||||||
<div class="{{if site.mobileView "" "pull-left"}} group-manage-outlet">
|
<div class="{{if site.mobileView "" "pull-left"}} group-manage-outlet">
|
||||||
|
|
Loading…
Reference in New Issue