fix formatting

This commit is contained in:
Alicia 2019-02-23 21:27:22 +00:00
parent 697cb30f0f
commit 17125a0334
4 changed files with 250 additions and 243 deletions

View File

@ -3,57 +3,57 @@ NoCompile=true
*/}} */}}
{{ define "clanGroup" }} {{ define "clanGroup" }}
{{ with . }} {{ with . }}
<div class="ui one column center aligned stackable grid"> <div class="ui one column center aligned stackable grid">
{{ $teamJSON := teamJSON }} {{ $teamJSON := teamJSON }}
{{ range .members }} {{ range .members }}
{{/* ignore fokabot */}} {{/* ignore fokabot */}}
{{ if ne (int .id) 999 }} {{ if ne (int .id) 999 }}
{{ $tj := index $teamJSON (print .id)}} {{ $tj := index $teamJSON (print .id)}}
<div class="column"> <div class="column">
<div class="ui left aligned fluid card"> <div class="ui left aligned fluid card">
<div class="image"> <div class="image">
<img src="{{ config "AvatarURL" }}/{{ .id }}" alt="Avatar"> <img src="{{ config "AvatarURL" }}/{{ .id }}" alt="Avatar">
</div> </div>
<div class="content"> <div class="content">
<a class="header" href="/u/{{ .id }}">{{ country .country false }}{{ .username }}</a> <a class="header" href="/u/{{ .id }}">{{ country .country false }}{{ .username }}</a>
{{ with $tj.real_name }} {{ with $tj.real_name }}
<div class="meta"> <div class="meta">
<a>{{ . }}</a> <a>{{ . }}</a>
</div> </div>
{{ end }}
{{ with $tj.role }}
<div class="description">
{{ . }}
</div>
{{ end }}
</div>
<div class="extra content">
<div title="Registered">
<i class="sign in icon"></i>
{{ time .registered_on }}
</div>
<div title="Latest activity">
<i class="sign out icon"></i>
{{ time .latest_activity }}
</div>
</div>
{{ if or $tj.twitter $tj.mail $tj.github }}
<div class="extra content">
<div class="center aligned">
{{ range $k, $v := $tj }}
{{ if and $v (in $k "github" "twitter" "mail") }}
<a href="{{ servicePrefix $k }}{{ $v }}" title="{{ capitalise $k }}">
<i class="{{ $k }} icon"></i>
</a>
{{ end }}
{{ end }}
</div>
</div>
{{ end }}
</div>
</div>
{{ end }} {{ end }}
{{ with $tj.role }}
<div class="description">
{{ . }}
</div>
{{ end }}
</div>
<div class="extra content">
<div title="Registered">
<i class="sign in icon"></i>
{{ time .registered_on }}
</div>
<div title="Latest activity">
<i class="sign out icon"></i>
{{ time .latest_activity }}
</div>
</div>
{{ if or $tj.twitter $tj.mail $tj.github }}
<div class="extra content">
<div class="center aligned">
{{ range $k, $v := $tj }}
{{ if and $v (in $k "github" "twitter" "mail") }}
<a href="{{ servicePrefix $k }}{{ $v }}" title="{{ capitalise $k }}">
<i class="{{ $k }} icon"></i>
</a>
{{ end }}
{{ end }}
</div>
</div>
{{ end }} {{ end }}
</div> </div>
</div>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div>
{{ end }}
{{ end }}

View File

@ -2,40 +2,40 @@
NoCompile=true NoCompile=true
*/}} */}}
{{ define "clanMembers" }} {{ define "clanMembers" }}
{{ with . }} { with . }}
<div class="ui three column center aligned stackable grid"> <div class="ui three column center aligned stackable grid">
{{ $teamJSON := teamJSON }} {{ $teamJSON := teamJSON }}
{{ range .members }} {{ range .members }}
{{/* ignore fokabot */}} {{/* ignore fokabot */}}
{{ if ne (int .id) 999 }} {{ if ne (int .id) 999 }}
{{ $tj := index $teamJSON (print .id)}} {{ $tj := index $teamJSON (print .id)}}
<div class="column"> <div class="column">
<div class="ui left aligned fluid card"> <div class="ui left aligned fluid card">
<div class="image"> <div class="image">
<img src="{{ config "AvatarURL" }}/{{ .id }}" alt="Avatar"> <img src="{{ config "AvatarURL" }}/{{ .id }}" alt="Avatar">
</div> </div>
<div class="content"> <div class="content">
<a class="header" href="/u/{{ .id }}">{{ country .country false }}{{ .username }}</a> <a class="header" href="/u/{{ .id }}">{{ country .country false }}{{ .username }}</a>
{{ with $tj.real_name }} {{ with $tj.real_name }}
<div class="meta"> <div class="meta">
<a>{{ . }}</a> <a>{{ . }}</a>
</div> </div>
{{ end }}
</div>
<div class="extra content">
<div title="Registered">
<i class="sign in icon"></i>
{{ time .registered_on }}
</div>
<div title="Latest activity">
<i class="sign out icon"></i>
{{ time .latest_activity }}
</div>
</div>
</div>
</div>
{{ end }} {{ end }}
{{ end }} </div>
<div class="extra content">
<div title="Registered">
<i class="sign in icon"></i>
{{ time .registered_on }}
</div>
<div title="Latest activity">
<i class="sign out icon"></i>
{{ time .latest_activity }}
</div>
</div>
</div> </div>
</div>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div>
{{ end }}
{{ end }}

View File

@ -3,42 +3,42 @@ Handler=/clans
TitleBar=Clans TitleBar=Clans
KyutGrill=leaderboard2.jpg KyutGrill=leaderboard2.jpg
*/}} */}}
{{ define "tpl" }} {{ define "tpl" }}
<div class="ui container"> <div class="ui container">
{{ $favMode := _or (atoi (.Gin.Query "mode")) }} {{ $favMode := _or (atoi (.Gin.Query "mode")) }}
<script> <script>
var favouriteMode = {{ $favMode }}; var favouriteMode = {{ $favMode }};
var page = {{ .Gin.Query "p" | atoint | atLeastOne }}; var page = {{ .Gin.Query "p" | atoint | atLeastOne }};
</script> </script>
<div class="ui four item menu" id="mode-menu"> <div class="ui four item menu" id="mode-menu">
<a class="0 item" href="/clans?mode=0">osu!</a> <a class="0 item" href="/clans?mode=0">osu!</a>
<a class="1 item" href="/clans?mode=1">osu!taiko</a> <a class="1 item" href="/clans?mode=1">osu!taiko</a>
<a class="2 item" href="/clans?mode=2">osu!catch</a> <a class="2 item" href="/clans?mode=2">osu!catch</a>
<a class="3 item" href="/clans?mode=3">osu!mania</a> <a class="3 item" href="/clans?mode=3">osu!mania</a>
</div>
<table class="ui fixed table">
<thead>
{{ template "simplepag" 4 }}
<tr>
<th class="four wide">{{ .T "Rank" }} </th>
<th class="four wide">{{ .T "Clan" }} </th>
<th class="four wide">{{ .T "PP/Score" }} </th>
<th class="four wide">{{ .T "Playcount" }} </th>
</tr>
</table>
<table class="ui fixed table">
<thead>
{{ range (.Get "clans/stats/all?m=$d" $favMode).clans }}
{{ if .name }}
<tr>
<th class="four wide">#{{ .rank }} </th>
<th class="four wide"> <a href="/c/{{ .id }}?mode={{ $favMode }}">{{ .name }}</a></th>
<th class="four wide">{{ .chosen_mode.pp }}pp ({{ humanize .chosen_mode.total_score }})</th>
<th class="four wide">{{ .chosen_mode.playcount }}</th>
</tr>
{{end}}
{{end}}
</thead>
</table>
</div> </div>
{{ end }} <table class="ui fixed table">
<thead>
{{ template "simplepag" 4 }}
<tr>
<th class="four wide">{{ .T "Rank" }} </th>
<th class="four wide">{{ .T "Clan" }} </th>
<th class="four wide">{{ .T "PP/Score" }} </th>
<th class="four wide">{{ .T "Playcount" }} </th>
</tr>
</table>
<table class="ui fixed table">
<thead>
{{ range (.Get "clans/stats/all?m=$d" $favMode).clans }}
{{ if .name }}
<tr>
<th class="four wide">#{{ .rank }} </th>
<th class="four wide"> <a href="/c/{{ .id }}?mode={{ $favMode }}">{{ .name }}</a></th>
<th class="four wide">{{ .chosen_mode.pp }}pp ({{ humanize .chosen_mode.total_score }})</th>
<th class="four wide">{{ .chosen_mode.playcount }}</th>
</tr>
{{end}}
{{end}}
</thead>
</table>
</div>
{{ end }}

View File

@ -2,127 +2,134 @@
Include=clan_members.html Include=clan_members.html
*/}} */}}
{{ define "tpl" }} {{ define "tpl" }}
<div class="ui container"> <div class="ui container">
{{ if .ClanID }} {{ if .ClanID }}
{{ $gqm := .Gin.Query "mode" }} {{ $gqm := .Gin.Query "mode" }}
{{ $global := . }} {{ $global := . }}
{{ $favouritemode := $gqm }} {{ $favouritemode := $gqm }}
{{ range (.Get "clans?id=%d" .ClanID).clans }} {{ range (.Get "clans?id=%d" .ClanID).clans }}
<div class="ui top attached segment overflow auto aligned"> <div class="ui top attached segment overflow auto aligned">
<div class="magic table"> <div class="magic table">
{{ if .icon }} {{ if .icon }}
<div class="table element"> <div class="table element">
<img src="{{ .icon }}" alt="icon" class="clan icon" style="border-radius:5%; height:90px;"> <img src="{{ .icon }}" alt="icon" class="clan icon" style="border-radius:5%; height:90px;">
</div>
{{ end }}
<div class="table element">
<h1 class="ui header">
{{ $global.T "%s" .name | html }}
</h1>
<div class="subtitle">
{{ $global.T "(%s)" (.tag | htmlescaper) | html }}
</div>
</div>
</div>
</div> </div>
<div class="ui four item bottom attached menu" id="mode-menu">
<a class="mode item" href="/c/{{ .id }}?mode=0">osu!</a>
<a class="mode item" href="/c/{{ .id }}?mode=1">osu!taiko</a>
<a class="mode item" href="/c/{{ .id }}?mode=2">osu!catch</a>
<a class="mode item" href="/c/{{ .id }}?mode=3">osu!mania</a>
</div>
<div class="ui segment">
<div class="ui two column divided stackable grid">
<div class="row">
<div class="column">
{{ $global.T "%s" (.description | htmlescaper) | html }}
{{ end }}
<br><br><table class="ui very basic two column compact table nopad">
<tbody>
{{ with (.Get "clans/stats?id=%d&m=%d" .ClanID (.Gin.Query "mode"))}}
<td></td>
<tr>
<td><b>{{ $global.T "Global Rank" }}</b></td>
<td class="right aligned">#{{ humanize .rank }}</td>
</tr>
<tr>
<td><b>{{ $global.T "PP" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.pp }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Ranked Score" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.ranked_score }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Score" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.total_score }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Playcount" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.playcount }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Replays Watched" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.replays_watched }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Hits" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.total_hits }}</td>
</tr>
{{end}}
{{ range (.Get "clans?id=%d" .ClanID).clans }}
</tbody>
</table>{{ end }}
</div>
<div class="column">
{{ if $global.Context.User.ID }}
{{ $d := qb "SELECT user, clan, perms FROM user_clans WHERE user = ? LIMIT 1" .Context.User.ID }}
{{ $p := qb "SELECT user, clan, perms FROM user_clans WHERE user = ? AND perms = 8 LIMIT 1" .Context.User.ID }}
{{ $tc := qb "SELECT user, clan, perms FROM user_clans WHERE user = ? AND clan = ? LIMIT 1" .Context.User.ID .ClanID }}
{{ $uc := or $d.clan.Int -1 }}
{{ if $d }}
{{ if $tc }}
{{ if $p }}
<form id="register-form" class="ui form" method="post" action="/c/{{ .ClanID }}">
{{ ieForm .Gin }}
</form>
<div class="ui one item menu"><button tabindex="1" class="ui primary button" style="background-color:rgba(255,0,0,.5)" type="submit" form="register-form">{{ .T "Disband Clan" }}</button></div>
{{ else }}
<form id="register-form" class="ui form" method="post" action="/c/{{ .ClanID }}">
{{ ieForm .Gin }}
</form>
<div class="ui one item menu"><button tabindex="1" class="ui primary button" style="background-color:rgba(255,0,0,.3)" type="submit" form="register-form">{{ .T "Leave Clan" }}</button></div>
{{ end }}
{{ else }}
<div class="ui one item menu" id="join-menu"><a class="item" style="background-color:rgba(255,0,0,.3)">Already joined a clan</a></div>
{{end}}
{{ else }}
{{ end }}
{{ else }}
<div class="ui one item menu" id="join-menu"><a class="item" href="/login" style="background-color:rgba(0,128,255,.3)">Please login to join a clan</a></div>
{{ end }}
<h1 class="ui heading">{{ .T "Clan Owner" }}</h1>
<p>
{{ .T "The leader of the clan." }}<br>
</p>
{{ template "clanMembers" (.Get "clans/members?id=%d&r=%d" .ClanID 8) }}
</div>
</div>
</div>
<div class="ui aligned segment">
<h1 class="ui heading">{{ .T "Members" }}</h1>
<p>
{{ .T "The members of the clan." }}<br>
</p>
{{ template "clanMembers" (.Get "clans/members?id=%d&r=%d" .ClanID 1) }}
</div>
</div>
{{ end }} {{ end }}
<div class="table element">
<h1 class="ui header">
{{ $global.T "%s" .name | html }}
</h1>
<div class="subtitle">
{{ $global.T "(%s)" (.tag | htmlescaper) | html }}
</div>
</div>
</div>
</div> </div>
{{ end }} <div class="ui four item bottom attached menu" id="mode-menu">
<a class="mode item" href="/c/{{ .id }}?mode=0">osu!</a>
<a class="mode item" href="/c/{{ .id }}?mode=1">osu!taiko</a>
<a class="mode item" href="/c/{{ .id }}?mode=2">osu!catch</a>
<a class="mode item" href="/c/{{ .id }}?mode=3">osu!mania</a>
</div>
<div class="ui segment">
<div class="ui two column divided stackable grid">
<div class="row">
<div class="column">
{{ $global.T "%s" (.description | htmlescaper) | html }}
{{ end }}
<br><br>
<table class="ui very basic two column compact table nopad">
<tbody>
{{ with (.Get "clans/stats?id=%d&m=%d" .ClanID (.Gin.Query "mode"))}}
<td></td>
<tr>
<td><b>{{ $global.T "Global Rank" }}</b></td>
<td class="right aligned">#{{ humanize .rank }}</td>
</tr>
<tr>
<td><b>{{ $global.T "PP" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.pp }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Ranked Score" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.ranked_score }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Score" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.total_score }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Playcount" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.playcount }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Replays Watched" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.replays_watched }}</td>
</tr>
<tr>
<td><b>{{ $global.T "Total Hits" }}</b></td>
<td class="right aligned">{{ humanize .chosen_mode.total_hits }}</td>
</tr>
{{end}}
{{ range (.Get "clans?id=%d" .ClanID).clans }}
</tbody>
</table>{{ end }}
</div>
<div class="column">
{{ if $global.Context.User.ID }}
{{ $d := qb "SELECT user, clan, perms FROM user_clans WHERE user = ? LIMIT 1" .Context.User.ID }}
{{ $p := qb "SELECT user, clan, perms FROM user_clans WHERE user = ? AND perms = 8 LIMIT 1" .Context.User.ID }}
{{ $tc := qb "SELECT user, clan, perms FROM user_clans WHERE user = ? AND clan = ? LIMIT 1" .Context.User.ID .ClanID }}
{{ $uc := or $d.clan.Int -1 }}
{{ if $d }}
{{ if $tc }}
{{ if $p }}
<form id="register-form" class="ui form" method="post" action="/c/{{ .ClanID }}">
{{ ieForm .Gin }}
</form>
<div class="ui one item menu"><button tabindex="1" class="ui primary button"
style="background-color:rgba(255,0,0,.5)" type="submit"
form="register-form">{{ .T "Disband Clan" }}</button></div>
{{ else }}
<form id="register-form" class="ui form" method="post" action="/c/{{ .ClanID }}">
{{ ieForm .Gin }}
</form>
<div class="ui one item menu"><button tabindex="1" class="ui primary button"
style="background-color:rgba(255,0,0,.3)" type="submit"
form="register-form">{{ .T "Leave Clan" }}</button></div>
{{ end }}
{{ else }}
<div class="ui one item menu" id="join-menu"><a class="item"
style="background-color:rgba(255,0,0,.3)">Already joined a clan</a></div>
{{end}}
{{ else }}
{{ end }}
{{ else }}
<div class="ui one item menu" id="join-menu"><a class="item" href="/login"
style="background-color:rgba(0,128,255,.3)">Please login to join a clan</a></div>
{{ end }}
<h1 class="ui heading">{{ .T "Clan Owner" }}</h1>
<p>
{{ .T "The leader of the clan." }}<br>
</p>
{{ template "clanMembers" (.Get "clans/members?id=%d&r=%d" .ClanID 8) }}
</div>
</div>
</div>
<div class="ui aligned segment">
<h1 class="ui heading">{{ .T "Members" }}</h1>
<p>
{{ .T "The members of the clan." }}<br>
</p>
{{ template "clanMembers" (.Get "clans/members?id=%d&r=%d" .ClanID 1) }}
</div>
</div>
{{ end }}
</div>
{{ end }}