add an inbox view
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
<% render ("views.common.babycode-editor-component", {ta_name = ta_name, prefill = prefill}) %>
|
||||
<% if not cancel_url then %>
|
||||
<span>
|
||||
<input type="checkbox" id="subscribe" name="subscribe" checked>
|
||||
<input type="checkbox" id="subscribe" name="subscribe" <%= session.subscribe_by_default and "checked" or "" %>>
|
||||
<label for="subscribe">Subscribe to thread</label>
|
||||
</span>
|
||||
<% end %>
|
||||
|
@ -9,6 +9,8 @@
|
||||
Welcome, <a href="<%= url_for("user", {username = me.username}) %>"><%= me.username %></a>
|
||||
•
|
||||
<a href="<%= url_for("user_settings", {username = me.username}) %>">Settings</a>
|
||||
•
|
||||
<a href="<%= url_for("user_inbox", {username = me.username}) %>">Inbox</a>
|
||||
<% if me:is_mod() then %>
|
||||
•
|
||||
<a href="<%= url_for("user_list") %>">User list</a>
|
||||
|
@ -18,7 +18,8 @@
|
||||
<div class="post-content-container"<%= is_latest and 'id=latest-post' or "" %>>
|
||||
<div class="post-info">
|
||||
<%
|
||||
local post_url = url_for("thread", {slug = thread.slug}, {page = page}) .. "#post-" .. post.id
|
||||
--local post_url = url_for("thread", {slug = thread.slug}, {page = page}) .. "#post-" .. post.id
|
||||
local post_url = get_post_url(post.id)
|
||||
%>
|
||||
<a href="<%= post_url %>" title="Permalink"><i>
|
||||
<% if tonumber(post.edited_at) > tonumber(post.created_at) then -%>
|
||||
@ -55,7 +56,7 @@
|
||||
<button value="<%= reply_text %>" class="reply-button">Quote</button>
|
||||
<% end %>
|
||||
<%
|
||||
local show_delete = (post.user_id == me.id and not ntob(thread.is_locked)) or me:is_mod()
|
||||
local show_delete = ((post.user_id == me.id and not ntob(thread.is_locked)) or me:is_mod()) and not no_reply
|
||||
if show_delete then
|
||||
%>
|
||||
<button class="critical post-delete-button" value="<%= post.id %>">Delete</button>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<div>
|
||||
<% if me:is_logged_in() then %>
|
||||
<form class="modform" action="<%= url_for("thread_subscribe", {slug = thread.slug}) %>" method="post">
|
||||
<input type="hidden" name="first_visible_post" value=<%= posts[1].id %>>
|
||||
<input type="hidden" name="last_visible_post" value=<%= posts[#posts].id %>>
|
||||
<input type="hidden" name="subscribe" value=<%= is_subscribed and "unsubscribe" or "subscribe" %>>
|
||||
<input type="submit" value="<%= is_subscribed and "Unsubscribe" or "Subscribe" %>">
|
||||
</form>
|
||||
|
35
views/user/inbox.etlua
Normal file
35
views/user/inbox.etlua
Normal file
@ -0,0 +1,35 @@
|
||||
<div class="darkbg">
|
||||
<h1 class="thread-title">Inbox</h1>
|
||||
</div>
|
||||
<div class="inbox-container">
|
||||
<% if #new_posts == 0 then %>
|
||||
You have no unread posts.
|
||||
<% else %>
|
||||
You have <%= total_unreads_count %> unread post<%= total_unreads_count > 1 and "s" or "" %>:
|
||||
<% for _, thread in ipairs(new_posts) do %>
|
||||
<div class="accordion">
|
||||
<div class="accordion-header">
|
||||
<button type="button" class="accordion-toggle">▼</button>
|
||||
<% local latest_post_id = thread.posts[#thread.posts].id %>
|
||||
<%
|
||||
local unread_posts_text = " (" .. thread.unread_count .. " unread post" .. (thread.unread_count > 1 and "s" or "")-- .. ")"
|
||||
%>
|
||||
<a class="accordion-title" href="<%= url_for("thread", {slug = thread.thread_slug}, {after = latest_post_id}) .. "#post-" .. latest_post_id %>" title="Jump to latest post"><%= thread.thread_title .. unread_posts_text %>, latest at <span class="timestamp" data-utc=<%= thread.newest_post_time %>><%= os.date("%c", thread.newest_post_time) %></span>)</a>
|
||||
<form action="<%= url_for("thread_subscribe", {slug = thread.thread_slug}) %>" method="post">
|
||||
<input type="hidden" name="subscribe" value="read">
|
||||
<input type="submit" value="Mark Thread as Read">
|
||||
</form>
|
||||
<form action="<%= url_for("thread_subscribe", {slug = thread.thread_slug}) %>" method="post">
|
||||
<input type="hidden" name="subscribe" value="unsubscribe">
|
||||
<input class="warn" type="submit" value="Unsubscribe">
|
||||
</form>
|
||||
</div>
|
||||
<div class="accordion-content">
|
||||
<% for _, post in ipairs(thread.posts) do %>
|
||||
<% render("views.threads.post", {post = post, edit = false, is_latest = false, no_reply = true, thread = get_thread_by_id(thread.thread_id)}) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
@ -24,6 +24,8 @@
|
||||
<input type="text" id="status" name="status" value="<%= me.status %>" maxlength="70" placeholder="Will be shown under your username. Max 70 characters">
|
||||
<label for="babycode-content">Signature</label><br>
|
||||
<% render("views.common.babycode-editor-component", {ta_name = "signature", prefill = me.signature_original_markup, ta_placeholder = "Will be shown under each of your posts", optional = true}) %>
|
||||
<input autocomplete="off" type="checkbox" id="subscribe_by_default" name="subscribe_by_default" <%= session.subscribe_by_default and "checked" or "" %>>
|
||||
<label for="subscribe_by_default">Subscribe to thread by default when responding</label><br>
|
||||
<input type="submit" value="Save settings">
|
||||
</form>
|
||||
<form method="post" action="<%= url_for("user_change_password", {username = me.username}) %>">
|
||||
|
Reference in New Issue
Block a user