Skip to content

Commit

Permalink
sortable table - still column sizing is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
gernotstarke committed Dec 18, 2023
1 parent 4d9bc88 commit 6fe72c3
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 38 deletions.
9 changes: 7 additions & 2 deletions docs/_includes/head/custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
<!-- load DataTable stuff for sorting the table -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.js"></script>


<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;

}

th {
Expand All @@ -36,6 +37,10 @@
background-color: #dddddd;
}

tfoot td, tfoot th {
text-align: right !important;
}

</style>

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
Expand Down
39 changes: 39 additions & 0 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
---

<!doctype html>
<!-- simplified version for status.arc42.org:
remove import of scripts.html, as the MM-scripts conflict
with DataTables
-->
<!--
Minimal Mistakes Jekyll Theme 4.24.0 by Michael Rose
Copyright 2013-2020 Michael Rose - mademistakes.com | @mmistakes
Free for personal and commercial use under the MIT license
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
-->
<html lang="{{ site.locale | slice: 0,2 | default: "en" }}" class="no-js">
<head>
{% include head.html %}
{% include head/custom.html %}
</head>

<body class="layout--{{ page.layout | default: layout.layout }}{% if page.classes or layout.classes %}{{ page.classes | default: layout.classes | join: ' ' | prepend: ' ' }}{% endif %}">
{% include_cached skip-links.html %}
{% include_cached masthead.html %}

<div class="initial-content">
{{ content }}
</div>


<div id="footer" class="page__footer">
<footer>
{% include footer/custom.html %}
{% include_cached footer.html %}
</footer>
</div>


</body>
</html>
96 changes: 66 additions & 30 deletions docs/_pages/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@ permalink: /
header:
overlay_image: /images/statistics-splash.webp
overlay_filter: rgba(0, 65, 83, 0.7)
actions:

actions:
- label: "&#8594; arc42.org"
url: "https://www.arc42.org"
- label: "&#8594; arc42-Docu"
url: "/arc42build"



de-org-canvas:
- title: "arc42.de"
excerpt: '
<iframe plausible-embed src="https://plausible.io/share/arc42.de?auth=IYzUmMI8s2PYKgggJhO7q&embed=true&theme=light" height="1600" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;" ></iframe>
- title: "arc42.de"
excerpt: '
<iframe plausible-embed src="https://plausible.io/share/arc42.de?auth=IYzUmMI8s2PYKgggJhO7q&embed=true&theme=light" height="1600" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
'
- title: "arc42.org"
excerpt: '
- title: "arc42.org"
excerpt: '
<iframe plausible-embed src="https://plausible.io/share/arc42.org?auth=tNNpNN0VqPh9xbjkaEPrx&embed=true&theme=light" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
'
- title: "canvas.arc42.org"
excerpt: '
- title: "canvas.arc42.org"
excerpt: '
<iframe plausible-embed src="https://plausible.io/share/canvas.arc42.org?auth=sAJkIzBTeFg-a5ndJenA4&embed=true&theme=light" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
'



doc-faq-quality:
- title: "docs.arc42.org"
excerpt: '
- title: "docs.arc42.org"
excerpt: '
<iframe plausible-embed src="https://plausible.io/share/docs.arc42.org?auth=D_6pSvlKkq_hTlttpTOtz&embed=true&theme=light" heigth="1600" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%;height: 1600px;"></iframe>
'
- title: "faq.arc42.org"
excerpt: '<iframe plausible-embed src="https://plausible.io/share/faq.arc42.org?auth=wc065ryr-3YNoYFluaqGh&embed=true&theme=light" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
- title: "faq.arc42.org"
excerpt: '<iframe plausible-embed src="https://plausible.io/share/faq.arc42.org?auth=wc065ryr-3YNoYFluaqGh&embed=true&theme=light" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
'
- title: "quality.arc42.org"
excerpt: '<iframe plausible-embed src="https://plausible.io/share/quality.arc42.org?auth=cjoKlapPdw3czFugGy6jM&embed=true&theme=light" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
- title: "quality.arc42.org"
excerpt: '<iframe plausible-embed src="https://plausible.io/share/quality.arc42.org?auth=cjoKlapPdw3czFugGy6jM&embed=true&theme=light" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
'

---
Expand All @@ -51,9 +51,12 @@ doc-faq-quality:
hx-target="#statsTable">
</div>


<!-- the following div will be swapped with the HTML generated by the backend API -->

<div id="statsTable">
<table border="1">
<table id="sortableStatsTable" class="display">
<thead>
<tr>
<th rowspan="2"><img src="./images/minion-logo-100px.png"></th>
<th colspan="2" style="border-left: 2px solid black;">7 Days</th>
Expand All @@ -69,15 +72,47 @@ doc-faq-quality:
<th style="border-left: 2px solid black;">Visitors</th>
<th>PageViews</th>
</tr>
</thead>
<tbody>
<tr>
<td>arc42.de</td>
<td class="cell-style">3344</td>
<td>101</td>
<td class="cell-style">3967</td>
<td>3890</td>
<td class="cell-style">9416</td>
<td>420</td>
<td class="cell-style">n/a</td>
</tr>
<tr>
<td colspan="8" > please wait for data to be loaded...</td>
</tr>
</table>
<td>docs.arc42.org</td>
<td class="cell-style">49</td>
<td>11</td>
<td class="cell-style">67</td>
<td>90</td>
<td class="cell-style">41</td>
<td>20</td>
<td class="cell-style">n/a</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>arc42.org</td>
<td class="cell-style">Sum V7Ds</td>
<td>Sum P7D</td>
<td class="cell-style">Sum V30D</td>
<td>Sum 30D</td>
<td class="cell-style">Sum V12M</td>
<td>Sum P12m</td>
<td class="cell-style"></td>
</tr>
</tfoot>
</table>

Data will be collected by arc42 statistics service running on
<a href="https://fly.io" target="_blank"><img src="/images/fly-logo-landscape.svg" width="60px"></a>
</div>
Data is beeing collected by arc42 statistics service running on
<a href="https://fly.io" target="_blank"><img src="/images/fly-logo-landscape.svg" width="60px"></a>

</div>

## Breakdown for Sites

Expand All @@ -88,8 +123,6 @@ Data will be collected by arc42 statistics service running on
* [quality.arc42.org](#doc-faq-quality)
* [canvas.arc42.org](#de-org-canvas)



<a id="de-org-canvas"/>
## German and International Site, canvas

Expand All @@ -107,13 +140,16 @@ The page was generated on {{ site.time }}.
<!-- enable table sorting -->

<script>
$(document).ready(function () {
$('#sortableStatsTable').DataTable(
{
document.body.addEventListener('htmx:load', function(event) {
if (event.target.id === 'sortableStatsTable') {
$('#sortableStatsTable').DataTable({
info:false,
searching: false,
paging: false,
ordering: true
ordering: true,
language: {"decimal": "-", "thousands": "." },
columnDefs: [{ orderable: false, targets: [7] }]
});
}
});
</script>
5 changes: 1 addition & 4 deletions go-app/internal/api/arc42statistics.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
<a href="{{.Repo}}/issues">
<img alt="GitHub open issues" src="{{.IssueBadgeURL}}">
</a>
{{if .BugBadgeURL}}
<a href="{{.Repo}}/issues">
<img alt="GitHub bugs" src="{{.BugBadgeURL}}">
</a>
{{if .BugBadgeURL}}<a href="{{.Repo}}/issues"><img alt="GitHub bugs" src="{{.BugBadgeURL}}"> </a>
{{end}}
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions go-app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"strings"
)

const AppVersion = "0.4.6a"
const AppVersion = "0.4.6b"

// version history
// 0.4.6 sortable table
// 0.4.6 sortable table (a: initial, b: better styling, no sorting on issues/bugs)
// 0.4.5 fix missing separators in large numbers
// 0.4.4 fix bad hyperlink to GitHub issues
// 0.4.3 fix #57 (local svg images for issues and badges)
Expand Down
86 changes: 86 additions & 0 deletions sandbox/sorted-table/resultsTable-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!doctype html>

<html lang="en">
<head>
<title>Sortable Table Example</title>

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.js"></script>

<style>
.border-left {
border-left: 2px solid black;
}

.border-top {
border-top: 2px solid black;
}

.text-align-left {
text-align: left;
}

thead th {
border-left: 2px solid black;
}

.gopher-logo {
content: url("images/minion-logo-100px.png");
}
</style>
</head>
<body>
<table id="statsTable" class="display">
<thead>
<tr>
<th rowspan="2"><img src="./images/minion-logo-100px.png" /></th>
<th colspan="2" style="border-left: 2px solid black;">7 Days</th>
<th colspan="2" style="border-left: 2px solid black;">30 Days</th>
<th colspan="2" style="border-left: 2px solid black;">12 Month</th>
<th rowspan="2" style="border-left: 2px solid black;">Issues</th>
</tr>
<tr>
<th style="border-left: 2px solid black;">Visitors</th>
<th>PageViews</th>
<th style="border-left: 2px solid black;">Visitors</th>
<th>PageViews</th>
<th style="border-left: 2px solid black;">Visitors</th>
<th>PageViews</th>
</tr>
</thead>
<tbody>
<tr>
<td>arc42.org</td>
<td style="border-left: 2px solid black;">v7D</td>
<td>p7d</td>
<td style="border-left: 2px solid black;">V30D</td>
<td>p30d</td>
<td style="border-left: 2px solid black;">V12m</td>
<td>p12m</td>
<td style="text-align: left;border-left: 2px solid black;">
issues
</td>
</tr> <tr>
<td>arc42.de</td>
<td style="border-left: 2px solid black;">v7D</td>
<td>p7d</td>
<td style="border-left: 2px solid black;">V30D</td>
<td>p30d</td>
<td style="border-left: 2px solid black;">V12m</td>
<td>p12m</td>
<td style="text-align: left;border-left: 2px solid black;">
issues
</td>
</tr>

</tbody>

<tfoot>

</tfoot>
</table>

</body>
</html>

0 comments on commit 6fe72c3

Please sign in to comment.