fix icon in et2-vfs-path and also get it to display "/" for the root

This commit is contained in:
ralf 2024-09-17 10:49:03 +02:00
parent e184d5bdcd
commit eb14eef3df
3 changed files with 39 additions and 4 deletions

View File

@ -261,10 +261,14 @@ export class Et2VfsPath extends Et2InputWidget(LitElement)
protected _getIcon(pathParts)
{
let image = this.egw().image("filemanager", "api");
let image = this.egw().image("navbar", "filemanager");
if(pathParts.length > 2 && pathParts[1] == "apps")
{
image = this.egw().image('navbar', pathParts[2].toLowerCase());
const app = this.egw().app(pathParts[2], 'name') || this.egw().appByTitle(pathParts[2], 'name');
if (app && !(image = this.egw().image('navbar', app)))
{
image = this.egw().image('navbar', 'api');
}
}
return image;
@ -290,6 +294,11 @@ export class Et2VfsPath extends Et2InputWidget(LitElement)
}
}
}
// we want / aka pathParts [''] to be displayed as /, therefore we need to add another '' to it
else if (pathParts.length === 1)
{
pathParts.unshift('');
}
return html`
<sl-breadcrumb-item class="vfs-path__directory" data-value="${path.trim()}">
${pathName}
@ -347,7 +356,7 @@ export class Et2VfsPath extends Et2InputWidget(LitElement)
>
<slot part="prefix" name="prefix">
${icon ? html`
<et2-image src="${icon}" slot="prefix"
<et2-image src="${icon}" slot="prefix" height="1.5em"
@click=${(e) =>
{
this.setValue("/");

View File

@ -571,6 +571,14 @@ declare interface IegwGlobal
*/
app(_app : string, _name : string) : string|undefined;
app(_app : string) : Iapplication|undefined;
/**
* Same as app(), but use the translated app-name / title
*
* @param {string} _title
* @param {string} _name attribute to return, default return whole app-data-object
*/
appByTitle(_title : string, _name : string) : string|undefined;
appByTitle(_title : string) : Iapplication|undefined;
/**
* Get a list of accounts the user has access to
* The list is filtered by type, one of 'accounts','groups','both', 'owngroups'

View File

@ -87,6 +87,24 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
userData.apps[_app] : userData.apps[_app][_name];
},
/**
* Same as app(), but use the translated app-name / title
*
* @param {string} _title
* @param {string} _name attribute to return, default return whole app-data-object
*/
appByTitle: function(_title, _name)
{
for(const app in userData.apps)
{
if (userData.apps[app].title === _title)
{
return typeof _name == 'undefined' || typeof userData.apps[app] == 'undefined' ?
userData.apps[app] : userData.apps[app][_name];
}
}
},
/**
* Get a list of accounts the user has access to
* The list is filtered by type, one of 'accounts','groups','both', 'owngroups'