mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-15 12:34:33 +01:00
Home: Fix single entry did not save correctly
This commit is contained in:
parent
e497e31ed5
commit
25207003df
@ -474,13 +474,22 @@ export class Et2Portlet extends Et2Widget(SlCard)
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep settings, but remove any properties, no need to pass those on
|
||||
let settings = {};
|
||||
Object.keys(this.settings || {}).forEach(k =>
|
||||
{
|
||||
if(typeof k == "string" && isNaN(parseInt(k)) || typeof this.settings[k].name == "undefined" && typeof this.settings[k].type == "undefined")
|
||||
{
|
||||
settings[k] = this.settings[k];
|
||||
}
|
||||
});
|
||||
// Pass updated settings, unless we're removing
|
||||
this.update_settings({...this.settings, ...value});
|
||||
this.update_settings({...settings, ...value});
|
||||
|
||||
// Extend, not replace, because settings has types while value has just value
|
||||
if(typeof value == 'object')
|
||||
{
|
||||
this.settings = {...this.settings, value};
|
||||
this.settings = {...settings, ...value};
|
||||
}
|
||||
this.requestUpdate();
|
||||
}
|
||||
@ -500,7 +509,7 @@ export class Et2Portlet extends Et2Widget(SlCard)
|
||||
{
|
||||
this[p.name] = settings[p.name];
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// Save settings - server might reply with new content if the portlet needs an update,
|
||||
// but ideally it doesn't
|
||||
|
@ -2,6 +2,7 @@ import {Et2Portlet} from "../../api/js/etemplate/Et2Portlet/Et2Portlet";
|
||||
import shoelace from "../../api/js/etemplate/Styles/shoelace";
|
||||
import {css} from "@lion/core";
|
||||
import {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions";
|
||||
import {Et2Dialog} from "../../api/js/etemplate/Et2Dialog/Et2Dialog";
|
||||
|
||||
/**
|
||||
* Home portlet to show a list of entries
|
||||
@ -29,6 +30,16 @@ export class Et2PortletLink extends Et2Portlet
|
||||
{name: "entry", type: "et2-link-entry", label: "Entry"}
|
||||
]
|
||||
}
|
||||
|
||||
_process_edit(button_id, value)
|
||||
{
|
||||
if(button_id == Et2Dialog.OK_BUTTON && value.entry && value.entry != this.settings.entry)
|
||||
{
|
||||
// Update title with new app immediately
|
||||
this.title = this.egw().lang(value.entry.app);
|
||||
}
|
||||
super._process_edit(button_id, value);
|
||||
}
|
||||
}
|
||||
|
||||
if(!customElements.get("et2-portlet-link"))
|
||||
|
Loading…
Reference in New Issue
Block a user