Merge pull request #10 from ISEAL-Community/rework-module-lists

Rework the list of elements by grouping them into modules under each cluster.
This commit is contained in:
Alan Orth 2022-02-06 22:33:32 +03:00 committed by GitHub
commit bfa3634478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 113 additions and 67 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,7 @@
<nav id="navbar-navigation" class="navbar navbar-light bg-light flex-column align-items-start p-3"> <nav id="navbar-navigation" class="navbar navbar-light bg-light flex-column align-items-start p-3">
<a class="navbar-brand" href="#">Navigation</a> <a class="navbar-brand" href="#">Navigation</a>
<nav class="nav nav-pills flex-column"> <nav class="nav nav-pills flex-column">
<a class="nav-link ms-3 my-1" href="#modules">Modules</a>
<a class="nav-link ms-3 my-1" href="#metadata-elements">Metadata Elements</a> <a class="nav-link ms-3 my-1" href="#metadata-elements">Metadata Elements</a>
<a class="nav-link ms-3 my-1" href="#download">Download</a> <a class="nav-link ms-3 my-1" href="#download">Download</a>
<a class="nav-link ms-3 my-1" href="#feedback">Feedback</a> <a class="nav-link ms-3 my-1" href="#feedback">Feedback</a>
@ -27,24 +28,44 @@
<main class="col-lg-10"> <main class="col-lg-10">
<h1>FSC Schema Extension</h1> <h1>FSC Schema Extension</h1>
<p class="lead">This page provides a reference specification for the Forest Stewardship Council (FSC) schema extension.</p> <p class="lead">This page provides a reference specification for the Forest Stewardship Council (FSC) schema extension.</p>
<h2 id="metadata-elements">Metadata Elements</h2>
<p>
{{/* Note: we need to use two ranges for each cluster because it is */}}
{{/* not possible to re-use Hugo's paginate object unless you use */}}
{{/* the same exact arguments each time. */}}
<!-- TODO: note that not all terms have field names so this list is not exclusive! --> <h2 id="modules">Modules</h2>
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Fsc" }} <p>Metadata elements in FSC schema extension are organized around seven <em>modules</em>:</p>
{{- if .Params.field -}} <div class="m-3">
<a class="btn btn-sm btn-outline-primary m-1" href="#{{ .Params.slug }}">{{ .Params.field }}</a> <table class="table table-striped table-sm text-center">
{{- end -}} <tbody>
{{ end }} <tr>
</p> <td><a href="#module-Assurance">Assurance</a></td>
<td><a href="#module-Certificate">Certificate</a></td>
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Fsc" }} <td><a href="#module-Coverage">Coverage</a></td>
<div class="col"> </tr>
{{ .Render "term" }} <tr>
<td><a href="#module-Evaluation">Evaluation</a></td>
<td><a href="#module-Form">Form</a></td>
<td><a href="#module-Scope">Scope</a></td>
</tr>
<tr>
<td><a href="#module-Status">Status</a></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div> </div>
<h2 id="metadata-elements">Metadata Elements</h2>
{{/* Assign the current page context to a variable so we don't lose */}}
{{/* it in the range below. */}}
{{ $context := . }}
{{ $cluster := "Fsc" }}
{{ .Scratch.Set "cluster" $cluster }}
{{ $modules := slice "Assurance" "Certificate" "Coverage" "Evaluation" "Form" "Scope" "Status" }}
{{ range $modules }}
{{ $module := . }}
{{ $.Scratch.Set "module" $module }}
{{ partialCached "module-elements.html" $context $cluster $module }}
{{ end }} {{ end }}
<h2 id="download">Download</h2> <h2 id="download">Download</h2>

View File

@ -45,27 +45,27 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>Coverage</td> <td><a href="#module-Coverage">Coverage</a></td>
<td>Certificate</td> <td><a href="#module-Certificate">Certificate</a></td>
<td>Evaluation</td> <td><a href="#module-Evaluation">Evaluation</a></td>
</tr> </tr>
<tr> <tr>
<td>Form</td> <td><a href="#module-Form">Form</a></td>
<td>Certificate Holder, Owner or Certified organization</td> <td><a href="#module-Certificate Holder, Owner or Certified organization">Certificate Holder, Owner or Certified organization</a></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Provenance</td> <td><a href="#module-Provenance">Provenance</a></td>
<td>Certified Resource or Site</td> <td><a href="#module-Certified Resource or Site">Certified Resource or Site</a></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Scope</td> <td><a href="#module-Scope">Scope</a></td>
<td>Certifying Body</td> <td><a href="#module-Certifying Body">Certifying Body</a></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Status</td> <td><a href="#module-Status">Status</a></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
@ -83,55 +83,49 @@
<li><strong>Encoding</strong>: metadata should be encoded in UTF-8 to ensure correct representation of international characters.</li> <li><strong>Encoding</strong>: metadata should be encoded in UTF-8 to ensure correct representation of international characters.</li>
<li><strong>Applicability</strong>: metadata should describe what the item is, <em>not what it isn't</em>. If a metadata element is not applicable you should not use it. Do not enter "N/A"!</li> <li><strong>Applicability</strong>: metadata should describe what the item is, <em>not what it isn't</em>. If a metadata element is not applicable you should not use it. Do not enter "N/A"!</li>
</ul> </ul>
{{/* Assign the current page context to a variable so we don't lose */}}
{{/* it in the range below. */}}
{{ $context := . }}
<h3 id="cluster-global">Global Cluster</h3> <h3 id="cluster-global">Global Cluster</h3>
<p>
{{/* Note: we need to use two ranges for each cluster because it is */}}
{{/* not possible to re-use Hugo's paginate object unless you use */}}
{{/* the same exact arguments each time. */}}
<!-- TODO: note that not all terms have field names so this list is not exclusive! --> {{ $cluster := "Global" }}
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Global" }} {{ .Scratch.Set "cluster" $cluster }}
{{- if .Params.field -}} {{ $modules := slice "Coverage" "Form" "Provenance" "Scope" "Status" }}
<a class="btn btn-sm btn-outline-primary m-1" href="#{{ .Params.slug }}">{{ .Params.field }}</a> {{ range $modules }}
{{- end -}} {{ $module := . }}
{{ end }} {{ $.Scratch.Set "module" $module }}
</p>
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Global" }} {{/* Call the partial template to render the module's elements. */}}
<div class="col"> {{/* Note that we need to use the $cluster and the $module as */}}
{{ .Render "term" }} {{/* keys to the partial's cache so the cache is unique (so we */}}
</div> {{/* don't get FSC elements in the ISEAL layout). */}}
{{ partialCached "module-elements.html" $context $cluster $module }}
{{ end }} {{ end }}
<h3 id="cluster-certification">Certification Cluster</h3> <h3 id="cluster-certification">Certification Cluster</h3>
<p>
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Certification" }}
{{- if .Params.field -}}
<a class="btn btn-sm btn-outline-primary m-1" href="#{{ .Params.slug }}">{{ .Params.field }}</a>
{{- end -}}
{{ end }}
</p>
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Certification" }} {{ $cluster := "Certification" }}
<div class="col"> {{ .Scratch.Set "cluster" $cluster }}
{{ .Render "term" }} {{ $modules := slice "Certificate" "Certificate Holder, Owner or Certified organization" "Certified Resource or Site" "Certifying Body" }}
</div> {{ range $modules }}
{{ $module := . }}
{{ $.Scratch.Set "module" $module }}
{{ partialCached "module-elements.html" $context $cluster $module }}
{{ end }} {{ end }}
<h3 id="cluster-impact">Impact Cluster</h3> <h3 id="cluster-impact">Impact Cluster</h3>
<p>
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Impact" }}
{{- if .Params.field -}}
<a class="btn btn-sm btn-outline-primary m-1" href="#{{ .Params.slug }}">{{ .Params.field }}</a>
{{- end -}}
{{ end }}
</p>
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Impact" }} {{ $cluster := "Impact" }}
<div class="col"> {{ .Scratch.Set "cluster" $cluster }}
{{ .Render "term" }} {{ $modules := slice "Evaluation" }}
</div> {{ range $modules }}
{{ $module := . }}
{{ $.Scratch.Set "module" $module }}
{{ partialCached "module-elements.html" $context $cluster $module }}
{{ end }} {{ end }}
<h2 id="download">Download</h2> <h2 id="download">Download</h2>
<p>The ISEAL Core schema is available for download in two formats:</p> <p>The ISEAL Core schema is available for download in two formats:</p>
<div class="row mb-2 justify-content-center"> <div class="row mb-2 justify-content-center">

View File

@ -0,0 +1,31 @@
{{/* Retrieve the cluster and module from global scratch. */}}
{{ $cluster := $.Scratch.Get "cluster" }}
{{ $module := $.Scratch.Get "module" }}
{{/* Note: we need to use two ranges for each module because it is */}}
{{/* not possible to re-use Hugo's paginate object unless you use */}}
{{/* the same exact arguments each time. */}}
<h4 id="module-{{ $module }}">{{ $module }} Module</h4>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-2">Elements in the <code>{{- $module -}}</code> module:</td>
<td>
{{/* Use range over a nested where. The way to read this is */}}
{{/* from the inside out: terms, cluster, module. */}}
{{ range where (where (where site.RegularPages "Type" "terms") "Params.cluster" "==" $cluster) "Params.module" "==" $module }}
<a class="btn btn-sm btn-outline-primary m-1" href="#{{ .Params.slug }}">{{ .Params.field }}</a>
{{ end }}
</td>
</tr>
</tbody>
</table>
{{ range where (where (where site.RegularPages "Type" "terms") "Params.cluster" "==" $cluster) "Params.module" "==" $module }}
<div class="col">
{{ .Render "term" }}
</div>
{{ end }}
{{- /* vim: set ts=2 sw=2 et: */}}

View File

@ -26,6 +26,6 @@ div.badge-required {
border-top: 2px solid $primary; border-top: 2px solid $primary;
} }
h1, h2, h3 { h1, h2, h3, h4 {
color: $primary; color: $primary;
} }

View File

@ -40,7 +40,7 @@ div.badge-required {
// The ISEAL Branding Guidelines Version 3.0 say that headings should be bold // The ISEAL Branding Guidelines Version 3.0 say that headings should be bold
// weight and primary blue color. // weight and primary blue color.
h1, h2, h3 { h1, h2, h3, h4 {
color: $primary; color: $primary;
font-weight: 700; font-weight: 700;
} }