show app-icon and translated name for /(apps|templates)/$app

This commit is contained in:
ralf 2024-12-20 11:05:48 +01:00
parent a6dfa98280
commit 946b0a5e43
5 changed files with 19 additions and 4 deletions

View File

@ -262,7 +262,7 @@ export class Et2VfsPath extends Et2InputWidget(LitElement)
protected _getIcon(pathParts)
{
let image = this.egw().image("navbar", "filemanager");
if(pathParts.length > 2 && pathParts[1] == "apps")
if(pathParts.length > 2 && (pathParts[1] == "apps" || pathParts[1] == "templates"))
{
const app = this.egw().app(pathParts[2], 'name') || this.egw().appByTitle(pathParts[2], 'name');
if (app && !(image = this.egw().image('navbar', app)))
@ -277,18 +277,18 @@ export class Et2VfsPath extends Et2InputWidget(LitElement)
protected pathPartTemplate(pathParts, path, index)
{
let pathName : string | TemplateResult<1> = path.trim();
if(pathParts.length > 1 && pathParts[1] == "apps")
if(pathParts.length > 1 && (pathParts[1] == "apps" || pathParts[1] == "templates"))
{
switch(index)
{
case 1:
pathName = this.egw().lang("applications");
pathName = this.egw().lang(pathParts[1] == "apps" ? "Applications" : "Templates");
break;
case 2:
pathName = this.egw().lang(pathName);
break;
case 3:
if(!isNaN(<number><unknown>pathName))
if(!isNaN(<number><unknown>pathName) && pathParts[1] !== "templates")
{
pathName = html`${until(this.egw().link_title(pathParts[2], pathParts[3], true) || pathName, pathName)}`
}

View File

@ -151,6 +151,10 @@ export class et2_vfs extends et2_valueWidget implements et2_IDetachedDOM
break;
}
}
else if (sub_path === '/templates' && path_parts.length === 1)
{
text = this.egw().lang(path_parts[0]);
}
let self = this;
var data = {path: path, type: i < path_parts.length-1 ? et2_vfs.DIR_MIME_TYPE : _value.mime };
var node = jQuery(document.createElement("li"))

View File

@ -162,6 +162,15 @@ egw.extend('images', egw.MODULE_GLOBAL, function()
if (!_mime) _mime = 'unknown';
if (_mime == 'httpd/unix-directory') _mime = 'directory';
if (typeof _path == 'string' && _mime === 'directory')
{
const path_parts = _path.split('/');
if (path_parts.length === 3 && (path_parts[1] === 'apps' || path_parts[1] === 'templates'))
{
_mime = 'egw/'+path_parts[2];
}
}
var type = _mime.toLowerCase().split('/');
var image = type[0] == 'egw' ? this.image('navbar',type[1]) : undefined;

View File

@ -1378,6 +1378,7 @@ tanzania, united republic of common de TANZANIA, VEREINIGTE REPUBLIK
template common de Template
template deleted common de Template gelöscht.
template saved common de Template gespeichert.
templates common de Vorlagen
text common de Textfeld
text color: common de Textfarbe:
textarea common de Mehrzeiliges Textfeld

View File

@ -1378,6 +1378,7 @@ tanzania, united republic of common en TANZANIA, UNITED REPUBLIC OF
template common en Template
template deleted common en Template deleted.
template saved common en Template saved.
templates common en Templates
text common en Text
text color: common en Text colour:
textarea common en Text area