mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Home: Restore ability to manually add to list portlet
Now just using the properties dialog to add
This commit is contained in:
parent
a71229cd48
commit
b09c6e804f
@ -411,12 +411,23 @@ export class Et2Portlet extends Et2Widget(SlCard)
|
||||
*/
|
||||
edit_settings()
|
||||
{
|
||||
let content = this.portletProperties;
|
||||
|
||||
// Add values, but skip any lingering properties
|
||||
Object.keys(this.settings).forEach(k =>
|
||||
{
|
||||
if(typeof k == "string" && isNaN(parseInt(k)))
|
||||
{
|
||||
content[k] = this.settings[k];
|
||||
}
|
||||
});
|
||||
|
||||
let dialog = new Et2Dialog(this.egw());
|
||||
dialog.transformAttributes({
|
||||
callback: this._process_edit.bind(this),
|
||||
template: this.editTemplate,
|
||||
value: {
|
||||
content: {...this.settings, ...this.portletProperties}
|
||||
content: content
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ class home_ui
|
||||
$settings = $portlet->get_properties();
|
||||
foreach($settings as $key => $setting)
|
||||
{
|
||||
if(is_array($setting) && !array_key_exists('type', $setting))
|
||||
if(is_array($setting) && !array_key_exists('type', $setting) || is_numeric($key))
|
||||
{
|
||||
unset($settings[$key]);
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ import {Et2Portlet} from "../../api/js/etemplate/Et2Portlet/Et2Portlet";
|
||||
import {et2_createWidget} from "../../api/js/etemplate/et2_core_widget";
|
||||
import {css, html, TemplateResult} from "@lion/core";
|
||||
import shoelace from "../../api/js/etemplate/Styles/shoelace";
|
||||
import {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions";
|
||||
import {Et2Dialog} from "../../api/js/etemplate/Et2Dialog/Et2Dialog";
|
||||
|
||||
/**
|
||||
* Home portlet to show a list of entries
|
||||
@ -147,7 +149,7 @@ export class Et2PortletList extends Et2Portlet
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Not used, but delete puts link in event.data
|
||||
let link_data = event.data || false;
|
||||
|
||||
@ -158,6 +160,30 @@ export class Et2PortletList extends Et2Portlet
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of user-configurable properties
|
||||
* @returns {[{name : string, type : string, select_options? : [SelectOption]}]}
|
||||
*/
|
||||
get portletProperties() : { name : string, type : string, label : string, select_options? : SelectOption[] }[]
|
||||
{
|
||||
return [
|
||||
...super.portletProperties,
|
||||
{name: "title", type: "et2-textbox", label: "Title"},
|
||||
{name: "add", type: "et2-link-entry", label: "Add"}
|
||||
]
|
||||
}
|
||||
|
||||
_process_edit(button_id, value)
|
||||
{
|
||||
if(button_id == Et2Dialog.OK_BUTTON && value.add)
|
||||
{
|
||||
// Add in to list, remove from value or it will be saved
|
||||
value.list = [...this.settings.list, value.add];
|
||||
delete value.add;
|
||||
}
|
||||
super._process_edit(button_id, value);
|
||||
}
|
||||
|
||||
bodyTemplate() : TemplateResult
|
||||
{
|
||||
return html`
|
||||
|
Loading…
Reference in New Issue
Block a user