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({
|
||||
application: Ember.inject.controller(),
|
||||
destroying: null,
|
||||
|
||||
@computed("model.automatic")
|
||||
tabs(automatic) {
|
||||
|
@ -23,27 +22,4 @@ export default Ember.Controller.extend({
|
|||
|
||||
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(),
|
||||
counts: null,
|
||||
showing: 'members',
|
||||
destroying: null,
|
||||
|
||||
@computed('showMessages', 'model.user_count', 'canManageGroup')
|
||||
tabs(showMessages, userCount, canManageGroup) {
|
||||
|
@ -92,6 +93,29 @@ export default Ember.Controller.extend({
|
|||
actions: {
|
||||
messageGroup() {
|
||||
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"
|
||||
label="groups.message"}}
|
||||
{{/if}}
|
||||
|
||||
{{#if currentUser.admin}}
|
||||
{{d-button action="destroy"
|
||||
disabled=destroying
|
||||
icon="trash"
|
||||
class='btn-danger'
|
||||
label="admin.groups.delete"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -7,14 +7,6 @@
|
|||
{{/link-to}}
|
||||
</li>
|
||||
{{/each}}
|
||||
|
||||
<li>
|
||||
{{d-button action="destroy"
|
||||
disabled=destroying
|
||||
icon="trash"
|
||||
class='btn-danger'
|
||||
label="admin.groups.delete"}}
|
||||
</li>
|
||||
{{/mobile-nav}}
|
||||
|
||||
<div class="{{if site.mobileView "" "pull-left"}} group-manage-outlet">
|
||||
|
|
Loading…
Reference in New Issue