add mark all dmail as read option
This commit is contained in:
@@ -41,6 +41,12 @@ class DmailsController < ApplicationController
|
||||
redirect_to dmails_path, :notice => "Message destroyed"
|
||||
end
|
||||
|
||||
def mark_all_as_read
|
||||
Dmail.visible.unread.each do |x|
|
||||
x.update_column(:is_read, true)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(dmail)
|
||||
if !dmail.visible_to?(CurrentUser.user)
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
<li><%= link_to "Sent", dmails_path(:search => {:owner_id => CurrentUser.id, :from_id => CurrentUser.id}, :folder => "sent") %></li>
|
||||
<li><%= link_to "New", new_dmail_path %></li>
|
||||
<li><%= link_to "Search", search_dmails_path %></li>
|
||||
<li><%= link_to "Mark all as read", {:controller => "dmails", :action => "mark_all_as_read"}, :method => :post, :remote => true %></li>
|
||||
</menu>
|
||||
<% end %>
|
||||
|
||||
1
app/views/dmails/mark_all_as_read.js.erb
Normal file
1
app/views/dmails/mark_all_as_read.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
location.reload();
|
||||
@@ -72,6 +72,7 @@ Danbooru::Application.routes.draw do
|
||||
resources :dmails do
|
||||
collection do
|
||||
get :search
|
||||
post :mark_all_as_read
|
||||
end
|
||||
end
|
||||
resource :dtext_preview, :only => [:create]
|
||||
|
||||
Reference in New Issue
Block a user