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,
|
showDialog: false,
|
||||||
downloadQuery: '',
|
downloadQuery: '',
|
||||||
|
|
||||||
init() {
|
|
||||||
this._super(...arguments);
|
|
||||||
this.deleteAttachment = { id: '', name: '' };
|
|
||||||
},
|
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.getAttachments();
|
this.getAttachments();
|
||||||
|
@ -94,6 +89,8 @@ export default Component.extend(Modals, Notifier, {
|
||||||
let qry = '';
|
let qry = '';
|
||||||
if (this.get('session.authenticated')) {
|
if (this.get('session.authenticated')) {
|
||||||
qry = '?token=' + this.get('session.authToken');
|
qry = '?token=' + this.get('session.authToken');
|
||||||
|
} else {
|
||||||
|
qry = '?secure=' + this.get('session.secureToken');
|
||||||
}
|
}
|
||||||
this.set('downloadQuery', qry);
|
this.set('downloadQuery', qry);
|
||||||
},
|
},
|
||||||
|
@ -105,26 +102,11 @@ export default Component.extend(Modals, Notifier, {
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onShowDialog(id, name) {
|
onDelete(attachment) {
|
||||||
this.set('deleteAttachment', { id: id, name: name });
|
|
||||||
|
|
||||||
this.set('showDialog', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
onDelete() {
|
|
||||||
this.set('showDialog', false);
|
|
||||||
|
|
||||||
let attachment = this.get('deleteAttachment');
|
|
||||||
|
|
||||||
this.get('documentService').deleteAttachment(this.get('document.id'), attachment.id).then(() => {
|
this.get('documentService').deleteAttachment(this.get('document.id'), attachment.id).then(() => {
|
||||||
|
this.notifySuccess('File deleted');
|
||||||
this.getAttachments();
|
this.getAttachments();
|
||||||
this.set('deleteAttachment', {
|
|
||||||
id: "",
|
|
||||||
name: ""
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onExport() {
|
onExport() {
|
||||||
|
|
|
@ -36,9 +36,10 @@ export default Component.extend(AuthMixin, Notifier, {
|
||||||
$("#delete-space-name").removeClass("is-invalid");
|
$("#delete-space-name").removeClass("is-invalid");
|
||||||
|
|
||||||
this.get('spaceSvc').delete(this.get('space.id')).then(() => { /* jshint ignore:line */
|
this.get('spaceSvc').delete(this.get('space.id')).then(() => { /* jshint ignore:line */
|
||||||
this.get('localStorage').clearSessionItem('folder');
|
|
||||||
this.get('router').transitionTo('folders');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.get('localStorage').clearSessionItem('folder');
|
||||||
|
this.get('router').transitionTo('folders');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,8 +18,20 @@
|
||||||
{{#if canEdit}}
|
{{#if canEdit}}
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
|
{{#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
|
{{#ui/ui-toolbar-icon icon=constants.Icon.Delete color=constants.Color.Red}}
|
||||||
onClick=(action "onShowDialog" file.id file.filename)}}
|
{{#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}}
|
{{/ui/ui-toolbar}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue