Improved social networks sort pages.

This commit is contained in:
Christian P. MOMON 2021-09-09 01:13:38 +02:00
parent f0405a9699
commit 6288224e49
2 changed files with 45 additions and 28 deletions

View file

@ -31,7 +31,6 @@ import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Federation; import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.Organization; import fr.devinsy.statoolinfos.core.Organization;
import fr.devinsy.statoolinfos.core.Organizations; import fr.devinsy.statoolinfos.core.Organizations;
import fr.devinsy.statoolinfos.core.SocialNetworks;
import fr.devinsy.statoolinfos.core.StatoolInfosException; import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.crawl.CrawlCache; import fr.devinsy.statoolinfos.crawl.CrawlCache;
import fr.devinsy.xidyn.XidynException; import fr.devinsy.xidyn.XidynException;
@ -60,16 +59,8 @@ public class SocialNetworksPage
logger.info("Htmlize social networks pages."); logger.info("Htmlize social networks pages.");
Organizations organizations = federation.getOrganizations().filterBySocialNetworks(); Organizations organizations = federation.getOrganizations().filterBySocialNetworks();
String page = SocialNetworksPage.htmlize("Tous", organizations); String page = SocialNetworksPage.htmlize("Réseaux sociaux", organizations);
FileUtils.write(new File(htmlizeDirectory, "socialNetworks.xhtml"), page, StandardCharsets.UTF_8); FileUtils.write(new File(htmlizeDirectory, "socialNetworks.xhtml"), page, StandardCharsets.UTF_8);
organizations = federation.getOrganizations().filterBySocialNetwork(SocialNetworks.DIASPORA);
page = SocialNetworksPage.htmlize("Disapora*", organizations);
FileUtils.write(new File(htmlizeDirectory, "socialNetworks-diaspora.xhtml"), page, StandardCharsets.UTF_8);
organizations = federation.getOrganizations().filterBySocialNetwork(SocialNetworks.MASTODON);
page = SocialNetworksPage.htmlize("Mastodon", organizations);
FileUtils.write(new File(htmlizeDirectory, "socialNetworks-mastodon.xhtml"), page, StandardCharsets.UTF_8);
} }
/** /**

View file

@ -12,17 +12,15 @@
</head> </head>
<body> <body>
<div class="center_table" style="width: 1100px;"> <div class="center_table" style="width: 1100px;">
<div style="margin: 5px;">
<a id="allFilterButton" href="socialNetworks.xhtml" class="button">Tous</a>
<a id="diasporaFilterButton" href="socialNetworks-diaspora.xhtml" class="button">Diaspora*</a>
<a id="mastodonFilterButton" href="socialNetworks-mastodon.xhtml" class="button">Mastodon</a>
</div>
<div class="center"> <div class="center">
<h2 id="title">n/a</h2> <h2 id="title">n/a</h2>
<div>Nombre de membres : <span id="organizationCount">n/a</span></div> <div>Nombre de membres : <span id="organizationCount">n/a</span></div>
</div> </div>
<div style="margin: 5px;">
<a id="allFilterButton" href="#" class="button">Tous</a>
<a id="diasporaFilterButton" href="#diaspora" class="button">Diaspora*</a>
<a id="mastodonFilterButton" href="#mastodon" class="button">Mastodon</a>
</div>
<div class="center_table" style="width: 800px;"> <div class="center_table" style="width: 800px;">
<div class="legend right" style="float: right; margin-top: -75px;"> <div class="legend right" style="float: right; margin-top: -75px;">
@ -76,18 +74,46 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$('#organizations').DataTable( $(document).ready(function()
{ {
paging: false, var table = $('#organizations').DataTable(
ordering: true, {
"order": [[ 0, "asc" ]], paging: false,
language: dataTableFrench, ordering: true,
column: "order": [[ 0, "asc" ]],
[ {},{}, language: dataTableFrench,
{ column: [ {},{}, { "bSortable": false },]
"bSortable": false });
},
] $("#allFilterButton").click(function()
{
$.fn.dataTable.ext.search.pop();
table.draw();
});
$("#diasporaFilterButton").click(function()
{
$.fn.dataTable.ext.search.pop();
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex)
{
return !table.cell(dataIndex, 2).data().includes('disabled');
}
);
table.draw();
});
$("#mastodonFilterButton").click(function()
{
$.fn.dataTable.ext.search.pop();
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex)
{
return !table.cell(dataIndex, 4).data().includes('disabled');
}
);
table.draw();
});
}); });
</script> </script>
</body> </body>