diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-10 22:21:11 -0500 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-10 22:28:54 -0500 |
commit | 32d3fa0eaea214c0c291ac6387cd4289b9cec69a (patch) | |
tree | c39cca703d08dc337e90fd9f82be84210b129765 /templates | |
parent | 76cecb24e5b959b9f8dc225d25a2b3319fb87890 (diff) |
Work on table presentation
Diffstat (limited to 'templates')
-rw-r--r-- | templates/layout.hbs | 1 | ||||
-rw-r--r-- | templates/profile.hbs | 36 |
2 files changed, 33 insertions, 4 deletions
diff --git a/templates/layout.hbs b/templates/layout.hbs index bd47622..25b558c 100644 --- a/templates/layout.hbs +++ b/templates/layout.hbs @@ -4,6 +4,7 @@ <meta charset="utf8"> <link href="/static/default.css" rel="stylesheet" type="text/css"/> <title>pj- {{ title }}</title> + {{ ~> extra_head }} </head> <body> diff --git a/templates/profile.hbs b/templates/profile.hbs index c7e75e9..a1c6ed1 100644 --- a/templates/profile.hbs +++ b/templates/profile.hbs @@ -1,20 +1,48 @@ -{{#*inline "page"~}} +{{#*inline "extra_head"}} +<style> +table { + grid-template-columns: repeat({{document.num_columns}}, auto); +} +.details { + grid-column: 1 / -1; +} +</style> +<script> +function toggleDetails(e) { + var d = e.querySelector(".details"); + var toggled = d.classList.contains("details-visible"); + if (toggled) { + d.classList.remove("details-visible"); + } else { + d.classList.add("details-visible"); + } +} +</script> +{{/inline}} +{{#*inline "page"}} {{#if user~}} <p>Profile for {{ user }}</p> {{/if~}} {{#with document ~}} <table> <thead> - {{#each headings ~}} + {{#with headings ~}} + {{#each columns ~}} <th>{{ this }}</th> {{/each ~}} + {{/with ~}} </thead> <tbody> {{#each rows ~}} - <tr> - {{#each this ~}} + <tr onclick="toggleDetails(this)"> + {{#each columns ~}} <td>{{ this }}</td> {{/each ~}} + <td class="details"> + <div> + Hello + </div> + </td> </tr> {{/each ~}} </tbody> |