mirror of
https://github.com/documize/community.git
synced 2025-07-19 21:29:42 +02:00
Change attachment deletion confirmation from modal to popover
This commit is contained in:
parent
d281621d90
commit
1ef209b74f
3 changed files with 21 additions and 26 deletions
|
@ -29,11 +29,6 @@ export default Component.extend(Modals, Notifier, {
|
|||
showDialog: false,
|
||||
downloadQuery: '',
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.deleteAttachment = { id: '', name: '' };
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
this.getAttachments();
|
||||
|
@ -94,6 +89,8 @@ export default Component.extend(Modals, Notifier, {
|
|||
let qry = '';
|
||||
if (this.get('session.authenticated')) {
|
||||
qry = '?token=' + this.get('session.authToken');
|
||||
} else {
|
||||
qry = '?secure=' + this.get('session.secureToken');
|
||||
}
|
||||
this.set('downloadQuery', qry);
|
||||
},
|
||||
|
@ -105,26 +102,11 @@ export default Component.extend(Modals, Notifier, {
|
|||
},
|
||||
|
||||
actions: {
|
||||
onShowDialog(id, name) {
|
||||
this.set('deleteAttachment', { id: id, name: name });
|
||||
|
||||
this.set('showDialog', true);
|
||||
},
|
||||
|
||||
onDelete() {
|
||||
this.set('showDialog', false);
|
||||
|
||||
let attachment = this.get('deleteAttachment');
|
||||
|
||||
onDelete(attachment) {
|
||||
this.get('documentService').deleteAttachment(this.get('document.id'), attachment.id).then(() => {
|
||||
this.notifySuccess('File deleted');
|
||||
this.getAttachments();
|
||||
this.set('deleteAttachment', {
|
||||
id: "",
|
||||
name: ""
|
||||
});
|
||||
});
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
onExport() {
|
||||
|
|
|
@ -36,9 +36,10 @@ export default Component.extend(AuthMixin, Notifier, {
|
|||
$("#delete-space-name").removeClass("is-invalid");
|
||||
|
||||
this.get('spaceSvc').delete(this.get('space.id')).then(() => { /* jshint ignore:line */
|
||||
});
|
||||
|
||||
this.get('localStorage').clearSessionItem('folder');
|
||||
this.get('router').transitionTo('folders');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,8 +18,20 @@
|
|||
{{#if canEdit}}
|
||||
<div class="menu">
|
||||
{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
|
||||
{{ui/ui-toolbar-icon icon=constants.Icon.Delete color=constants.Color.Red
|
||||
onClick=(action "onShowDialog" file.id file.filename)}}
|
||||
{{#ui/ui-toolbar-icon icon=constants.Icon.Delete color=constants.Color.Red}}
|
||||
{{#attach-popover class="ember-attacher-popper" hideOn="escapekey, clickout" showOn="click" isShown=false}}
|
||||
<div class="form">
|
||||
<p>Are you sure you want to delete this file?</p>
|
||||
{{ui/ui-spacer size=100}}
|
||||
{{ui/ui-button
|
||||
light=false
|
||||
label=constants.Label.Delete
|
||||
color=constants.Color.Red
|
||||
onClick=(action "onDelete" file)}}
|
||||
</div>
|
||||
{{/attach-popover}}
|
||||
{{/ui/ui-toolbar-icon}}
|
||||
|
||||
{{/ui/ui-toolbar}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue