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.
143 lines
6.6 KiB
HTML
143 lines
6.6 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">
|
|
{{if .EditForum}}Edit Forum{{else}}New Forum{{end}}
|
|
</h1>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
{{$Root := .}}
|
|
|
|
<div class="block p-4">
|
|
<div class="columns is-centered">
|
|
<div class="column is-two-thirds">
|
|
<div class="card">
|
|
<header class="card-header has-background-info">
|
|
<p class="card-header-title has-text-light">Forum Properties</p>
|
|
</header>
|
|
|
|
<div class="card-content">
|
|
<form action="{{.Request.URL.Path}}" method="POST">
|
|
{{InputCSRF}}
|
|
<input type="hidden" name="id" value="{{.EditID}}">
|
|
|
|
<div class="field">
|
|
<label class="label" for="title">
|
|
Forum Title
|
|
</label>
|
|
<input type="text" class="input"
|
|
name="title" id="title"
|
|
placeholder="Forum Title"
|
|
required
|
|
{{if .EditForum}}value="{{.EditForum.Title}}"{{end}}>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label class="label" for="fragment">
|
|
URL Fragment
|
|
</label>
|
|
<input type="text" class="input"
|
|
name="fragment" id="fragment"
|
|
placeholder="url_fragment"
|
|
pattern="^[a-z0-9._-]+$"
|
|
required
|
|
{{if .EditForum}}value="{{.EditForum.Fragment}}" disabled{{end}}>
|
|
<p class="help">
|
|
A unique URL path component for this forum. You can not modify this
|
|
after the forum is created. Acceptable characters in the range a-z, 0-9 and . - _
|
|
</p>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label class="label" for="description">
|
|
Description
|
|
</label>
|
|
<textarea class="textarea" cols="80" rows="4"
|
|
name="description" id="description"
|
|
placeholder="A short description of the forum.">{{if .EditForum}}{{.EditForum.Description}}{{end}}</textarea>
|
|
<p class="help">
|
|
Write a short description of the forum. Markdown formatting
|
|
is supported here.
|
|
</p>
|
|
</div>
|
|
|
|
{{if .CurrentUser.IsAdmin}}
|
|
<div class="field">
|
|
<label class="label" for="category">
|
|
Category
|
|
<i class="fa fa-gavel has-text-danger ml-2" title="Admin Only"></i>
|
|
</label>
|
|
<div class="select is-fullwidth">
|
|
<select name="category" id="category">
|
|
{{range .Categories}}
|
|
<option value="{{.}}"{{if and $Root.EditForum (eq $Root.EditForum.Category .)}} selected{{end}}>
|
|
{{.}}
|
|
</option>
|
|
{{end}}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
<div class="field">
|
|
<label class="label">Options</label>
|
|
|
|
<label class="checkbox">
|
|
<input type="checkbox"
|
|
name="explicit"
|
|
value="true"
|
|
{{if and .EditForum .EditForum.Explicit}}checked{{end}}>
|
|
Explicit <i class="fa fa-fire has-text-danger ml-1"></i>
|
|
</label>
|
|
<p class="help">
|
|
Check this box if the forum is intended for explicit content. Users must
|
|
opt-in to see explicit content.
|
|
</p>
|
|
|
|
{{if .CurrentUser.IsAdmin}}
|
|
<label class="checkbox mt-3">
|
|
<input type="checkbox"
|
|
name="privileged"
|
|
value="true"
|
|
{{if and .EditForum .EditForum.Privileged}}checked{{end}}>
|
|
Privileged <i class="fa fa-gavel has-text-danger ml-1"></i>
|
|
</label>
|
|
<p class="help">
|
|
Check this box if only privileged users are allowed to create new threads
|
|
in this forum. Privileged users include the forum owner, site admins, and
|
|
forum moderators.
|
|
</p>
|
|
{{end}}
|
|
|
|
{{if .CurrentUser.IsAdmin}}
|
|
<label class="checkbox mt-3">
|
|
<input type="checkbox"
|
|
name="permit_photos"
|
|
value="true"
|
|
{{if and .EditForum .EditForum.PermitPhotos}}checked{{end}}>
|
|
Permit Photos <i class="fa fa-camera ml-1"></i>
|
|
</label>
|
|
<p class="help">
|
|
Check this box if the forum allows photos to be uploaded (not implemented)
|
|
</p>
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="field">
|
|
<button type="submit" class="button is-success">
|
|
{{if .EditForum}}Save Forum{{else}}Create Forum{{end}}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}} |