|
23 | 23 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"/> |
24 | 24 | <link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" crossorigin="anonymous"/> |
25 | 25 |
|
| 26 | + <style> |
| 27 | + /* Keep wide / tall stats tables (e.g. group- and curator-stats, which |
| 28 | + gain one column per group/curator) inside a viewport-bounded scroll |
| 29 | + box. Without this the table's own horizontal scrollbar sits at the |
| 30 | + bottom of the table — below the fold on a many-row page — so users |
| 31 | + scroll sideways with no scrollbar in view. overflow:auto here keeps |
| 32 | + BOTH scrollbars on screen. */ |
| 33 | + .gostats-scroll { max-height: 75vh; overflow: auto; } |
| 34 | + /* Opaque stripes so the sticky cells below can inherit a solid |
| 35 | + background and not let scrolled-under content bleed through. */ |
| 36 | + .gostats-scroll table tbody tr { background-color: #fff; } |
| 37 | + .gostats-scroll table tbody tr:nth-of-type(odd) { background-color: #f2f2f2; } |
| 38 | + /* Freeze the header row and the leading Statistic column on scroll. */ |
| 39 | + .gostats-scroll table thead th { position: sticky; top: 0; z-index: 2; background-color: #fff; } |
| 40 | + .gostats-scroll table tbody th[scope="row"] { position: sticky; left: 0; z-index: 1; background-color: inherit; } |
| 41 | + /* Only the Statistic header (first cell of the first header row) is the |
| 42 | + frozen corner; the per-entity Total/Unique subheader cells scroll. */ |
| 43 | + .gostats-scroll table thead tr:first-child th:first-child { left: 0; z-index: 3; } |
| 44 | + /* Two-level (grouped) header: the second row sticks just below the |
| 45 | + first. 2.1rem ≈ one table-sm header row; if header text wraps this |
| 46 | + can drift, but the bounded scroll box still keeps both bars on screen. */ |
| 47 | + .gostats-grouped table thead tr:nth-child(2) th { top: 2.1rem; } |
| 48 | + /* Entity (group/curator) column banding: alternate entities (ent-b) |
| 49 | + get a warm-gray tint. Row striping is preserved by combining both |
| 50 | + axes into four solid colors; cells stay opaque so the sticky header |
| 51 | + and first column keep covering scrolled-under content. The neutral |
| 52 | + ent-a columns match the default white/#f2f2f2 row stripes. */ |
| 53 | + .gostats-grouped tbody tr td.ent-a { background-color: #ffffff; } |
| 54 | + .gostats-grouped tbody tr:nth-of-type(odd) td.ent-a { background-color: #f2f2f2; } |
| 55 | + .gostats-grouped tbody tr td.ent-b { background-color: #efece8; } |
| 56 | + .gostats-grouped tbody tr:nth-of-type(odd) td.ent-b { background-color: #e4ded6; } |
| 57 | + .gostats-grouped table thead th.ent-b { background-color: #efece8; } |
| 58 | + /* Visible cell borders (Bootstrap's table-bordered border is very faint). */ |
| 59 | + .gostats-scroll table th, .gostats-scroll table td { border: 1px solid #b8c2cc; } |
| 60 | + </style> |
| 61 | + |
26 | 62 | <title>{{ title }}</title> |
27 | 63 |
|
28 | 64 | <script> |
|
36 | 72 | <div class="container-fluid"> |
37 | 73 | <h2>{{ title }}</h2> |
38 | 74 | Generated on {{ date }}<br/> |
| 75 | + {{#note}}<p class="text-muted mt-2 mb-0"><em>{{ note }}</em></p>{{/note}} |
39 | 76 | <nav class="mt-2 mb-3"> |
40 | 77 | {{ #links }} |
41 | 78 | <a href="{{ href }}" class="btn btn-outline-primary btn-sm">{{ label }}</a> |
42 | 79 | {{ /links }} |
43 | 80 | </nav> |
44 | | - <div class="table-responsive"> |
| 81 | + <div class="table-responsive gostats-scroll{{#grouped}} gostats-grouped{{/grouped}}"> |
45 | 82 | <table id="sourcestable" class="table table-sm table-striped rud-compact-table table-bordered table-hover"> |
46 | 83 | <thead> |
| 84 | + {{#grouped}} |
| 85 | + <tr> |
| 86 | + <th scope="col" rowspan="2">Statistic</th> |
| 87 | + {{ #header }} |
| 88 | + {{#href}}<th scope="col" colspan="{{ colspan }}" class="text-center {{ cls }}"><a href="{{ href }}">{{ id }}</a></th>{{/href}} |
| 89 | + {{^href}}<th scope="col" colspan="{{ colspan }}" class="text-center {{ cls }}">{{ id }}</th>{{/href}} |
| 90 | + {{ /header }} |
| 91 | + </tr> |
| 92 | + <tr> |
| 93 | + {{ #subheader }} |
| 94 | + <th scope="col" class="{{ cls }}">{{ label }}</th> |
| 95 | + {{ /subheader }} |
| 96 | + </tr> |
| 97 | + {{/grouped}} |
| 98 | + {{^grouped}} |
47 | 99 | <tr> |
48 | 100 | <th scope="col">Statistic</th> |
49 | 101 | {{ #header }} |
50 | 102 | {{#href}}<th scope="col"><a href="{{ href }}">{{ id }}</a></th>{{/href}} |
51 | 103 | {{^href}}<th scope="col">{{ id }}</th>{{/href}} |
52 | 104 | {{ /header }} |
53 | 105 | </tr> |
| 106 | + {{/grouped}} |
54 | 107 | </thead> |
55 | 108 | <tbody> |
56 | 109 | {{ #rows }} |
57 | 110 | <tr> |
58 | 111 | <th scope="row" style="white-space: nowrap;">{{ field_display }}</th> |
59 | 112 | {{ #values }} |
60 | | - <td>{{#href}}<a href="{{ href }}">{{ value }}</a>{{/href}}{{^href}}{{ value }}{{/href}}</td> |
| 113 | + <td class="{{ cls }}">{{#href}}<a href="{{ href }}">{{ value }}</a>{{/href}}{{^href}}{{ value }}{{/href}}</td> |
61 | 114 | {{ /values }} |
62 | 115 | </tr> |
63 | 116 | {{ /rows }} |
|
0 commit comments