mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Et2Favorites: Update sidebox favorite icons when user changes default favorite
This commit is contained in:
parent
4322937ea7
commit
570edaa1e0
@ -165,6 +165,11 @@ export class Et2Favorites extends Et2DropdownButton implements et2_INextmatchHea
|
||||
}
|
||||
}
|
||||
|
||||
get preferred() : string
|
||||
{
|
||||
return this._preferred;
|
||||
}
|
||||
|
||||
_optionTemplate(option : SelectOption) : TemplateResult
|
||||
{
|
||||
let radio = html`<input type="radio" slot="prefix" name="favorite" value="${option.value}"
|
||||
@ -279,9 +284,17 @@ export class Et2Favorites extends Et2DropdownButton implements et2_INextmatchHea
|
||||
{
|
||||
options.push({value: Et2Favorites.ADD_VALUE, label: this.egw().lang('Add current')});
|
||||
}
|
||||
|
||||
this.requestUpdate("select_options");
|
||||
return options;
|
||||
}
|
||||
|
||||
public load_favorites(app)
|
||||
{
|
||||
this.__select_options = this._load_favorites(app);
|
||||
this.requestUpdate("select_options");
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the current settings as a new favorite
|
||||
*/
|
||||
@ -362,7 +375,9 @@ export class Et2Favorites extends Et2DropdownButton implements et2_INextmatchHea
|
||||
this.egw().set_preference(this.app, this.defaultPref, pref);
|
||||
this._preferred = pref;
|
||||
this.dropdownNode.hide();
|
||||
this.requestUpdate();
|
||||
this.requestUpdate("select_options");
|
||||
|
||||
this.dispatchEvent(new Event("change", {bubbles: true}));
|
||||
}
|
||||
|
||||
_handleDelete(_ev : MouseEvent)
|
||||
@ -481,5 +496,4 @@ export class Et2Favorites extends Et2DropdownButton implements et2_INextmatchHea
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore TypeScript is not recognizing that this is a LitElement
|
||||
customElements.define("et2-favorites", Et2Favorites);
|
@ -861,6 +861,23 @@ export abstract class EgwApp
|
||||
{
|
||||
self.highlight_favorite();
|
||||
});
|
||||
egw_fw.applications[this.appname].browser.baseDiv.addEventListener("change", (e) =>
|
||||
{
|
||||
if(e.target.localName == "et2-favorites")
|
||||
{
|
||||
sidebox[0].querySelectorAll("li:not([data-id='add']) > a > div:first-child").forEach(f =>
|
||||
{
|
||||
f.classList.add("sideboxstar");
|
||||
f.classList.remove('ui-icon', 'ui-heart');
|
||||
});
|
||||
const new_pref = sidebox[0].querySelector("li[data-id='" + e.target.preferred + "'] > a > div:first-child");
|
||||
if(new_pref)
|
||||
{
|
||||
new_pref.classList.add('ui-icon', 'ui-icon-heart');
|
||||
new_pref.classList.remove("sideboxstar");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -904,7 +921,6 @@ export abstract class EgwApp
|
||||
et2[i].widgetContainer.iterateOver(function(_widget)
|
||||
{
|
||||
_widget.stored_filters = _widget.load_favorites(self.appname);
|
||||
_widget.init_filters(_widget);
|
||||
}, self, Et2Favorites);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user