Use a resourceful path for message marking
This commit is contained in:
parent
5405dde6ec
commit
db30ea642e
4 changed files with 6 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
|||
<td class="inbox-sender"><%= link_to h(message_summary.sender.display_name), user_path(message_summary.sender) %></td>
|
||||
<td class="inbox-subject"><%= link_to h(message_summary.title), message_path(message_summary) %></td>
|
||||
<td class="inbox-sent"><%= l message_summary.sent_on, :format => :friendly %></td>
|
||||
<td class="inbox-mark-unread"><%= button_to t('.unread_button'), mark_message_path(message_summary, :mark => 'unread'), { :remote => true } %></td>
|
||||
<td class="inbox-mark-read"><%= button_to t('.read_button'), mark_message_path(message_summary, :mark => 'read'), { :remote => true } %></td>
|
||||
<td class="inbox-mark-unread"><%= button_to t('.unread_button'), message_mark_path(message_summary, :mark => 'unread'), { :remote => true } %></td>
|
||||
<td class="inbox-mark-read"><%= button_to t('.read_button'), message_mark_path(message_summary, :mark => 'read'), { :remote => true } %></td>
|
||||
<td class="inbox-destroy"><%= button_to t('.destroy_button'), message_path(message_summary, :referer => request.fullpath), { :method => :delete, :remote => true } %></td>
|
||||
</tr>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div class='message-buttons buttons'>
|
||||
<%= button_to t('.reply_button'), reply_message_path(@message), :class => 'reply-button' %>
|
||||
<%= button_to t('.unread_button'), mark_message_path(@message, :mark => 'unread'), :class => 'mark-unread-button' %>
|
||||
<%= button_to t('.unread_button'), message_mark_path(@message, :mark => 'unread'), :class => 'mark-unread-button' %>
|
||||
<%= button_to t('.destroy_button'), message_path(@message), :method => 'delete', :class => 'destroy-button' %>
|
||||
|
||||
<% else %>
|
||||
|
|
|
@ -265,6 +265,7 @@ OpenStreetMap::Application.routes.draw do
|
|||
|
||||
# messages
|
||||
resources :messages, :only => [:create, :show, :destroy] do
|
||||
post :mark
|
||||
collection do
|
||||
get :inbox
|
||||
get :outbox
|
||||
|
@ -274,7 +275,7 @@ OpenStreetMap::Application.routes.draw do
|
|||
get "/user/:display_name/outbox", :to => redirect(:path => "/messages/outbox")
|
||||
get "/message/new/:display_name" => "messages#new", :as => "new_message"
|
||||
get "/message/read/:message_id", :to => redirect(:path => "/messages/%{message_id}")
|
||||
post "/message/mark/:message_id" => "messages#mark", :as => "mark_message"
|
||||
post "/message/mark/:message_id" => "messages#mark" # remove after deployment
|
||||
match "/message/reply/:message_id" => "messages#reply", :via => [:get, :post], :as => "reply_message"
|
||||
|
||||
# oauth admin pages (i.e: for setting up new clients, etc...)
|
||||
|
|
|
@ -25,7 +25,7 @@ class MessagesControllerTest < ActionController::TestCase
|
|||
{ :controller => "messages", :action => "show", :id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/message/mark/1", :method => :post },
|
||||
{ :path => "/messages/1/mark", :method => :post },
|
||||
{ :controller => "messages", :action => "mark", :message_id => "1" }
|
||||
)
|
||||
assert_routing(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue