website/web/templates/forum/add_edit.html
2024-08-10 11:54:37 -07:00

156 lines
7.3 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. <a href="/markdown" target="_blank">Markdown formatting</a>
is supported here.
</p>
</div>
{{if .CurrentUser.IsAdmin}}
<div class="field">
<label class="label" for="category">
Category
<i class="fa fa-peace 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-peace 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}}
{{if .CurrentUser.IsAdmin}}
<label class="checkbox mt-3">
<input type="checkbox"
name="private"
value="true"
{{if and .EditForum .EditForum.Private}}checked{{end}}>
Private forum
</label>
<p class="help">
This forum is only visible to admins or approved subscribers.
</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}}