From: Tom Hughes Date: Mon, 18 Jun 2012 10:19:32 +0000 (+0100) Subject: Remove use of deprecated :comment attribute on link_to and button_to X-Git-Tag: live~5543 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/13ef6a2df1b4d6a807beb6b107e07a62b78f906c Remove use of deprecated :comment attribute on link_to and button_to --- diff --git a/app/views/diary_entry/_diary_comment.html.erb b/app/views/diary_entry/_diary_comment.html.erb index a007a8dd3..163af888f 100644 --- a/app/views/diary_entry/_diary_comment.html.erb +++ b/app/views/diary_entry/_diary_comment.html.erb @@ -2,6 +2,6 @@

<%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => l(diary_comment.created_at, :format => :friendly))) %>

<%= diary_comment.body.to_html %> <%= if_administrator(:span) do %> - <%= link_to t('diary_entry.diary_comment.hide_link'), {:action => 'hidecomment', :display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id}, {:method => :post, :confirm => t('diary_entry.diary_comment.confirm')} %> + <%= link_to t('diary_entry.diary_comment.hide_link'), hide_diary_comment_path(:display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id), :method => :post, :data=> { :confirm => t('diary_entry.diary_comment.confirm') } %> <% end %>
diff --git a/app/views/diary_entry/_diary_entry.html.erb b/app/views/diary_entry/_diary_entry.html.erb index 24ba67c39..eae60e822 100644 --- a/app/views/diary_entry/_diary_entry.html.erb +++ b/app/views/diary_entry/_diary_entry.html.erb @@ -23,7 +23,7 @@ | <%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => diary_entry.user.display_name, :id => diary_entry.id %> <% end %> <%= if_administrator(:span) do %> - | <%= link_to t('diary_entry.diary_entry.hide_link'), {:action => 'hide', :display_name => diary_entry.user.display_name, :id => diary_entry.id}, {:method => :post, :confirm => t('diary_entry.diary_entry.confirm')} %> + | <%= link_to t('diary_entry.diary_entry.hide_link'), hide_diary_entry_path(:display_name => diary_entry.user.display_name, :id => diary_entry.id), :method => :post, :data => { :confirm => t('diary_entry.diary_entry.confirm') } %> <% end %>
diff --git a/app/views/oauth_clients/show.html.erb b/app/views/oauth_clients/show.html.erb index 31f71ec9e..8139a2d73 100644 --- a/app/views/oauth_clients/show.html.erb +++ b/app/views/oauth_clients/show.html.erb @@ -27,6 +27,6 @@ - +
<%= button_to t('oauth_clients.show.edit'), edit_oauth_client_path(@client_application.user.display_name, @client_application), :method => :get %><%= button_to t('oauth_clients.show.delete'), oauth_client_path(@client_application.user.display_name, @client_application), :method => :delete, :confirm => t('oauth_clients.show.confirm') %><%= button_to t('oauth_clients.show.delete'), oauth_client_path(@client_application.user.display_name, @client_application), :method => :delete, :data => { :confirm => t('oauth_clients.show.confirm') } %>
diff --git a/app/views/redactions/show.html.erb b/app/views/redactions/show.html.erb index e9f8ac3cc..1a24f15b4 100644 --- a/app/views/redactions/show.html.erb +++ b/app/views/redactions/show.html.erb @@ -14,7 +14,7 @@ - +
<%= button_to t('redaction.show.edit'), edit_redaction_path(@redaction), :method => :get %><%= button_to t('redaction.show.destroy'), @redaction, :confirm => t('redaction.show.confirm'), :method => "delete", :remote => true %><%= button_to t('redaction.show.destroy'), @redaction, :method => "delete", :remote => true, :data => { :confirm => t('redaction.show.confirm') } %>
<% end %> diff --git a/app/views/user/view.html.erb b/app/views/user/view.html.erb index 0369401eb..e8034510b 100644 --- a/app/views/user/view.html.erb +++ b/app/views/user/view.html.erb @@ -52,19 +52,19 @@ <% if @user and @user.administrator? %>
<% if ["active", "confirmed"].include? @this_user.status %> - <%= link_to t('user.view.deactivate_user'), {:controller => 'user', :action => 'set_status', :status => 'pending', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %> | + <%= link_to t('user.view.deactivate_user'), set_status_user_path(:status => 'pending', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> | <% elsif ["pending"].include? @this_user.status %> - <%= link_to t('user.view.activate_user'), {:controller => 'user', :action => 'set_status', :status => 'active', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %> | + <%= link_to t('user.view.activate_user'), set_status_user_path(:status => 'active', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> | <% end %> <% if ["active", "suspended"].include? @this_user.status %> - <%= link_to t('user.view.confirm_user'), {:controller => 'user', :action => 'set_status', :status => 'confirmed', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %> | + <%= link_to t('user.view.confirm_user'), set_status_user_path(:status => 'confirmed', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> | <% end %> <% if ["pending", "active", "confirmed", "suspended"].include? @this_user.status %> - <%= link_to t('user.view.hide_user'), {:controller => 'user', :action => 'set_status', :status => 'deleted', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %> | + <%= link_to t('user.view.hide_user'), set_status_user_path(:status => 'deleted', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> | <% else %> - <%= link_to t('user.view.unhide_user'), {:controller => 'user', :action => 'set_status', :status => 'active', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %> | + <%= link_to t('user.view.unhide_user'), set_status_user_path(:status => 'active', :display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> | <% end %> - <%= link_to t('user.view.delete_user'), {:controller => 'user', :action => 'delete', :display_name => @this_user.display_name}, {:confirm => t('user.view.confirm')} %> + <%= link_to t('user.view.delete_user'), delete_user_path(:display_name => @this_user.display_name), :data => { :confirm => t('user.view.confirm') } %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index c24ba05e3..6b8164537 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -169,16 +169,16 @@ OpenStreetMap::Application.routes.draw do match '/user/:display_name/diary/:id' => 'diary_entry#view', :via => :get, :id => /\d+/ match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :via => :post, :id => /\d+/ match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :via => [:get, :post], :id => /\d+/ - match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :via => :post, :id => /\d+/ - match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :via => :post, :id => /\d+/, :comment => /\d+/ + match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :via => :post, :id => /\d+/, :as => :hide_diary_entry + match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :via => :post, :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment # user pages match '/user/:display_name' => 'user#view', :via => :get, :as => "user" match '/user/:display_name/make_friend' => 'user#make_friend', :via => :get match '/user/:display_name/remove_friend' => 'user#remove_friend', :via => :get match '/user/:display_name/account' => 'user#account', :via => [:get, :post] - match '/user/:display_name/set_status' => 'user#set_status', :via => :get - match '/user/:display_name/delete' => 'user#delete', :via => :get + match '/user/:display_name/set_status' => 'user#set_status', :via => :get, :as => :set_status_user + match '/user/:display_name/delete' => 'user#delete', :via => :get, :as => :delete_user # user lists match '/users' => 'user#list', :via => [:get, :post]