add action for marking forum as read
This commit is contained in:
@@ -55,6 +55,11 @@ class ForumTopicsController < ApplicationController
|
|||||||
respond_with(@forum_topic)
|
respond_with(@forum_topic)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mark_all_as_read
|
||||||
|
CurrentUser.user.update_attribute(:last_forum_read_at, Time.now)
|
||||||
|
redirect_to forum_topics_path, :notice => "All topics marked as read"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def update_last_forum_read_at
|
def update_last_forum_read_at
|
||||||
return if CurrentUser.is_anonymous?
|
return if CurrentUser.is_anonymous?
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<li><%= link_to "Listing", forum_topics_path %></li>
|
<li><%= link_to "Listing", forum_topics_path %></li>
|
||||||
<li><%= link_to "New", new_forum_topic_path %></li>
|
<li><%= link_to "New", new_forum_topic_path %></li>
|
||||||
<li><%= link_to "Search", search_forum_posts_path %></li>
|
<li><%= link_to "Search", search_forum_posts_path %></li>
|
||||||
|
<li><%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %></li>
|
||||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:forum") %></li>
|
<li><%= link_to "Help", wiki_pages_path(:title => "help:forum") %></li>
|
||||||
<% if @forum_topic %>
|
<% if @forum_topic %>
|
||||||
<li>|</li>
|
<li>|</li>
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ Danbooru::Application.routes.draw do
|
|||||||
member do
|
member do
|
||||||
post :undelete
|
post :undelete
|
||||||
end
|
end
|
||||||
|
collection do
|
||||||
|
post :mark_all_as_read
|
||||||
|
end
|
||||||
end
|
end
|
||||||
resources :ip_bans
|
resources :ip_bans
|
||||||
resources :janitor_trials do
|
resources :janitor_trials do
|
||||||
|
|||||||
Reference in New Issue
Block a user