dorfylegends/backend/templates/entity.html

175 lines
6.9 KiB
HTML
Raw Permalink Normal View History

2022-04-16 23:12:23 +03:00
{{template "layout.html" .}}
{{define "title"}}{{ title .Name }}{{end}}
{{define "content"}}
2022-05-08 15:10:59 +03:00
<div class="page-header">
<div class="page-tabs">
2022-05-05 17:55:57 +03:00
2022-05-08 15:10:59 +03:00
<h3>{{ title .Name }}</h3>
<p>
{{ .Race }}{{ if .Necromancer}} necromancer{{end}} {{ .Type }}
{{- if .Profession }}
of {{ .Profession }}s
{{- end }}
{{- if ne .Parent -1 }}
of {{ entity .Parent }}
{{- 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>
2022-05-08 10:35:57 +03:00
2022-05-08 15:10:59 +03:00
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
{{ $active := " active"}}
{{- if gt (len .Leaders) 0 }}
2022-05-11 10:45:17 +03:00
<a class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-leaders" type="button" role="tab">Leaders</a>
2022-05-08 15:10:59 +03:00
{{ $active = ""}}{{- end}}
{{- if gt (len .Sites) 0 }}
2022-05-11 10:45:17 +03:00
<a class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-sites" type="button" role="tab">Sites</a>
2022-05-08 15:10:59 +03:00
{{ $active = ""}}{{- end}}
{{- if gt (len .HistfigId) 0 }}
2022-05-11 10:45:17 +03:00
<a class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-members" type="button" role="tab">Members</a>
2022-05-08 15:10:59 +03:00
{{ $active = ""}}{{- end}}
{{- if gt (len .Child) 0 }}
2022-05-11 10:45:17 +03:00
<a class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-children" type="button" role="tab">Groups</a>
2022-05-08 15:10:59 +03:00
{{ $active = ""}}{{- end}}
{{- if gt (len .Wars) 0 }}
2022-05-11 10:45:17 +03:00
<a class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-wars" type="button" role="tab">Wars</a>
2022-05-08 15:10:59 +03:00
{{ $active = ""}}{{- end}}
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
{{ $active := " active"}}
{{- 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>
{{ $active = ""}}{{- end}}
{{- if gt (len .Sites) 0 }}
<div class="tab-pane{{$active}}" 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>
{{ $active = ""}}{{- end}}
{{- if gt (len .HistfigId) 0 }}
<div class="tab-pane{{$active}}" 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>
{{ $active = ""}}{{- end}}
{{- if gt (len .Child) 0 }}
<div class="tab-pane{{$active}}" 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>
{{ $active = ""}}{{- end}}
{{- if gt (len .Wars) 0 }}
<div class="tab-pane{{$active}}" 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>
{{ $active = ""}}{{- end}}
</div>
2022-05-05 23:18:31 +03:00
</div>
2022-05-10 10:51:04 +03:00
{{ if world.MapReady }}
2022-05-05 17:55:57 +03:00
{{- if gt (len .Sites) 0 }}
2022-05-08 15:10:59 +03:00
<div class="page-map">
<div id="map" style="width: 300px; height: 300px"></div>
<!-- <img class="site-map" src="$suburi/sitemap/$site.id" width="300" /> -->
{{initMap}}
{{- range .Sites }}
{{ addSite . false }}
{{- end }}
2022-05-05 17:55:57 +03:00
</div>
2022-05-08 15:10:59 +03:00
{{- end }}
2022-05-10 10:51:04 +03:00
{{- end }}
2022-05-05 17:55:57 +03:00
</div>
2022-04-29 16:28:08 +03:00
2022-05-08 15:10:59 +03:00
2022-05-05 17:55:57 +03:00
<h5>Events</h5>
2022-04-18 11:36:29 +03:00
2022-04-19 18:46:11 +03:00
{{ template "events.html" events . }}
2022-04-18 11:36:29 +03:00
<p>{{ json . }}</p>
2022-04-16 23:12:23 +03:00
{{- end }}