Still working through messages and notifications.
This commit is contained in:
@@ -7,20 +7,27 @@
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ .Subject }}</h5>
|
||||
<p class="card-text">{{ .Message }}</p>
|
||||
<p class="card-text">{{ .Body }}</p>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Archived: {{ .ArchivedAt.Format "02 Jan 2006 15:04" }}</small>
|
||||
<small class="text-muted">
|
||||
Archived:
|
||||
{{ if .ArchivedAt.Valid }}
|
||||
{{ .ArchivedAt.Time.Format "02 Jan 2006 15:04" }}
|
||||
{{ else }}
|
||||
—
|
||||
{{ end }}
|
||||
</small>
|
||||
</p>
|
||||
<form method="POST" action="/account/messages/restore" class="m-0">
|
||||
<input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-success">Restore</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<form method="POST" action="/account/messages/restore" class="m-0">
|
||||
{{ $.CSRFField }}
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-success">Restore</button>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
<!-- Pagination Controls -->
|
||||
<!-- Pagination Controls (keep if your funcs exist) -->
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
{{ if gt .Page 1 }}
|
||||
@@ -41,4 +48,4 @@
|
||||
|
||||
<a href="/account/messages" class="btn btn-secondary mt-3">Back to Inbox</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
@@ -1,50 +1,48 @@
|
||||
{{ define "content" }}
|
||||
<!-- Todo lists messages but doesn't show which ones have been read and unread-->
|
||||
<div class="container py-5">
|
||||
<h2>Your Inbox</h2>
|
||||
|
||||
{{ if .Messages }}
|
||||
<ul class="list-group mb-4">
|
||||
{{ range .Messages }}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<a href="/account/messages/read?id={{ .ID }}" class="fw-bold text-dark">{{ .Subject }}</a>
|
||||
<br>
|
||||
<small class="text-muted">{{ .CreatedAt.Format "02 Jan 2006 15:04" }}</small>
|
||||
</div>
|
||||
<form method="POST" action="/account/messages/archive?id={{ .ID }}" class="m-0">
|
||||
{{ $.CSRFField }}
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary">Archive</button>
|
||||
</form>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<!-- Pagination -->
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
{{ if gt .CurrentPage 1 }}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ sub .CurrentPage 1 }}">Previous</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<ul class="list-group mb-4">
|
||||
{{ range .Messages }}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<a href="/account/messages/{{ .ID }}" class="fw-bold text-dark">{{ .Subject }}</a><br>
|
||||
<small class="text-muted">{{ .CreatedAt.Format "02 Jan 2006 15:04" }}</small>
|
||||
</div>
|
||||
<form method="POST" action="/account/messages/archive" class="m-0">
|
||||
<input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary">Archive</button>
|
||||
</form>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ range $i := .PageRange }}
|
||||
<li class="page-item {{ if eq $i $.CurrentPage }}active{{ end }}">
|
||||
<a class="page-link" href="?page={{ $i }}">{{ $i }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
{{ if lt .CurrentPage .TotalPages }}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ add .CurrentPage 1 }}">Next</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- (Optional) Pagination if you have helpers wired -->
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
{{ if gt .CurrentPage 1 }}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ sub .CurrentPage 1 }}">Previous</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
{{ range $i := .PageRange }}
|
||||
<li class="page-item {{ if eq $i $.CurrentPage }}active{{ end }}">
|
||||
<a class="page-link" href="?page={{ $i }}">{{ $i }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
|
||||
{{ if lt .CurrentPage .TotalPages }}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ add .CurrentPage 1 }}">Next</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
{{ else }}
|
||||
<div class="alert alert-info">No messages found.</div>
|
||||
<div class="alert alert-info text-center">No messages found.</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="mt-3">
|
||||
|
||||
@@ -4,8 +4,15 @@
|
||||
<h2>{{ .Message.Subject }}</h2>
|
||||
<p class="text-muted">Received: {{ .Message.CreatedAt.Format "02 Jan 2006 15:04" }}</p>
|
||||
<hr>
|
||||
<p>{{ .Message.Message }}</p>
|
||||
<a href="/account/messages" class="btn btn-secondary mt-4">Back to Inbox</a> <a href="/account/messages/archive?id={{ .Message.ID }}" class="btn btn-outline-danger mt-3">Archive</a>
|
||||
<p>{{ .Message.Body }}</p>
|
||||
|
||||
<form method="POST" action="/account/messages/archive" class="d-inline">
|
||||
<input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}">
|
||||
<input type="hidden" name="id" value="{{ .Message.ID }}">
|
||||
<button type="submit" class="btn btn-outline-danger mt-3">Archive</button>
|
||||
</form>
|
||||
|
||||
<a href="/account/messages" class="btn btn-secondary mt-3">Back to Inbox</a>
|
||||
{{ else }}
|
||||
<div class="alert alert-danger text-center">
|
||||
Message not found or access denied.
|
||||
|
||||
@@ -1,27 +1,35 @@
|
||||
{{ define "content" }}
|
||||
<div class="container py-5">
|
||||
<h2>Send a Message</h2>
|
||||
|
||||
{{ if .Flash }}
|
||||
<div class="alert alert-info">{{ .Flash }}</div>
|
||||
{{ end }}
|
||||
{{ if .Error }}
|
||||
<div class="alert alert-danger">{{ .Error }}</div>
|
||||
{{ end }}
|
||||
|
||||
<form method="POST" action="/account/messages/send">
|
||||
{{ .CSRFField }}
|
||||
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="recipient_id" class="form-label">Recipient User ID</label>
|
||||
<input type="number" class="form-control" name="recipient_id" required>
|
||||
<input type="number" class="form-control" name="recipient_id" value="{{ with .Form }}{{ .RecipientID }}{{ end }}" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="subject" class="form-label">Subject</label>
|
||||
<input type="text" class="form-control" name="subject" required>
|
||||
<input type="text" class="form-control" name="subject" value="{{ with .Form }}{{ .Subject }}{{ end }}" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="message" class="form-label">Message</label>
|
||||
<textarea class="form-control" name="message" rows="5" required></textarea>
|
||||
<label for="body" class="form-label">Message</label>
|
||||
<textarea class="form-control" name="body" rows="5" required>{{ with .Form }}{{ .Body }}{{ end }}</textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Send</button>
|
||||
</form>
|
||||
|
||||
<a href="/account/messages" class="btn btn-secondary mt-3">Back to Inbox</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user