diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-11-04 14:49:35 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-12-12 16:47:14 +0000 |
commit | 9aaffdd03ac41f0116e8da73793b9ace787b3ba2 (patch) | |
tree | 4b2f4623ed3c19f7c980ebed58359855da305e59 | |
parent | df8488465a7f395e953f5dc9f83ddb2bac8e5df5 (diff) |
Make move a RESTful action
-rw-r--r-- | app/controllers/admin_request_controller.rb | 4 | ||||
-rw-r--r-- | app/views/admin_request/show.html.erb | 3 | ||||
-rw-r--r-- | config/routes.rb | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index b123a3467..87c07b3bd 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -118,8 +118,8 @@ class AdminRequestController < AdminController end # change user or public body of a request magically - def move_request - info_request = InfoRequest.find(params[:info_request_id]) + def move + info_request = InfoRequest.find(params[:id]) if params[:commit] == 'Move request to user' && !params[:user_url_name].blank? old_user = info_request.user destination_user = User.find_by_url_name(params[:user_url_name]) diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb index f5620d769..735d71734 100644 --- a/app/views/admin_request/show.html.erb +++ b/app/views/admin_request/show.html.erb @@ -2,8 +2,7 @@ <h1><%=@title%></h1> -<%= form_tag admin_request_move_request_path, { :class => "form form-horizontal" } do %> - <%= hidden_field_tag 'info_request_id', @info_request.id %> +<%= form_tag move_admin_request_path(@info_request), { :class => "form form-horizontal" } do %> <div class="accordion" id="info_request"> <div class="accordion-group"> <div class="accordion-heading"> diff --git a/config/routes.rb b/config/routes.rb index a16f304be..beebad609 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -217,13 +217,13 @@ Alaveteli::Application.routes.draw do resources :requests, :controller => 'admin_request', :except => [:new, :create] do + post 'move', :on => :member end end match '/admin/request/edit/:id' => 'admin_request#edit', :as => :admin_request_edit match '/admin/request/update/:id' => 'admin_request#update', :as => :admin_request_update match '/admin/request/edit_comment/:id' => 'admin_request#edit_comment', :as => :admin_request_edit_comment match '/admin/request/update_comment/:id' => 'admin_request#update_comment', :as => :admin_request_update_comment - match '/admin/request/move_request' => 'admin_request#move_request', :as => :admin_request_move_request match '/admin/request/generate_upload_url/:id' => 'admin_request#generate_upload_url', :as => :admin_request_generate_upload_url match '/admin/request/show_raw_email/:id' => 'admin_request#show_raw_email', :as => :admin_request_show_raw_email match '/admin/request/download_raw_email/:id' => 'admin_request#download_raw_email', :as => :admin_request_download_raw_email |