dorfylegends/backend/templates/entity.html
Robert Janetzko 185a62dcc0 more details
2022-05-06 11:11:12 +00:00

151 lines
5.0 KiB
HTML

{{template "layout.html" .}}
{{define "title"}}{{ title .Name }}{{end}}
{{define "content"}}
<h3>{{ title .Name }}</h3>
<p>
{{ .Race }}{{ if .Necromancer}} necromancer{{end}} {{ .Type }}
{{- if .Profession }}
of {{ .Profession }}s
{{- end }}
{{- if and (eq .Type "religion") (gt (len .WorshipId) 0) }}
centered around the worship of {{ hfList .WorshipId }}
{{- end }}
{{- if eq .Type "militaryunit" }}
{{- if gt (len .WorshipId) 0 }}
devoted to the worship of {{ hfList .WorshipId }}
{{- end }}
{{- if gt (len .WorshipId) 0 }}
, dedicated to the mastery of {{ andList .Weapons }}
{{- end }}
{{- end }}
</p>
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
{{- if gt (len .Leaders) 0 }}
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#nav-leaders" type="button" role="tab">Sites</button>
{{- end}}
{{- if gt (len .Sites) 0 }}
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#nav-sites" type="button" role="tab">Sites</button>
{{- end}}
{{- if gt (len .HistfigId) 0 }}
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#nav-members" type="button" role="tab">Members</button>
{{- end}}
{{- if gt (len .Child) 0 }}
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#nav-children" type="button" role="tab">Groups</button>
{{- end}}
{{- if gt (len .Wars) 0 }}
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#nav-wars" type="button" role="tab">Wars</button>
{{- end}}
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
{{- if gt (len .Leaders) 0 }}
<div class="tab-pane active" id="nav-leaders" role="tabpanel">
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th>Date</th>
<th width="100%">Name</th>
</tr>
{{- range .Leaders }}
<tr>
<td>
{{- if eq .EndYear -1 }}
since {{ .StartYear }}
{{- else }}
from {{ .StartYear }} till {{ .EndYear }}
{{- end }}
</td>
<td>
{{ hf .Hf.Id }}</td>
</tr>
{{- end}}
</table>
</div>
{{- end}}
{{- if gt (len .Sites) 0 }}
<div class="tab-pane" id="nav-sites" role="tabpanel">
<table class="table table-hover table-sm table-borderless">
<tr>
<th>Name</th>
<th width="100%">History</th>
</tr>
{{- range .Sites }}
<tr>
<td class="object" style="vertical-align: top;"> {{ site . }}</td>
<td> {{ template "events.html" events (history .) }}</td>
</tr>
{{- end}}
</table>
</div>
{{- end}}
{{- if gt (len .HistfigId) 0 }}
<div class="tab-pane" id="nav-members" role="tabpanel">
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th width="100%">Type</th>
</tr>
{{- range .HistfigId }}
<tr>
<td>{{ hf .}}</td>
</tr>
{{- end}}
</table>
</div>
{{- end}}
{{- if gt (len .Child) 0 }}
<div class="tab-pane" id="nav-children" role="tabpanel">
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th width="100%">Type</th>
</tr>
{{- range .Child }}
<tr>
<td>{{ entity .}}</td>
</tr>
{{- end}}
</table>
</div>
{{- end}}
{{- if gt (len .Wars) 0 }}
<div class="tab-pane" id="nav-wars" role="tabpanel">
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th>Year</th>
<th>Name</th>
<th width="100%">Enemy</th>
</tr>
{{- range .Wars }}
<tr>
<td>
{{- if eq .StartYear .EndYear}}
In {{ .StartYear }}
{{- else if eq .EndYear -1 }}
Since {{ .StartYear }}
{{- else }}
From {{ .StartYear }} till {{ .EndYear }}
{{- end }}
</td>
<td>{{ collection .Id}}</td>
<td>
{{- if eq $.Id .Details.AggressorEntId}}
attacking {{ entity .Details.DefenderEntId }}
{{- else }}
defending against {{ entity .Details.AggressorEntId }}
{{- end}}
</td>
</tr>
{{- end}}
</table>
</div>
{{- end}}
</div>
<h5>Events</h5>
{{ template "events.html" events . }}
<p>{{ json . }}</p>
{{- end }}