layout detail maps

This commit is contained in:
Robert Janetzko 2022-05-08 12:10:59 +00:00
parent bb46a77b21
commit 3b15a952ac
7 changed files with 249 additions and 218 deletions

View File

@ -8,9 +8,24 @@ a {
outline: 0; outline: 0;
} }
.page-header {
display: flex;
width: 100%;
}
.page-tabs {
flex: 100%;
margin-right: 16px;
}
.page-map {
flex: 300px;
}
.object-map { .object-map {
float: right !important; float: right !important;
margin-top: -7px; margin-left: 16px;
margin-bottom: 16px;
} }
.popover { .popover {

View File

@ -3,162 +3,170 @@
{{define "title"}}{{ title .Name }}{{end}} {{define "title"}}{{ title .Name }}{{end}}
{{define "content"}} {{define "content"}}
<h3>{{ title .Name }}</h3> <div class="page-header">
<p> <div class="page-tabs">
{{ .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>
{{- if gt (len .Sites) 0 }} <h3>{{ title .Name }}</h3>
<div class="object-map"> <p>
<div id="map" style="width: 300px; height: 300px"></div> {{ .Race }}{{ if .Necromancer}} necromancer{{end}} {{ .Type }}
<!-- <img class="site-map" src="$suburi/sitemap/$site.id" width="300" /> --> {{- if .Profession }}
</div> of {{ .Profession }}s
{{initMap}} {{- end }}
{{- range .Sites }} {{- if ne .Parent -1 }}
{{ addSite . false }} of {{ entity .Parent }}
{{- end }} {{- end }}
{{- 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> <nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist"> <div class="nav nav-tabs" id="nav-tab" role="tablist">
{{ $active := " active"}} {{ $active := " active"}}
{{- if gt (len .Leaders) 0 }} {{- if gt (len .Leaders) 0 }}
<button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-leaders" type="button" role="tab">Leaders</button> <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-leaders" type="button"
{{ $active = ""}}{{- end}} role="tab">Leaders</button>
{{- if gt (len .Sites) 0 }} {{ $active = ""}}{{- end}}
<button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-sites" type="button" role="tab">Sites</button> {{- if gt (len .Sites) 0 }}
{{ $active = ""}}{{- end}} <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-sites" type="button" role="tab">Sites</button>
{{- if gt (len .HistfigId) 0 }} {{ $active = ""}}{{- end}}
<button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-members" type="button" role="tab">Members</button> {{- if gt (len .HistfigId) 0 }}
{{ $active = ""}}{{- end}} <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-members" type="button"
{{- if gt (len .Child) 0 }} role="tab">Members</button>
<button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-children" type="button" role="tab">Groups</button> {{ $active = ""}}{{- end}}
{{ $active = ""}}{{- end}} {{- if gt (len .Child) 0 }}
{{- if gt (len .Wars) 0 }} <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-children" type="button"
<button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-wars" type="button" role="tab">Wars</button> role="tab">Groups</button>
{{ $active = ""}}{{- end}} {{ $active = ""}}{{- end}}
</div> {{- if gt (len .Wars) 0 }}
</nav> <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-wars" type="button" role="tab">Wars</button>
<div class="tab-content" id="nav-tabContent"> {{ $active = ""}}{{- end}}
{{ $active := " active"}} </div>
{{- if gt (len .Leaders) 0 }} </nav>
<div class="tab-pane{{$active}}" id="nav-leaders" role="tabpanel"> <div class="tab-content" id="nav-tabContent">
<table class="table table-hover table-sm table-borderless object-table"> {{ $active := " active"}}
<tr> {{- if gt (len .Leaders) 0 }}
<th>Date</th> <div class="tab-pane{{$active}}" id="nav-leaders" role="tabpanel">
<th width="100%">Name</th> <table class="table table-hover table-sm table-borderless object-table">
</tr> <tr>
{{- range .Leaders }} <th>Date</th>
<tr> <th width="100%">Name</th>
<td> </tr>
{{- if eq .EndYear -1 }} {{- range .Leaders }}
since {{ .StartYear }} <tr>
{{- else }} <td>
from {{ .StartYear }} till {{ .EndYear }} {{- if eq .EndYear -1 }}
{{- end }} since {{ .StartYear }}
</td> {{- else }}
<td> from {{ .StartYear }} till {{ .EndYear }}
{{ hf .Hf.Id }}</td> {{- end }}
</tr> </td>
{{- end}} <td>
</table> {{ hf .Hf.Id }}</td>
</div> </tr>
{{ $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}} {{- end}}
</td> </table>
</tr> </div>
{{- end}} {{ $active = ""}}{{- end}}
</table> {{- 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>
</div> </div>
{{ $active = ""}}{{- end}} {{- if gt (len .Sites) 0 }}
<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 }}
</div>
{{- end }}
</div> </div>
<h5>Events</h5> <h5>Events</h5>
{{ template "events.html" events . }} {{ template "events.html" events . }}

View File

@ -3,9 +3,6 @@
{{define "title"}}{{ title .Name }}{{end}} {{define "title"}}{{ title .Name }}{{end}}
{{define "content"}} {{define "content"}}
<h1>{{ title .Name }}</h1>
<p>landmass</p>
<div class="object-map"> <div class="object-map">
<div id="map" style="width: 300px; height: 300px"></div> <div id="map" style="width: 300px; height: 300px"></div>
</div> </div>
@ -13,5 +10,8 @@
{{ addLandmass .Id }} {{ addLandmass .Id }}
<script>map.addLayer(landmassesLayer);</script> <script>map.addLayer(landmassesLayer);</script>
<h1>{{ title .Name }}</h1>
<p>landmass</p>
<p>{{ json . }}</p> <p>{{ json . }}</p>
{{- end }} {{- end }}

View File

@ -3,15 +3,15 @@
{{define "title"}}{{ title .Name }}{{end}} {{define "title"}}{{ title .Name }}{{end}}
{{define "content"}} {{define "content"}}
<h3>{{ title .Name }}</h3>
<p>{{ if .IsVolcano }}volcano{{else}}mountain{{end}}</p>
<div class="object-map"> <div class="object-map">
<div id="map" style="width: 300px; height: 300px"></div> <div id="map" style="width: 300px; height: 300px"></div>
</div> </div>
{{initMap}} {{initMap}}
{{ addMountain .Id false }} {{ addMountain .Id false }}
<h3>{{ title .Name }}</h3>
<p>{{ if .IsVolcano }}volcano{{else}}mountain{{end}}</p>
<dl class="row"> <dl class="row">
<dt class="col-2 col-lg-1">Height</dt> <dt class="col-2 col-lg-1">Height</dt>
<dd class="col-10 col-lg-11">{{ .Height }}</dd> <dd class="col-10 col-lg-11">{{ .Height }}</dd>

View File

@ -3,64 +3,72 @@
{{define "title"}}{{ title .Name }}{{end}} {{define "title"}}{{ title .Name }}{{end}}
{{define "content"}} {{define "content"}}
<h3>{{ title .Name }}</h3> <div class="page-header">
<p>{{ .Type_ }}</p> <div class="page-tabs">
<h3>{{ title .Name }}</h3>
<p>{{ .Type_ }}</p>
<div class="object-map"> <nav>
<div id="map" style="width: 300px; height: 300px"></div> <div class="nav nav-tabs" id="nav-tab" role="tablist">
<!-- <img class="site-map" src="$suburi/sitemap/$site.id" width="300" /> --> {{ $active := " active"}}
</div> {{- if gt (len .Structures) 0 }}
{{initMap}} <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-structures" type="button"
{{ addSite .Id false }} role="tab">Structures</button>
{{ $active = ""}}{{- end}}
<nav> {{- if gt (len .SiteProperties) 0 }}
<div class="nav nav-tabs" id="nav-tab" role="tablist"> <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-site-properties" type="button"
{{ $active := " active"}} role="tab">Properties</button>
{{- if gt (len .Structures) 0 }} {{ $active = ""}}{{- end}}
<button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-structures" type="button" <button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-history" type="button"
role="tab">Structures</button> role="tab">History</button>
{{ $active = ""}}{{- end}} </div>
{{- if gt (len .SiteProperties) 0 }} </nav>
<button class="nav-link{{$active}}" data-bs-toggle="tab" data-bs-target="#nav-site-properties" type="button" <div class="tab-content" id="nav-tabContent">
role="tab">Properties</button> {{ $active := " active"}}
{{ $active = ""}}{{- end}} {{- if gt (len .Structures) 0 }}
<div class="tab-pane{{$active}}" id="nav-structures" role="tabpanel">
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th>Name</th>
<th width="100%">Type</th>
</tr>
{{- range .Structures }}
<tr>
<td>{{ structure $.Id .Id }}</td>
<td>{{ .Type }}{{if .Ruin}} (ruin){{end}}</td>
</tr>
{{- end}}
</table>
</div>
{{ $active = ""}}{{- end}}
{{- if gt (len .SiteProperties) 0 }}
<div class="tab-pane{{$active}}" id="nav-site-properties" role="tabpanel">
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th>Type</th>
<th width="100%">Name or Owner</th>
</tr>
{{- range .SiteProperties }}
<tr>
<td>{{ if ne .StructureId -1 }}{{ structure $.Id .StructureId }}{{else}}{{ .Type_ }}{{end}}</td>
<td>{{ if ne .OwnerHfid -1 }}{{ hf .OwnerHfid }}{{else}}no
owner{{ end }}</td>
</tr>
{{- end}}
</table>
</div>
{{ $active = ""}}{{- end}}
<div class="tab-pane{{$active}}" id="nav-history" role="tabpanel">
{{ template "events.html" events (history .Id) }}
</div>
</div>
</div> </div>
</nav> <div class="page-map">
<div class="tab-content" id="nav-tabContent"> <div id="map" style="width: 300px; height: 300px"></div>
{{ $active := " active"}} <!-- <img class="site-map" src="$suburi/sitemap/$site.id" width="300" /> -->
{{- if gt (len .Structures) 0 }} {{initMap}}
<div class="tab-pane{{$active}}" id="nav-structures" role="tabpanel"> {{ addSite .Id false }}
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th>Name</th>
<th width="100%">Type</th>
</tr>
{{- range .Structures }}
<tr>
<td>{{ structure $.Id .Id }}</td>
<td>{{ .Type }}{{if .Ruin}} (ruin){{end}}</td>
</tr>
{{- end}}
</table>
</div> </div>
{{ $active = ""}}{{- end}}
{{- if gt (len .SiteProperties) 0 }}
<div class="tab-pane{{$active}}" id="nav-site-properties" role="tabpanel">
<table class="table table-hover table-sm table-borderless object-table">
<tr>
<th>Type</th>
<th width="100%">Name or Owner</th>
</tr>
{{- range .SiteProperties }}
<tr>
<td>{{ if ne .StructureId -1 }}{{ structure $.Id .StructureId }}{{else}}{{ .Type_ }}{{end}}</td>
<td>{{ if ne .OwnerHfid -1 }}{{ hf .OwnerHfid }}{{else}}no
owner{{ end }}</td>
</tr>
{{- end}}
</table>
</div>
{{ $active = ""}}{{- end}}
</div> </div>
<h5 class="mt-3">Events</h5> <h5 class="mt-3">Events</h5>

View File

@ -3,15 +3,15 @@
{{define "title"}}{{ title .Name }}{{end}} {{define "title"}}{{ title .Name }}{{end}}
{{define "content"}} {{define "content"}}
<h3>{{ title .Name }}</h3>
{{ .Type_ }} in {{ site .SiteId }}
<div class="object-map"> <div class="object-map">
<div id="map" style="width: 300px; height: 300px"></div> <div id="map" style="width: 300px; height: 300px"></div>
</div> </div>
{{initMap}} {{initMap}}
{{ addSite .SiteId false }} {{ addSite .SiteId false }}
<h3>{{ title .Name }}</h3>
{{ .Type_ }} in {{ site .SiteId }}
<h5 class="mt-3">Events</h5> <h5 class="mt-3">Events</h5>
{{ template "events.html" events . }} {{ template "events.html" events . }}

View File

@ -3,15 +3,15 @@
{{define "title"}}{{ title .Name }}{{end}} {{define "title"}}{{ title .Name }}{{end}}
{{define "content"}} {{define "content"}}
<h3>{{ title .Name }}</h3>
<p>{{ .Type }}</p>
<div class="object-map"> <div class="object-map">
<div id="map" style="width: 300px; height: 300px"></div> <div id="map" style="width: 300px; height: 300px"></div>
</div> </div>
{{initMap}} {{initMap}}
{{ addWorldConstruction .Id }} {{ addWorldConstruction .Id }}
<h3>{{ title .Name }}</h3>
<p>{{ .Type }}</p>
{{- if gt (len .Parts) 0 }} {{- if gt (len .Parts) 0 }}
<h5>Parts</h5> <h5>Parts</h5>
<ul> <ul>