Skip to content
Snippets Groups Projects
Commit 4ef3c4fb authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#622 - usage new icon reference for showing account icons

parent 87bc20b4
Branches
Tags
No related merge requests found
......@@ -65,6 +65,11 @@ public class Icon
this.builtinIdentifier = builtinIdentifier;
}
public boolean isBuiltinIcon()
{
return image == null;
}
@Override
public boolean equals(Object o)
{
......
......@@ -38,7 +38,7 @@
<i class="fas fa-edit"></i>
</#if>
</td>
<td><#if account.getIcon()??><img src="${account.getIcon().getBase64EncodedImage()}" class="account-icon"/></#if></td>
<td><@header.entityIcon entity=account classes="account-icon"/></td>
<td>${account.getName()}</td>
<td>
<a href="<@s.url '/accounts/${account.getID()?c}/edit'/>" class="btn-flat no-padding text-default"><i class="material-icons left">edit</i></a>
......
......@@ -163,9 +163,9 @@
</#macro>
<#macro accountIcon account accountName classes="" datasetValue="">
<div class="category-circle ${classes} category-square <#if account.getIcon()?? == false>account-square-border</#if>" <#if datasetValue?has_content>data-value="${account.getID()}"</#if>>
<#if account.getIcon()??>
<img src="${account.getIcon().getBase64EncodedImage()}" class="account-select-icon"/>
<div class="category-circle ${classes} category-square <#if account.getIconReference()?? == false>account-square-border</#if>" <#if datasetValue?has_content>data-value="${account.getID()}"</#if>>
<#if account.getIconReference()??>
<@header.entityIcon entity=account classes="account-select-icon"/>
<#else>
<span class="text-blue">
${accountName?capitalize[0]}
......
......@@ -119,3 +119,13 @@
<i class="material-icons left <#if !localizationKey?has_content>no-margin</#if> ${iconClasses}">${icon}</i><#if localizationKey?has_content><span>${locale.getString(localizationKey)}</span></#if>
</a>
</#macro>
<#macro entityIcon entity classes="">
<#if entity.getIconReference()??>
<#if entity.getIconReference().isBuiltinIcon()>
<i class="${entity.getIconReference().getBuiltinIdentifier()} ${classes}"></i>
<#else>
<img src="${entity.getIconReference().getImage().getBase64EncodedImage()}" class="${classes}"/>
</#if>
</#if>
</#macro>
\ No newline at end of file
......@@ -14,6 +14,7 @@
</a>
<@header.buttonFlat url='' icon='delete' id='' localizationKey='' classes="no-padding text-default button-remove-icon-from-item" noUrl=true/>
<#-- TODO: remove first input after templates are migrated too -->
<input id="hidden-input-icon" type="hidden" name="icon" value="<#if item.getIcon()??>${item.getIcon().getID()?c}</#if>">
<input id="hidden-input-icon-image-id" type="hidden" name="iconImageID" value="<#if item.getIcon()??>${item.getIcon().getID()?c}</#if>">
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment