add clans
This commit is contained in:
59
templates/clan_group.html
Normal file
59
templates/clan_group.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{{/*###
|
||||
NoCompile=true
|
||||
*/}}
|
||||
{{ define "clanGroup" }}
|
||||
{{ with . }}
|
||||
<div class="ui one column center aligned stackable grid">
|
||||
{{ $teamJSON := teamJSON }}
|
||||
{{ range .members }}
|
||||
{{/* ignore fokabot */}}
|
||||
{{ if ne (int .id) 999 }}
|
||||
{{ $tj := index $teamJSON (print .id)}}
|
||||
<div class="column">
|
||||
<div class="ui left aligned fluid card">
|
||||
<div class="image">
|
||||
<img src="{{ config "AvatarURL" }}/{{ .id }}" alt="Avatar">
|
||||
</div>
|
||||
<div class="content">
|
||||
<a class="header" href="/u/{{ .id }}">{{ country .country false }}{{ .username }}</a>
|
||||
{{ with $tj.real_name }}
|
||||
<div class="meta">
|
||||
<a>{{ . }}</a>
|
||||
</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 }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
41
templates/clan_members.html
Normal file
41
templates/clan_members.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{{/*###
|
||||
NoCompile=true
|
||||
*/}}
|
||||
{{ define "clanMembers" }}
|
||||
{{ with . }}
|
||||
<div class="ui three column center aligned stackable grid">
|
||||
{{ $teamJSON := teamJSON }}
|
||||
{{ range .members }}
|
||||
{{/* ignore fokabot */}}
|
||||
{{ if ne (int .id) 999 }}
|
||||
{{ $tj := index $teamJSON (print .id)}}
|
||||
<div class="column">
|
||||
<div class="ui left aligned fluid card">
|
||||
<div class="image">
|
||||
<img src="{{ config "AvatarURL" }}/{{ .id }}" alt="Avatar">
|
||||
</div>
|
||||
<div class="content">
|
||||
<a class="header" href="/u/{{ .id }}">{{ country .country false }}{{ .username }}</a>
|
||||
{{ with $tj.real_name }}
|
||||
<div class="meta">
|
||||
<a>{{ . }}</a>
|
||||
</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 }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
44
templates/clanboard.html
Normal file
44
templates/clanboard.html
Normal file
@@ -0,0 +1,44 @@
|
||||
{{/*###
|
||||
Handler=/clans
|
||||
TitleBar=Clans
|
||||
KyutGrill=leaderboard2.jpg
|
||||
*/}}
|
||||
{{ define "tpl" }}
|
||||
<div class="ui container">
|
||||
{{ $favMode := _or (atoi (.Gin.Query "mode")) }}
|
||||
<script>
|
||||
var favouriteMode = {{ $favMode }};
|
||||
var page = {{ .Gin.Query "p" | atoint | atLeastOne }};
|
||||
</script>
|
||||
<div class="ui four item menu" id="mode-menu">
|
||||
<a class="0 item" href="/clans?mode=0">osu!</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="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>
|
||||
{{ end }}
|
48
templates/clans/create.html
Normal file
48
templates/clans/create.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{{ define "tpl" }}
|
||||
<div class="ui container">
|
||||
{{ $regEnabled := qb "SELECT value_int FROM system_settings WHERE name = 'ccreation_enabled'" }}
|
||||
{{ $isClan := qb "SELECT user, clan FROM user_clans WHERE user = ?" .Context.User.ID }}
|
||||
{{ if not .Context.User.ID }}
|
||||
<div class="ui segment">
|
||||
{{ .T "You need to login!" }}
|
||||
</div>
|
||||
{{ else if not ($regEnabled.value_int.Bool) }}
|
||||
<div class="ui error message">
|
||||
{{ .T "Sorry, it's not possible to create a clan at the moment. Please try again later." }}
|
||||
</div>
|
||||
{{ else if ($isClan) }}
|
||||
<div class="ui segment">
|
||||
{{ .T "You're already in a Clan." }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="tiny container">
|
||||
<div class="ui raised segments">
|
||||
<div class="ui segment">
|
||||
<form id="register-form" class="ui form" method="post" action="/clans/create">
|
||||
<div class="field">
|
||||
<label>{{ .T "Name (2 to 15 characters, alphanumeric, spaces, <code>_[]-</code>)" | html }}</label>
|
||||
<input tabindex="1" type="text" name="username" placeholder="{{ .T "Name" }}" value="{{ .FormData.username }}" required pattern="{2,15}$">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="left aligned">{{ "Clantag (2 to 6 characters)" }}</label>
|
||||
<input tabindex="2" type="text" name="tag" placeholder="{{ "Clantag" }}" value="{{ .FormData.tag }}" pattern="{2,6}$">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{ .T "Description (optional)" }}</label>
|
||||
<input tabindex="3" type="text" name="password" placeholder="{{ .T "Description" }}" value="{{ .FormData.password }}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>{{ .T "Icon [URL] (optional)" }}</label>
|
||||
<input tabindex="4" type="url" name="email" placeholder="{{ .T "Icon URL" }}" value="{{ .FormData.email }}">
|
||||
</div>
|
||||
{{ ieForm .Gin }}
|
||||
</form>
|
||||
</div>
|
||||
<div class="ui right aligned segment">
|
||||
<button tabindex="5" class="ui primary button" type="submit" form="register-form">{{ .T "Submit" }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
128
templates/clansample.html
Normal file
128
templates/clansample.html
Normal file
@@ -0,0 +1,128 @@
|
||||
{{/*###
|
||||
Include=clan_members.html
|
||||
*/}}
|
||||
{{ define "tpl" }}
|
||||
<div class="ui container">
|
||||
|
||||
{{ if .ClanID }}
|
||||
{{ $gqm := .Gin.Query "mode" }}
|
||||
{{ $global := . }}
|
||||
{{ $favouritemode := $gqm }}
|
||||
{{ range (.Get "clans?id=%d" .ClanID).clans }}
|
||||
<div class="ui top attached segment overflow auto aligned">
|
||||
<div class="magic table">
|
||||
{{ if .icon }}
|
||||
<div class="table element">
|
||||
<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 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 }}
|
Reference in New Issue
Block a user