Added category logo management.

This commit is contained in:
Christian P. MOMON 2020-10-18 04:52:22 +02:00
parent 4c7e30b297
commit 3775610274
10 changed files with 45 additions and 13 deletions

View file

@ -28,6 +28,7 @@ public class Category
private String name; private String name;
private String description; private String description;
private StringList softwares; private StringList softwares;
private String logoPath;
/** /**
* Instantiates a new category. * Instantiates a new category.
@ -37,6 +38,7 @@ public class Category
this.name = name; this.name = name;
this.description = description; this.description = description;
this.softwares = new StringList(); this.softwares = new StringList();
this.logoPath = "categories/default.png";
} }
/** /**
@ -54,6 +56,7 @@ public class Category
this.name = name; this.name = name;
this.description = description; this.description = description;
this.softwares = new StringList(softwares); this.softwares = new StringList(softwares);
this.logoPath = "categories/default.png";
} }
public String getDescription() public String getDescription()
@ -61,6 +64,11 @@ public class Category
return this.description; return this.description;
} }
public String getLogoPath()
{
return this.logoPath;
}
public String getName() public String getName()
{ {
return this.name; return this.name;
@ -115,6 +123,11 @@ public class Category
this.description = description; this.description = description;
} }
public void setLogoPath(final String logoPath)
{
this.logoPath = logoPath;
}
public void setName(final String name) public void setName(final String name)
{ {
this.name = name; this.name = name;

View file

@ -59,9 +59,10 @@ public class CategoriesPage
int index = 0; int index = 0;
for (CategoryStat stat : stats) for (CategoryStat stat : stats)
{ {
data.setEscapedContent("categoryListLine", index, "categoryListLineNameLink", stat.getCategory().getName()); data.setEscapedContent("categoryListLine", index, "categoryListLineNameValue", stat.getCategory().getName());
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "href", "category-" + stat.getCategory().getTechnicalName() + ".xhtml"); data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "href", "category-" + stat.getCategory().getTechnicalName() + ".xhtml");
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "title", stat.getCategory().getDescription()); data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "title", stat.getCategory().getDescription());
data.setAttribute("categoryListLine", index, "categoryListLineNameLogo", "src", stat.getCategory().getLogoPath());
data.setEscapedContent("categoryListLine", index, "categoryListLineSoftwares", stat.getCategory().getSoftwares().sort().toStringWithFrenchCommas()); data.setEscapedContent("categoryListLine", index, "categoryListLineSoftwares", stat.getCategory().getSoftwares().sort().toStringWithFrenchCommas());
data.setContent("categoryListLine", index, "categoryListLineOrganizationCount", stat.getOrganizationCount()); data.setContent("categoryListLine", index, "categoryListLineOrganizationCount", stat.getOrganizationCount());

View file

@ -56,8 +56,9 @@ public class CategoryPage
TagDataManager data = new TagDataManager(); TagDataManager data = new TagDataManager();
data.setContent("categoryName", category.getName()); data.setAttribute("categoryLogo", "src", category.getLogoPath());
data.setContent("categoryDescription", category.getDescription()); data.setEscapedContent("categoryName", category.getName());
data.setEscapedContent("categoryDescription", category.getDescription());
data.setContent("categorySoftwares", category.getSoftwares().sort().toStringWithFrenchCommas()); data.setContent("categorySoftwares", category.getSoftwares().sort().toStringWithFrenchCommas());
data.setContent("serviceCount", services.size()); data.setContent("serviceCount", services.size());
data.setContent("serviceListView", ServiceListView.build(services.sortByName())); data.setContent("serviceListView", ServiceListView.build(services.sortByName()));

View file

@ -195,6 +195,12 @@ public class Htmlizer
StatoolInfosUtils.copyRessource(source + "circle-icons/color/tools.png", color); StatoolInfosUtils.copyRessource(source + "circle-icons/color/tools.png", color);
StatoolInfosUtils.copyRessource(source + "circle-icons/mono/tools.png", mono); StatoolInfosUtils.copyRessource(source + "circle-icons/mono/tools.png", mono);
//
File categories = new File(targetDirectory, "categories");
categories.mkdirs();
StatoolInfosUtils.copyRessource(source + "categories/default.png", categories);
} }
} }

View file

@ -62,9 +62,10 @@ public class SoftwaresPage
data.setEscapedContent("softwareListLine", index, "softwareListLineNameLink", stat.getName()); data.setEscapedContent("softwareListLine", index, "softwareListLineNameLink", stat.getName());
data.setAttribute("softwareListLine", index, "softwareListLineNameLink", "href", "software-" + stat.getTechnicalName() + ".xhtml"); data.setAttribute("softwareListLine", index, "softwareListLineNameLink", "href", "software-" + stat.getTechnicalName() + ".xhtml");
data.setEscapedContent("softwareListLine", index, "softwareListLineCategoryLink", stat.getCategory().getName()); data.setEscapedContent("softwareListLine", index, "softwareListLineCategoryName", stat.getCategory().getName());
data.setAttribute("softwareListLine", index, "softwareListLineCategoryLink", "href", "category-" + stat.getCategory().getTechnicalName() + ".xhtml"); data.setAttribute("softwareListLine", index, "softwareListLineCategoryLink", "href", "category-" + stat.getCategory().getTechnicalName() + ".xhtml");
data.setAttribute("softwareListLine", index, "softwareListLineCategoryLink", "title", stat.getCategory().getDescription()); data.setAttribute("softwareListLine", index, "softwareListLineCategoryLink", "title", stat.getCategory().getDescription());
data.setAttribute("softwareListLine", index, "softwareListLineCategoryLogo", "src", stat.getCategory().getLogoPath());
data.setEscapedContent("softwareListLine", index, "softwareListLineSoftwares", stat.getCategory().getName()); data.setEscapedContent("softwareListLine", index, "softwareListLineSoftwares", stat.getCategory().getName());
data.setContent("softwareListLine", index, "softwareListLineOrganizationCount", stat.getOrganizationCount()); data.setContent("softwareListLine", index, "softwareListLineOrganizationCount", stat.getOrganizationCount());

View file

@ -11,7 +11,7 @@
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
</head> </head>
<body> <body>
<div class="center_table" style="width: 900px;"> <div class="center_table" style="width: 1100px;">
<div class="center" > <div class="center" >
<h2>Catégories</h2> <h2>Catégories</h2>
@ -20,7 +20,7 @@
<table class="table_classic sortable left"> <table class="table_classic sortable left">
<thead> <thead>
<tr> <tr>
<th class="" style="width: 200px;">Nom de la catégorie</th> <th class="" style="width: 300px;">Nom de la catégorie</th>
<th class="">Logiciels</th> <th class="">Logiciels</th>
<th class="" style="width: 100px;">Services</th> <th class="" style="width: 100px;">Services</th>
<th class="" style="width: 100px;">Organisations</th> <th class="" style="width: 100px;">Organisations</th>
@ -30,7 +30,10 @@
<tbody> <tbody>
<tr id="categoryListLine"> <tr id="categoryListLine">
<td id="categoryListLineName" style="padding-top: 0; padding-bottom: 0;"> <td id="categoryListLineName" style="padding-top: 0; padding-bottom: 0;">
<a href="#" id="categoryListLineNameLink" title="">n/a</a> <a href="#" id="categoryListLineNameLink">
<img id="categoryListLineNameLogo" src="categories/default.png" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/>
&#160;<span id="categoryListLineNameValue">n/a</span>
</a>
</td> </td>
<td id="categoryListLineSoftwares">n/a</td> <td id="categoryListLineSoftwares">n/a</td>
<td id="categoryListLineServiceCount" class="td_number">n/a</td> <td id="categoryListLineServiceCount" class="td_number">n/a</td>

View file

@ -12,10 +12,14 @@
</head> </head>
<body> <body>
<div class="center" > <div class="center" >
<h2>Catégorie <span id="categoryName">n/a</span></h2> <div class="row center">
<div class="column">
<p id="categoryDescription">n/a</p> <img id="categoryLogo" src="categories/default.png" style="width: 100px; height: 100px;"/>
<div>Logiciels : <span id="categorySoftwares">n/a</span></div> </div>
<div class="column" style="border: 0px solid red; max-width: 400px;">
<h2 id="categoryName">n/a</h2>
</div>
</div>
<div>Nombre de services : <span id="serviceCount">n/a</span></div> <div>Nombre de services : <span id="serviceCount">n/a</span></div>
</div> </div>
<div id="serviceListView" /> <div id="serviceListView" />

View file

@ -15,7 +15,7 @@
<div style="margin: 5px;"> <div style="margin: 5px;">
<a id="" href="socialNetworks.xhtml" class="button">Tous</a> <a id="" href="socialNetworks.xhtml" class="button">Tous</a>
<a id="" href="socialNetworks-diaspora.xhtml" class="button">Diaspora</a> <a id="" href="socialNetworks-diaspora.xhtml" class="button">Diaspora*</a>
<a id="" href="socialNetworks-mastodon.xhtml" class="button">Mastodon</a> <a id="" href="socialNetworks-mastodon.xhtml" class="button">Mastodon</a>
</div> </div>

View file

@ -33,7 +33,10 @@
<a href="#" id="softwareListLineNameLink" title="">n/a</a> <a href="#" id="softwareListLineNameLink" title="">n/a</a>
</td> </td>
<td id="softwareListLineCategory" style="padding-top: 0; padding-bottom: 0;"> <td id="softwareListLineCategory" style="padding-top: 0; padding-bottom: 0;">
<a href="#" id="softwareListLineCategoryLink" title="">n/a</a> <a href="#" id="softwareListLineCategoryLink" title="">
<img id="softwareListLineCategoryLogo" src="categories/default.png" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/>
&#160;<span id="softwareListLineCategoryName">n/a</span>
</a>
</td> </td>
<td id="softwareListLineServiceCount" class="td_number">n/a</td> <td id="softwareListLineServiceCount" class="td_number">n/a</td>
<td id="softwareListLineOrganizationCount" class="td_number">n/a</td> <td id="softwareListLineOrganizationCount" class="td_number">n/a</td>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB