allow to use et2-vfs-mime to display mime-icon by giving the string mime-type as value

(not exposable, as no download_url)
This commit is contained in:
ralf 2024-09-16 15:47:37 +02:00
parent 43490f4eb5
commit cc72c6ff60
2 changed files with 8 additions and 4 deletions

View File

@ -79,7 +79,7 @@ export class Et2VfsMime extends Et2ImageExpose
isExposable() : boolean
{
// do not try to expose directories, they are handled by the action system
if (this.exposeValue.mime === Et2VfsMime.DIR_MIME_TYPE)
if (this.exposeValue.mime === Et2VfsMime.DIR_MIME_TYPE || !this.value.download_url)
{
return false;
}
@ -184,7 +184,11 @@ export class Et2VfsMime extends Et2ImageExpose
{
return;
}
if(typeof _value !== 'object')
if (typeof _value === 'string' && _value.indexOf('/') >= 0)
{
_value = {mime: _value};
}
else if(typeof _value !== 'object')
{
this.egw().debug("warn", "%s only has path, needs array with path & mime", this.id, _value);
// Keep going, will be 'unknown type'

View File

@ -9,8 +9,8 @@
</columns>
<rows>
<row height="30">
<et2-image align="center" src="icon" class="mimeIcon"></et2-image>
<vfs-name id="name" needed="1" class="fileName et2_fullWidth"/>
<et2-vfs-mime align="center" id="mime"></et2-vfs-mime>
<et2-vfs-name id="name" required="true" class="fileName et2_fullWidth"/>
</row>
<row>
<hrule span="all"/>