From 3705448affb9a76c5364509df444eccb68deda76 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 11 Mar 2022 14:22:04 +0100 Subject: [PATCH] Fix filemanager's view no longer works --- api/js/etemplate/Et2Button/Et2Button.ts | 5 +++++ api/js/etemplate/Et2Widget/Et2Widget.ts | 12 ++++++++++++ filemanager/js/filemanager.ts | 8 ++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/api/js/etemplate/Et2Button/Et2Button.ts b/api/js/etemplate/Et2Button/Et2Button.ts index aabecf37ec..da958b1962 100644 --- a/api/js/etemplate/Et2Button/Et2Button.ts +++ b/api/js/etemplate/Et2Button/Et2Button.ts @@ -137,6 +137,11 @@ export class Et2Button extends Et2InputWidget(SlotMixin(LionButton)) this.requestUpdate("image", oldValue); } + get image () + { + return this._image; + } + _handleClick(event : MouseEvent) : boolean { // ignore click on readonly button diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 4ee5b3ffc9..bad4f387bf 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -273,6 +273,18 @@ const Et2WidgetMixin = (superClass) => } } + /** + * supports legacy set_statustext + * @param value + */ + set_statustext(value : string) + { + let oldValue = this.statustext; + this.statustext = value; + this.egw().tooltipBind(this, this.statustext); + this.requestUpdate("statustext", oldValue); + } + /** * Wrapper on this.disabled because legacy had it. * diff --git a/filemanager/js/filemanager.ts b/filemanager/js/filemanager.ts index 37b5d5d132..3abffd069f 100644 --- a/filemanager/js/filemanager.ts +++ b/filemanager/js/filemanager.ts @@ -800,17 +800,17 @@ export class filemanagerAPP extends EgwApp { button_widget = (nm).getWidgetById('button[change_view]'); } - if(button_widget && button_widget.instanceOf(et2_button)) + if(button_widget && button_widget.type === "buttononly") { // Switch view based on button icon, since controller can get re-created if(typeof view != 'string') { - view = button_widget.options.image.replace('list_',''); + view = button_widget.image.split('list_')[1].replace('.svg',''); } // Toggle button icon to the other view //todo: nm.controller needs to be changed to nm.getController after merging typescript branch into master - button_widget.set_image("list_"+(view == et2_nextmatch_controller.VIEW_ROW ? et2_nextmatch_controller.VIEW_TILE : et2_nextmatch_controller.VIEW_ROW)); + button_widget.image = ("list_"+(view == et2_nextmatch_controller.VIEW_ROW ? et2_nextmatch_controller.VIEW_TILE : et2_nextmatch_controller.VIEW_ROW)); button_widget.set_statustext(view == et2_nextmatch_controller.VIEW_ROW ? this.egw.lang("Tile view") : this.egw.lang('List view')); } @@ -827,7 +827,7 @@ export class filemanagerAPP extends EgwApp template = nm.getWidgetById(template); if(template && template.loading) { - template.loading.done(function() { + template.loading.then(function() { nm.applyFilters({view: view}); }); }