Improved category logo management.

This commit is contained in:
Christian P. MOMON 2020-10-18 05:17:45 +02:00
parent 3775610274
commit 7ac3a80631
3 changed files with 24 additions and 4 deletions

View file

@ -18,6 +18,8 @@
*/
package fr.devinsy.statoolinfos.core;
import org.apache.commons.lang3.StringUtils;
import fr.devinsy.strings.StringList;
/**
@ -25,6 +27,8 @@ import fr.devinsy.strings.StringList;
*/
public class Category
{
public static final String DEFAULT_LOGO_PATH = "categories/default.png";
private String name;
private String description;
private StringList softwares;
@ -38,7 +42,7 @@ public class Category
this.name = name;
this.description = description;
this.softwares = new StringList();
this.logoPath = "categories/default.png";
this.logoPath = DEFAULT_LOGO_PATH;
}
/**
@ -56,7 +60,7 @@ public class Category
this.name = name;
this.description = description;
this.softwares = new StringList(softwares);
this.logoPath = "categories/default.png";
this.logoPath = DEFAULT_LOGO_PATH;
}
public String getDescription()
@ -123,9 +127,22 @@ public class Category
this.description = description;
}
/**
* Sets the logo path.
*
* @param logoPath
* the new logo path
*/
public void setLogoPath(final String logoPath)
{
this.logoPath = logoPath;
if (StringUtils.isBlank(logoPath))
{
this.logoPath = DEFAULT_LOGO_PATH;
}
else
{
this.logoPath = logoPath;
}
}
public void setName(final String name)

View file

@ -70,6 +70,7 @@ public class Factory
String name = properties.get(prefix + ".name");
String description = properties.get(prefix + ".description");
String softwares = properties.get(prefix + ".softwares");
String logoPath = properties.get(prefix + ".logoPath");
StringList softwareList = new StringList();
if (StringUtils.isNotBlank(softwares))
@ -81,6 +82,7 @@ public class Factory
}
Category category = new Category(name, description, softwareList);
category.setLogoPath(logoPath);
result.add(category);
}

View file

@ -17,7 +17,8 @@
<img id="categoryLogo" src="categories/default.png" style="width: 100px; height: 100px;"/>
</div>
<div class="column" style="border: 0px solid red; max-width: 400px;">
<h2 id="categoryName">n/a</h2>
<div id="categoryName" class="content_title">n/a</div>
<div class="content_subtitle"><a id="categoryDescription" href="#" style="text-decoration: none;">URL n/a</a></div>
</div>
</div>
<div>Nombre de services : <span id="serviceCount">n/a</span></div>