Fix filemanager's view no longer works

This commit is contained in:
Hadi Nategh 2022-03-11 14:22:04 +01:00
parent dd7ebad1e7
commit 3705448aff
3 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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.
*

View File

@ -800,17 +800,17 @@ export class filemanagerAPP extends EgwApp
{
button_widget = (<et2_nextmatch><unknown>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});
});
}