mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Some missed cases where client-side lavatar was not used
This commit is contained in:
parent
f120607e4b
commit
e575c40ff3
@ -520,7 +520,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
||||
|
||||
protected _createImage(item)
|
||||
{
|
||||
let image = item.querySelector("et2-image");
|
||||
let image = item.querySelector("et2-image") || item.querySelector("[slot='prefix']");
|
||||
if(image)
|
||||
{
|
||||
image = image.clone();
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
import {Et2Select} from "./Et2Select";
|
||||
import {cleanSelectOptions, SelectOption} from "./FindSelectOptions";
|
||||
import {Et2Image} from "../Et2Image/Et2Image";
|
||||
import {SelectAccountMixin} from "./SelectAccountMixin";
|
||||
import {Et2StaticSelectMixin} from "./StaticOptions";
|
||||
import {html, nothing} from "@lion/core";
|
||||
@ -103,7 +102,7 @@ export class Et2SelectAccount extends SelectAccountMixin(Et2StaticSelectMixin(Et
|
||||
{
|
||||
return [];
|
||||
}
|
||||
let select_options : Array<SelectOption> = [...super.select_options] || [];
|
||||
let select_options : Array<SelectOption> = [...(this.static_options || []), ...super.select_options];
|
||||
|
||||
return select_options.filter((value, index, self) =>
|
||||
{
|
||||
@ -135,36 +134,6 @@ export class Et2SelectAccount extends SelectAccountMixin(Et2StaticSelectMixin(Et
|
||||
>
|
||||
</et2-lavatar>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the prefix image for tags (multiple=true)
|
||||
* The default is probably fine, but we're being explicit here.
|
||||
* @param item
|
||||
* @returns {TemplateResult<1>}
|
||||
* @protected
|
||||
*
|
||||
*/
|
||||
protected _createImage(item) : Et2Image
|
||||
{
|
||||
const image = document.createElement("et2-lavatar");
|
||||
image.contactId = item.value;
|
||||
if(item.lname)
|
||||
{
|
||||
image.lname = item.lname;
|
||||
}
|
||||
if(item.fname)
|
||||
{
|
||||
image.fname = item.fname;
|
||||
}
|
||||
|
||||
// If there's an actual image associated with the account, use that image instead of initials
|
||||
if(item.src)
|
||||
{
|
||||
image.src = item.src;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("et2-select-account", Et2SelectAccount);
|
@ -366,7 +366,7 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
||||
// Update any tags if edit mode changes
|
||||
if(changedProperties.has("editModeEnabled"))
|
||||
{
|
||||
this.shadowRoot.querySelectorAll(this.tagTag).forEach(tag => tag.editable = this.editModeEnabled);
|
||||
this.shadowRoot.querySelectorAll(".select__tags > *").forEach(tag => tag.editable = this.editModeEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ describe("Select widget", () =>
|
||||
// @ts-ignore TypeScript is not recognizing that this widget is a LitElement
|
||||
await elementUpdated(container);
|
||||
element = <Et2Select>container.getWidgetById('select');
|
||||
await element.updateComplete;
|
||||
|
||||
/** TESTING **/
|
||||
assert.isNotNull(element.querySelector("[value='option']"), "Missing static option");
|
||||
@ -82,6 +83,7 @@ describe("Select widget", () =>
|
||||
// @ts-ignore TypeScript is not recognizing that this widget is a LitElement
|
||||
await elementUpdated(container);
|
||||
element = <Et2Select>container.getWidgetById('select');
|
||||
await element.updateComplete;
|
||||
|
||||
/** TESTING **/
|
||||
assert.equal(element.querySelectorAll("sl-menu-item").length, 2);
|
||||
@ -102,6 +104,7 @@ describe("Select widget", () =>
|
||||
// @ts-ignore TypeScript is not recognizing that this widget is a LitElement
|
||||
await elementUpdated(container);
|
||||
element = <Et2Select>container.getWidgetById('select');
|
||||
await element.updateComplete;
|
||||
|
||||
/** TESTING **/
|
||||
|
||||
|
@ -303,7 +303,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
$value = array(
|
||||
'value' => substr($id, 0, 1) == $type ? $id : $type . $id,
|
||||
'label' => $title,
|
||||
'app' => lang($data['app'])
|
||||
'app' => $data['app']
|
||||
);
|
||||
if(is_array($value['label']))
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import {Et2Select} from "../../api/js/etemplate/Et2Select/Et2Select";
|
||||
import {css} from "@lion/core";
|
||||
import {css, html, nothing} from "@lion/core";
|
||||
import {IsEmail} from "../../api/js/etemplate/Validators/IsEmail";
|
||||
|
||||
/**
|
||||
@ -96,6 +96,31 @@ export class CalendarOwner extends Et2Select
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Override icon for the select option to use lavatar
|
||||
*
|
||||
* @param option
|
||||
* @protected
|
||||
*/
|
||||
protected _iconTemplate(option)
|
||||
{
|
||||
// Not a user / contact, no icon - use app image
|
||||
if(!option.fname && !option.lname && !option.icon && option.app)
|
||||
{
|
||||
return html`
|
||||
<et2-image src="${option.app}/navbar"></et2-image>`;
|
||||
}
|
||||
// lavatar uses a size property, not a CSS variable
|
||||
let style = getComputedStyle(this);
|
||||
return html`
|
||||
<et2-lavatar slot="prefix" part="icon" .size=${style.getPropertyValue("--icon-width")}
|
||||
lname=${option.lname || nothing}
|
||||
fname=${option.fname || nothing}
|
||||
image=${option.icon || nothing}
|
||||
>
|
||||
</et2-lavatar>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a free entry value is acceptable.
|
||||
* We only check the free entry, since value can be mixed.
|
||||
|
Loading…
Reference in New Issue
Block a user