This repository has been archived on 2022-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
gosocial/web/templates/forum/new_post.html
Noah Petherbridge bb08ec56ce Finish Forums + Likes & Notifications
Finish implementing the basic forum features:
* Pinned threads (admin or board owner only)
* Edit Thread settings when you edit the top-most comment.
* NoReply threads remove all the reply buttons.
* Explicit forums and threads are filtered out unless opted-in (admins
  always see them).
* Count the unique members who participated in each forum.
* Get the most recently updated thread to show on forum list page.
* Contact/Report page: handle receiving a comment ID to report on.

Implement Likes & Notifications
* Like buttons added to Photos and Profile Pages. Implemented via simple
  vanilla JS (likes.js) to make ajax requests to back-end to like/unlike.
* Notifications: for your photo or profile being liked. If you unlike,
  the existing notifications about the like are revoked.
* The notifications appear as an alert number in the nav bar and are read
  on the User Dashboard. Click to mark a notification as "read" or click
  the "mark all as read" button.

Update DeleteUser to scrub likes, notifications, threads, and comments.
2022-08-24 21:17:34 -07:00

160 lines
6.7 KiB
HTML

{{define "title"}}
{{if .EditCommentID}}
Edit Comment
{{else if .Thread}}
Reply to Thread
{{else}}
New Forum Post
{{end}}
{{end}}
{{define "content"}}
<div class="container">
<section class="hero is-info is-bold">
<div class="hero-body">
<div class="container">
<h1 class="title">
{{if .EditCommentID}}
Edit comment on: {{or .Thread.Title "Untitled Thread"}}
{{else if .Thread}}
Reply to: {{or .Thread.Title "Untitled Thread"}}
{{else}}
Post to: {{.Forum.Title}}
{{end}}
</h1>
<h2 class="subtitle">
/f/{{.Forum.Fragment}}
</h2>
</div>
</div>
</section>
<div class="block p-4">
<div class="columns is-centered">
<div class="column is-half">
<div class="card" style="width: 100%; max-width: 640px">
<header class="card-header has-background-link">
<p class="card-header-title has-text-light">
<span class="icon"><i class="fa fa-message"></i></span>
{{if .EditCommentID}}
Edit Comment
{{else if .Thread}}
Reply to Thread
{{else}}
New Thread
{{end}}
</p>
</header>
<div class="card-content">
{{if and (eq .Request.Method "POST") (ne .Message "")}}
<label class="label">Preview:</label>
<div class="box content has-background-warning-light">
{{ToMarkdown .Message}}
</div>
{{end}}
<form action="/forum/post?to={{.Forum.Fragment}}{{if .Thread}}&thread={{.Thread.ID}}{{end}}{{if .EditCommentID}}&edit={{.EditCommentID}}{{end}}" method="POST">
{{InputCSRF}}
{{if not .Thread}}
<div class="field block">
<label for="title" class="label">Title</label>
<input type="text" class="input"
name="title" id="title"
placeholder="A title for your post"
value="{{.PostTitle}}"
required>
<p class="help">Required.</p>
</div>
{{end}}
<div class="field block">
<label for="message" class="label">Message</label>
<textarea class="textarea" cols="80" rows="8"
name="message"
id="message"
required
placeholder="Message">{{.Message}}</textarea>
<p class="help">
Markdown formatting supported.
</p>
</div>
{{if or (not .Thread) .EditThreadSettings}}
<div class="field block">
{{if or .CurrentUser.IsAdmin (and .Forum (eq .Forum.OwnerID .CurrentUser.ID))}}
<div class="mb-1">
<label class="checkbox">
<input type="checkbox"
name="pinned"
value="true"
{{if .IsPinned}}checked{{end}}>
Pinned to top
</label>
</div>
{{end}}
{{if or .CurrentUser.Explicit .IsExplicit}}
<div class="mb-1">
<label class="checkbox">
<input type="checkbox"
name="explicit"
value="true"
{{if .IsExplicit}}checked{{end}}>
Mark as Explicit (NSFW)
</label>
</div>
{{end}}
{{if .CurrentUser.IsAdmin}}
<div>
<label class="checkbox has-text-danger">
<input type="checkbox"
name="noreply"
value="true"
{{if .IsNoReply}}checked{{end}}>
No replies allowed <i class="fa fa-gavel ml-1"></i>
</label>
</div>
{{end}}
</div>
{{end}}
<div class="field has-text-centered">
<button type="submit"
name="intent"
value="preview"
class="button is-link">
Preview
</button>
<button type="submit"
name="intent"
value="submit"
class="button is-success">
Post Message
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", (event) => {
let $file = document.querySelector("#file"),
$fileName = document.querySelector("#fileName");
$file.addEventListener("change", function() {
let file = this.files[0];
$fileName.innerHTML = file.name;
});
});
</script>
{{end}}