emails: move to folder gray out current

This commit is contained in:
Yuri Kuznetsov
2024-10-23 09:47:35 +03:00
parent 5c8966e410
commit e236aeaf08
4 changed files with 27 additions and 1 deletions
@@ -7,7 +7,7 @@
data-action="selectFolder"
data-id="{{id}}"
data-name="{{name}}"
class="side-link text-bold"
class="side-link text-bold {{#if disabled}} disabled text-muted {{/if}}"
><span class="item-icon-container"><span class="{{iconClass}}"></span></span><span class="text-default">{{name}}</span></a>
</li>
{{/each}}
@@ -56,6 +56,12 @@ export default class extends ModalView {
};
}
/**
* @private
* @type {string|undefined}
*/
currentFolderId
setup() {
this.addActionHandler('selectFolder', (e, target) => {
const id = target.dataset.id;
@@ -68,6 +74,7 @@ export default class extends ModalView {
this.headerText = this.options.headerText || '';
this.isGroup = this.options.isGroup || false;
this.noArchive = this.options.noArchive || false;
this.currentFolderId = this.options.currentFolderId;
if (this.headerText === '') {
this.buttonList.push({
@@ -112,6 +119,7 @@ export default class extends ModalView {
const isGroup = item.id.startsWith('group:');
return {
disabled: item.id === this.currentFolderId,
id: item.id,
name: item.name,
isGroup: isGroup,
@@ -134,6 +142,7 @@ export default class extends ModalView {
id: this.FOLDER_ARCHIVE,
name: this.translate('archive', 'presetFilters', 'Email'),
iconClass: iconMap[this.FOLDER_ARCHIVE],
disabled: this.currentFolderId === this.FOLDER_ARCHIVE,
});
}
})
+13
View File
@@ -361,10 +361,23 @@ class EmailDetailRecordView extends DetailRecordView {
}
actionMoveToFolder() {
let currentFolderId = undefined;
if (!this.isInArchive() && !this.isInTrash()) {
if (this.model.attributes.groupFolderId) {
currentFolderId = 'group:' + this.model.attributes.groupFolderId;
} else if (this.model.attributes.folderId) {
currentFolderId = this.model.attributes.folderId;
}
} else if (this.isInArchive()) {
currentFolderId = 'archive';
}
this.createView('dialog', 'views/email-folder/modals/select-folder', {
headerText: this.translate('Move to Folder', 'labels', 'Email'),
isGroup: !!this.model.attributes.groupFolderId || !this.model.attributes.isUsers,
noArchive: !this.model.attributes.groupFolderId && !this.model.attributes.isUsers,
currentFolderId: currentFolderId,
}, view => {
view.render();
+4
View File
@@ -344,6 +344,7 @@ class EmailListRecordView extends ListRecordView {
headerText: this.translate('Move to Folder', 'labels', 'Email'),
isGroup: selectedFolderId && (selectedFolderId.startsWith('group:') || selectedFolderId === 'all'),
noArchive: selectedFolderId === 'all',
currentFolderId: this.rootData.selectedFolderId,
}, view => {
view.render();
@@ -531,10 +532,13 @@ class EmailListRecordView extends ListRecordView {
return;
}
const currentFolderId = this.rootData.selectedFolderId;
this.createView('dialog', 'views/email-folder/modals/select-folder', {
headerText: this.translate('Move to Folder', 'labels', 'Email'),
isGroup: !!model.attributes.groupFolderId || !model.attributes.isUsers,
noArchive: !model.attributes.groupFolderId && !model.attributes.isUsers,
currentFolderId: currentFolderId,
}, view => {
view.render();