1bf846e78b
Allow regular (non-admin) users access to the Manage Forums page so they can create and manage their own forums. Things that were already working: * The admin forum page was already anticipating regular LoginRequired credential * Users only see their owned forums, while admins can see and manage ALL forums Improvements made to the Forum Admin page: * Change the title color from admin-red to user-blue. * Add ability to search (filter) and sort the forums. Other changes: * Turn the Forum tab bar into a reusable component.
159 lines
7.3 KiB
HTML
159 lines
7.3 KiB
HTML
{{define "title"}}Forums{{end}}
|
|
{{define "content"}}
|
|
<div class="block">
|
|
<section class="hero is-light is-success">
|
|
<div class="hero-body">
|
|
<div class="container">
|
|
<div class="level">
|
|
<div class="level-left mb-4">
|
|
<h1 class="title">
|
|
<span class="icon mr-4"><i class="fa fa-comments"></i></span>
|
|
<span>Forums</span>
|
|
</h1>
|
|
</div>
|
|
{{if or .FeatureUserForumsEnabled (.CurrentUser.HasAdminScope "admin.forum.manage")}}
|
|
<div class="level-right">
|
|
<div>
|
|
<a href="/forum/admin" class="button is-small">
|
|
<span class="icon"><i class="fa fa-circle-plus"></i></span>
|
|
<span>Create a forum</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
{{$Root := .}}
|
|
|
|
<!-- Tab bar -->
|
|
{{template "ForumTabs" .}}
|
|
|
|
{{range .Categories}}
|
|
<div class="block p-4">
|
|
<h1 class="title">{{.Category}}</h1>
|
|
|
|
{{if eq (len .Forums) 0}}
|
|
<em>
|
|
There are no forums under this category.
|
|
{{if not $Root.CurrentUser.Explicit}}Your content filters (non-explicit) may be hiding some forums.{{end}}
|
|
</em>
|
|
{{else}}
|
|
{{range .Forums}}
|
|
{{$Stats := $Root.ForumMap.Get .ID}}
|
|
<div class="card block has-background-primary-light has-text-dark">
|
|
<div class="card-content">
|
|
<div class="columns">
|
|
<div class="column is-3 pt-0 pb-1">
|
|
|
|
<h2 class="is-size-4">
|
|
<strong><a href="/f/{{.Fragment}}">{{.Title}}</a></strong>
|
|
</h2>
|
|
|
|
<div class="content mb-1">
|
|
{{if .Description}}
|
|
{{ToMarkdown .Description}}
|
|
{{else}}
|
|
<em>No description</em>
|
|
{{end}}
|
|
</div>
|
|
|
|
<div>
|
|
{{if .Explicit}}
|
|
<span class="tag is-danger is-light">
|
|
<span class="icon"><i class="fa fa-fire"></i></span>
|
|
<span>Explicit</span>
|
|
</span>
|
|
{{end}}
|
|
|
|
{{if .Privileged}}
|
|
<span class="tag is-warning is-light">
|
|
<span class="icon"><i class="fa fa-peace"></i></span>
|
|
<span>Privileged</span>
|
|
</span>
|
|
{{end}}
|
|
|
|
{{if .PermitPhotos}}
|
|
<span class="tag is-grey">
|
|
<span class="icon"><i class="fa fa-camera"></i></span>
|
|
<span>Photos</span>
|
|
</span>
|
|
{{end}}
|
|
|
|
{{if .Private}}
|
|
<span class="tag is-private is-light">
|
|
<span class="icon"><i class="fa fa-lock"></i></span>
|
|
<span>Private</span>
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
|
|
</div>
|
|
<div class="column py-1">
|
|
<div class="box has-background-success-light has-text-dark">
|
|
<h2 class="subtitle mb-1 has-text-dark">Latest Post</h2>
|
|
{{if $Stats.RecentThread}}
|
|
<a href="/go/comment?id={{$Stats.RecentPost.ID}}">
|
|
<strong>{{$Stats.RecentThread.Title}}</strong>
|
|
</a>
|
|
<em>by {{$Stats.RecentThread.Comment.User.Username}}</em>
|
|
<div>
|
|
<em>
|
|
{{if and $Stats.RecentPost (not (eq $Stats.RecentPost.ID $Stats.RecentThread.CommentID))}}
|
|
<small>Last comment by {{$Stats.RecentPost.User.Username}}</small>
|
|
{{end}}
|
|
<small title="{{$Stats.RecentThread.UpdatedAt.Format "2006-01-02 15:04:05"}}">{{SincePrettyCoarse $Stats.RecentThread.UpdatedAt}} ago</small>
|
|
</em>
|
|
</div>
|
|
{{else}}
|
|
<em>No posts found.</em>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="column is-3 py-1">
|
|
<div class="columns is-mobile is-gapless">
|
|
<div class="column has-text-centered mr-1">
|
|
<div class="box has-background-warning-light has-text-dark p-2">
|
|
<p class="is-size-7 has-text-dark">Topics</p>
|
|
{{if $Stats}}
|
|
{{$Stats.Threads}}
|
|
{{else}}
|
|
err
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="column has-text-centered mx-1">
|
|
<div class="box has-background-warning-light has-text-dark p-2">
|
|
<p class="is-size-7 has-text-dark">Posts</p>
|
|
{{if $Stats}}
|
|
{{$Stats.Posts}}
|
|
{{else}}
|
|
err
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="column has-text-centered ml-1">
|
|
<div class="box has-background-warning-light has-text-dark p-2">
|
|
<p class="is-size-7 has-text-dark">Users</p>
|
|
{{if $Stats}}
|
|
{{$Stats.Users}}
|
|
{{else}}
|
|
err
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
{{end}}<!-- range .Categories -->
|
|
|
|
{{end}} |