diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-11-04 15:31:02 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-12-18 14:03:48 +0000 |
commit | e487e7104b53b4176972f7ad1af2a69f89ea17f1 (patch) | |
tree | 2c2ef076636f45b2fce048ac6701c18926eb55a5 | |
parent | 1ab915c1b2fbcfba5b4c8d7d58154ab72cee47cb (diff) |
Move show method to use RESTful routing
-rw-r--r-- | app/controllers/admin_public_body_controller.rb | 6 | ||||
-rw-r--r-- | app/helpers/admin_helper.rb | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/_one_list.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_public_body/edit.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_raw_email/show.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_request/_some_requests.html.erb | 2 | ||||
-rw-r--r-- | app/views/public_body/show.html.erb | 2 | ||||
-rw-r--r-- | app/views/request/show.html.erb | 2 | ||||
-rw-r--r-- | config/routes.rb | 3 |
9 files changed, 11 insertions, 12 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index 4986cfc4e..cfb6f240d 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -51,7 +51,7 @@ class AdminPublicBodyController < AdminController @change_request.send_response(params[:subject], response_text) end flash[:notice] = 'PublicBody was successfully created.' - redirect_to admin_body_show_url(@public_body) + redirect_to admin_body_url(@public_body) else render :action => 'new' end @@ -87,7 +87,7 @@ class AdminPublicBodyController < AdminController @change_request.send_response(params[:subject], params[:response]) end flash[:notice] = 'PublicBody was successfully updated.' - redirect_to admin_body_show_url(@public_body) + redirect_to admin_body_url(@public_body) else render :action => 'edit' end @@ -101,7 +101,7 @@ class AdminPublicBodyController < AdminController if public_body.info_requests.size > 0 flash[:notice] = "There are requests associated with the authority, so can't destroy it" - redirect_to admin_body_show_url(public_body) + redirect_to admin_body_url(public_body) return end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 10b259ef5..38743b1fa 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -26,7 +26,7 @@ module AdminHelper def public_body_both_links(public_body) link_to(eye, public_body_path(public_body), :title => "view authority on public website") + " " + - link_to(h(public_body.name), admin_body_show_path(public_body), :title => "view full details") + link_to(h(public_body.name), admin_body_path(public_body), :title => "view full details") end def user_both_links(user) diff --git a/app/views/admin_public_body/_one_list.html.erb b/app/views/admin_public_body/_one_list.html.erb index 8f1d719ec..4cfefb9a4 100644 --- a/app/views/admin_public_body/_one_list.html.erb +++ b/app/views/admin_public_body/_one_list.html.erb @@ -4,7 +4,7 @@ <div class="accordion-heading accordion-toggle row"> <span class="item-title span6"> <a href="#body_<%=public_body.id%>" data-toggle="collapse" data-parent="requests"><%= chevron_right %></a> - <%= link_to(public_body.name, admin_body_show_path(public_body), :title => "view full details")%> + <%= link_to(public_body.name, admin_body_path(public_body), :title => "view full details")%> </span> <span class="item-metadata span6"> <%= render :partial => 'tags', :locals => { :body => public_body} %> diff --git a/app/views/admin_public_body/edit.html.erb b/app/views/admin_public_body/edit.html.erb index 14f007b93..9a757e5a3 100644 --- a/app/views/admin_public_body/edit.html.erb +++ b/app/views/admin_public_body/edit.html.erb @@ -13,7 +13,7 @@ <div class="row"> <div class="span8"> <div class="well"> - <%= link_to 'Show', admin_body_show_path(@public_body), :class => "btn" %> + <%= link_to 'Show', admin_bodies_path(@public_body), :class => "btn" %> <%= link_to 'List all', admin_bodies_path, :class => "btn" %> </div> </div> diff --git a/app/views/admin_raw_email/show.html.erb b/app/views/admin_raw_email/show.html.erb index b78b16356..f88b00ef0 100644 --- a/app/views/admin_raw_email/show.html.erb +++ b/app/views/admin_raw_email/show.html.erb @@ -31,7 +31,7 @@ <tr> <td><strong>Authority:</strong></td> <td> - <%= link_to(info_request.public_body.name, admin_body_show_path(info_request.public_body)) %> + <%= link_to(info_request.public_body.name, admin_body_path(info_request.public_body)) %> </td> </tr> <tr> diff --git a/app/views/admin_request/_some_requests.html.erb b/app/views/admin_request/_some_requests.html.erb index cd5fb4841..9a39cd0c0 100644 --- a/app/views/admin_request/_some_requests.html.erb +++ b/app/views/admin_request/_some_requests.html.erb @@ -7,7 +7,7 @@ <%= link_to(info_request.title, admin_request_path(info_request), :title => "view full details") %> </span> <span class="item-metadata span6"> - <%= user_admin_link_for_request(info_request) %> <%= arrow_right %> <%= link_to("#{info_request.public_body.name}", admin_body_show_path(info_request.public_body)) %>, <%= time_ago_in_words(info_request.updated_at) %> ago + <%= user_admin_link_for_request(info_request) %> <%= arrow_right %> <%= link_to("#{info_request.public_body.name}", admin_body_path(info_request.public_body)) %>, <%= time_ago_in_words(info_request.updated_at) %> ago </span> </div> <div id="request_<%=info_request.id%>" class="item-detail accordion-body collapse row"> diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb index 011aea535..5ac637a78 100644 --- a/app/views/public_body/show.html.erb +++ b/app/views/public_body/show.html.erb @@ -23,7 +23,7 @@ <%=@public_body.type_of_authority(true)%><% if not @public_body.short_name.empty? %>, <%= _('also called {{public_body_short_name}}', :public_body_short_name => h(@public_body.short_name))%><% end %> <% if !@user.nil? && @user.admin_page_links? %> - (<%= link_to _("admin"), admin_body_show_path(@public_body) %>) + (<%= link_to _("admin"), admin_body_path(@public_body) %>) <% end %> </p> diff --git a/app/views/request/show.html.erb b/app/views/request/show.html.erb index 20530e660..1383030cd 100644 --- a/app/views/request/show.html.erb +++ b/app/views/request/show.html.erb @@ -39,7 +39,7 @@ :user_admin_link => user_admin_link_for_request(@info_request, _('external'), _('admin')), :request_admin_url => admin_request_url(@info_request), :public_body_link => public_body_link(@info_request.public_body), - :public_body_admin_url => admin_body_show_url(@info_request.public_body)) %> + :public_body_admin_url => admin_body_url(@info_request.public_body)) %> <% else %> <%= _('{{user}} made this {{law_used_full}} request', :user=>request_user_link(@info_request, _('An anonymous user')), diff --git a/config/routes.rb b/config/routes.rb index 9c990bc3f..50125359f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -171,12 +171,11 @@ Alaveteli::Application.routes.draw do #### AdminPublicBody controller scope '/admin', :as => 'admin' do resources :bodies, - :except => [:new, :show, :create, :update, :edit, :destroy], + :except => [:new, :create, :update, :edit, :destroy], :controller => 'admin_public_body' do end end match '/admin/missing_scheme' => 'admin_public_body#missing_scheme', :as => :admin_body_missing - match '/admin/body/show/:id' => 'admin_public_body#show', :as => :admin_body_show match '/admin/body/new' => 'admin_public_body#new', :as => :admin_body_new match '/admin/body/edit/:id' => 'admin_public_body#edit', :as => :admin_body_edit match '/admin/body/update/:id' => 'admin_public_body#update', :as => :admin_body_update |