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">
<a class="navbar-brand" href="#">Navigation</a>
<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="#download">Download</a>
<a class="nav-link ms-3 my-1" href="#feedback">Feedback</a>
@ -27,24 +28,44 @@
<main class="col-lg-10">
<h1>FSC Schema Extension</h1>
<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! -->
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Fsc" }}
{{- 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" "==" "Fsc" }}
<div class="col">
{{ .Render "term" }}
<h2 id="modules">Modules</h2>
<p>Metadata elements in FSC schema extension are organized around seven <em>modules</em>:</p>
<div class="m-3">
<table class="table table-striped table-sm text-center">
<tbody>
<tr>
<td><a href="#module-Assurance">Assurance</a></td>
<td><a href="#module-Certificate">Certificate</a></td>
<td><a href="#module-Coverage">Coverage</a></td>
</tr>
<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>
<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 }}
<h2 id="download">Download</h2>

View File

@ -45,27 +45,27 @@
</thead>
<tbody>
<tr>
<td>Coverage</td>
<td>Certificate</td>
<td>Evaluation</td>
<td><a href="#module-Coverage">Coverage</a></td>
<td><a href="#module-Certificate">Certificate</a></td>
<td><a href="#module-Evaluation">Evaluation</a></td>
</tr>
<tr>
<td>Form</td>
<td>Certificate Holder, Owner or Certified organization</td>
<td><a href="#module-Form">Form</a></td>
<td><a href="#module-Certificate Holder, Owner or Certified organization">Certificate Holder, Owner or Certified organization</a></td>
<td></td>
</tr>
<tr>
<td>Provenance</td>
<td>Certified Resource or Site</td>
<td><a href="#module-Provenance">Provenance</a></td>
<td><a href="#module-Certified Resource or Site">Certified Resource or Site</a></td>
<td></td>
</tr>
<tr>
<td>Scope</td>
<td>Certifying Body</td>
<td><a href="#module-Scope">Scope</a></td>
<td><a href="#module-Certifying Body">Certifying Body</a></td>
<td></td>
</tr>
<tr>
<td>Status</td>
<td><a href="#module-Status">Status</a></td>
<td></td>
<td></td>
</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>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>
{{/* 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>
<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! -->
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Global" }}
{{- if .Params.field -}}
<a class="btn btn-sm btn-outline-primary m-1" href="#{{ .Params.slug }}">{{ .Params.field }}</a>
{{- end -}}
{{ end }}
</p>
{{ $cluster := "Global" }}
{{ .Scratch.Set "cluster" $cluster }}
{{ $modules := slice "Coverage" "Form" "Provenance" "Scope" "Status" }}
{{ range $modules }}
{{ $module := . }}
{{ $.Scratch.Set "module" $module }}
{{ range where (where site.RegularPages "Type" "terms") "Params.cluster" "==" "Global" }}
<div class="col">
{{ .Render "term" }}
</div>
{{/* Call the partial template to render the module's elements. */}}
{{/* Note that we need to use the $cluster and the $module as */}}
{{/* keys to the partial's cache so the cache is unique (so we */}}
{{/* don't get FSC elements in the ISEAL layout). */}}
{{ partialCached "module-elements.html" $context $cluster $module }}
{{ end }}
<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" }}
<div class="col">
{{ .Render "term" }}
</div>
{{ $cluster := "Certification" }}
{{ .Scratch.Set "cluster" $cluster }}
{{ $modules := slice "Certificate" "Certificate Holder, Owner or Certified organization" "Certified Resource or Site" "Certifying Body" }}
{{ range $modules }}
{{ $module := . }}
{{ $.Scratch.Set "module" $module }}
{{ partialCached "module-elements.html" $context $cluster $module }}
{{ end }}
<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" }}
<div class="col">
{{ .Render "term" }}
</div>
{{ $cluster := "Impact" }}
{{ .Scratch.Set "cluster" $cluster }}
{{ $modules := slice "Evaluation" }}
{{ range $modules }}
{{ $module := . }}
{{ $.Scratch.Set "module" $module }}
{{ partialCached "module-elements.html" $context $cluster $module }}
{{ end }}
<h2 id="download">Download</h2>
<p>The ISEAL Core schema is available for download in two formats:</p>
<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;
}
h1, h2, h3 {
h1, h2, h3, h4 {
color: $primary;
}

View File

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