Noah Petherbridge
a663462e27
Adds initial code for basically functional forums: * Forums landing page shows hard-coded list of Categories along with any forums in the DB that use those categories. * Admin: Create, Edit forums and view forums you own or have admin rights to modify. * Landing page forums list shows the title/description and dynamic count of number of Topics and total number of Posts in each forum. TODO: distinct count of Users who posted in each forum. * Board Index page shows list of Threads (posts) with a Replies count and Views count on each thread. * Thread view is basically an array of Comments. Users can post, edit and delete (their own) comments. Deleting the first comment removes the entire Thread - the thread points to a first Comment to provide its body. * Reply and Quote-Reply options working.
120 lines
4.0 KiB
HTML
120 lines
4.0 KiB
HTML
{{define "title"}}Forums{{end}}
|
|
{{define "content"}}
|
|
<div class="block">
|
|
<section class="hero is-light is-danger">
|
|
<div class="hero-body">
|
|
<div class="container">
|
|
<h1 class="title">
|
|
<span class="icon mr-4"><i class="fa fa-gavel"></i></span>
|
|
<span>Forum Administration</span>
|
|
</h1>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
{{$Root := .}}
|
|
|
|
<div class="block p-2">
|
|
<a href="/forum/admin/edit" class="button is-success">
|
|
<span class="icon"><i class="fa fa-plus"></i></span>
|
|
<span>Create New Forum</span>
|
|
</a>
|
|
</div>
|
|
|
|
<p class="block p-2">
|
|
Found <strong>{{.Pager.Total}}</strong> forum{{Pluralize64 .Pager.Total}} you can manage
|
|
(page {{.Pager.Page}} of {{.Pager.Pages}}).
|
|
</p>
|
|
|
|
<div class="block p-2">
|
|
<nav class="pagination" role="navigation" aria-label="pagination">
|
|
<a class="pagination-previous{{if not .Pager.HasPrevious}} is-disabled{{end}}" title="Previous"
|
|
href="{{.Request.URL.Path}}?page={{.Pager.Previous}}">Previous</a>
|
|
<a class="pagination-next{{if not .Pager.HasNext}} is-disabled{{end}}" title="Next"
|
|
href="{{.Request.URL.Path}}?page={{.Pager.Next}}">Next page</a>
|
|
<ul class="pagination-list">
|
|
{{$Root := .}}
|
|
{{range .Pager.Iter}}
|
|
<li>
|
|
<a class="pagination-link{{if .IsCurrent}} is-current{{end}}"
|
|
aria-label="Page {{.Page}}"
|
|
href="{{$Root.Request.URL.Path}}?page={{.Page}}">
|
|
{{.Page}}
|
|
</a>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
|
|
<div class="block p-2">
|
|
{{range .Forums}}
|
|
<div class="box">
|
|
<div class="columns">
|
|
<div class="column">
|
|
<h1 class="title">{{.Title}}</h1>
|
|
<h2 class="subtitle">
|
|
/f/{{.Fragment}}
|
|
{{if .Category}}<span class="ml-4">{{.Category}}</span>{{end}}
|
|
<span class="ml-4">
|
|
by <strong><a href="/u/{{.Owner.Username}}">{{.Owner.Username}}</a></strong>
|
|
{{if .Owner.IsAdmin}}<i class="fa fa-gavel has-text-danger ml-1"></i>{{end}}
|
|
</span>
|
|
</h2>
|
|
|
|
<div class="content">
|
|
<p>
|
|
|
|
</p>
|
|
|
|
{{if eq .Description ""}}
|
|
<p><em>No description</em></p>
|
|
{{else}}
|
|
{{ToMarkdown .Description}}
|
|
{{end}}
|
|
</div>
|
|
|
|
<div>
|
|
{{if .Explicit}}
|
|
<div class="tag is-danger is-light">
|
|
<span class="icon"><i class="fa fa-fire"></i></span>
|
|
Explicit
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .Privileged}}
|
|
<div class="tag is-warning is-light">
|
|
<span class="icon"><i class="fa fa-gavel"></i></span>
|
|
Privileged
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .PermitPhotos}}
|
|
<div class="tag is-info is-light">
|
|
<span class="icon"><i class="fa fa-camera"></i></span>
|
|
PermitPhotos
|
|
</div>
|
|
{{end}}
|
|
|
|
<div class="tag is-light">
|
|
Created {{.CreatedAt.Format "2006-01-02 15:04:05"}}
|
|
</div>
|
|
<div class="tag is-light">
|
|
Updated {{.UpdatedAt.Format "2006-01-02 15:04:05"}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="column is-narrow">
|
|
<a href="/forum/admin/edit?id={{.ID}}" class="button has-text-success">
|
|
<span class="icon"><i class="fa fa-edit"></i></span>
|
|
<span>Edit</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{end}} |