Documents

Templates

Templates can be used to make creating documents easier.

Templates can be used to make creating documents easier.

Golang HTML templating is used. In addition to the base Golang html/template functions, the sprig template functions are available for convience.

Points to watch out when creating a template:

  • The whole template needs to be wrapped in <p> and </p>.
  • Use <br> for new lines.
A template must render out to valid HTML.

Available Variables

  • .Documents - List of documents that are in the user's clipboard.
    • .Id
    • .CreatedAt
    • .Title
    • .State
    • .CreatorId
    • .Creator - See User Info Structure.
    • .Closed - Boolean.
    • .CategoryId
    • .Category- .Name
      • .Description
  • .Users - List of citizens/ users that are in the user's clipboard.
  • .Vehicles - List of vehicles that are in the user's clipboard.
  • .ActiveChar - Author/Submitting user's info.

User Info Structure

  • .UserId
  • .Identifier
  • .Job- - Preferrably use jobLabel.
  • .JobLabel*
  • .JobGrade- - Preferrably use jobGradeLabel.
  • .JobGradeLabel*
  • .Firstname
  • .Lastname
  • .Dateofbirth - In DD.MM.YYYY format.
  • .PhoneNumber - Optional, might not always be included.

(*these fields are only available on the .activeChar variable)

Snippets

Access Creator Info

{{ .ActiveChar.Firstname }}, {{ .ActiveChar.Lastname }}

Get first Citizen

Get the first user in the list (first in the user's clipboard):

{{- $citizen := first .Users -}}

Example access citizen info:

{{ $citizen.Firstname }}, {{ $citizen.Lastname }} ({{ $citizen.Dateofbirth }})

Current Date and Time

{{ now | date "02.01.2006 15:04" }}

To learn more about different date and time formats, check out the Golang time package documentation here.

Showing a Timestamp (e.g., CreatedAt)

{{ .CreatedAt | date "02.01.2006 15:04" }}

Checkbox

<label contenteditable="false"><input type="checkbox"><span> Yes </span></label>

Examples

Displaying a list of Vehicles

{{ if not .Vehicles }}
<p>
No Vehicles involved.
</p>
{{ else }}
<ul>
{{- range .Vehicles -}}
<li>{{ .Plate }} - {{ .Owner.Firstname }}, {{ .Owner.Lastname }}</li>
{{- end -}}
</ul>
{{ end }}

FiveNet LogoCopyright © 2024 Galexrt All rights reserved.

We use cookies! 🍪

The main purpose of our cookies is to have a basic user tracking for analytical purposes.

The best way to remove this websites data is to use the clear website data function of your browser.