mirror of
https://github.com/wekan/wekan.git
synced 2026-01-04 08:38:49 +01:00
Attachment rename now without filename extension
This commit is contained in:
parent
26e1c1dc4a
commit
11f8b17a05
2 changed files with 7 additions and 3 deletions
|
|
@ -90,6 +90,6 @@ template(name="attachmentActionsPopup")
|
|||
| {{_ 'attachment-move-storage-gridfs'}}
|
||||
|
||||
template(name="attachmentRenamePopup")
|
||||
input.js-edit-attachment-name(type='text' autofocus value=name dir="auto")
|
||||
input.js-edit-attachment-name(type='text' autofocus value="{{getNameWithoutExtension}}" dir="auto")
|
||||
.edit-controls.clearfix
|
||||
button.primary.confirm.js-submit-edit-attachment-name(type="submit") {{_ 'save'}}
|
||||
|
|
|
|||
|
|
@ -161,6 +161,10 @@ BlazeComponent.extendComponent({
|
|||
}).register('attachmentActionsPopup');
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
getNameWithoutExtension() {
|
||||
const ret = this.data().name.replace(new RegExp("\." + this.data().extension + "$"), "");
|
||||
return ret;
|
||||
},
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
|
|
@ -175,9 +179,9 @@ BlazeComponent.extendComponent({
|
|||
event.preventDefault();
|
||||
const name = this.$('.js-edit-attachment-name')[0]
|
||||
.value
|
||||
.trim();
|
||||
.trim() + this.data().extensionWithDot;
|
||||
Meteor.call('renameAttachment', this.data()._id, name);
|
||||
Popup.back();
|
||||
Popup.back(2);
|
||||
},
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue