aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin_censor_rule_controller.rb6
-rw-r--r--app/controllers/admin_incoming_message_controller.rb8
-rw-r--r--app/controllers/admin_outgoing_message_controller.rb2
-rw-r--r--app/controllers/admin_request_controller.rb25
-rw-r--r--app/helpers/admin_helper.rb2
-rw-r--r--app/mailers/request_mailer.rb2
-rw-r--r--app/views/admin_general/_admin_navbar.html.erb2
-rw-r--r--app/views/admin_outgoing_message/edit.html.erb4
-rw-r--r--app/views/admin_request/_some_requests.html.erb2
-rw-r--r--app/views/admin_request/edit.html.erb4
-rw-r--r--app/views/admin_request/edit_comment.html.erb4
-rw-r--r--app/views/admin_request/index.html.erb (renamed from app/views/admin_request/list.html.erb)0
-rw-r--r--app/views/admin_track/list.html.erb2
-rw-r--r--app/views/request/show.html.erb2
-rw-r--r--config/routes.rb9
-rw-r--r--spec/controllers/admin_incoming_message_controller_spec.rb2
-rw-r--r--spec/controllers/admin_outgoing_message_controller_spec.rb2
-rw-r--r--spec/integration/admin_spec.rb4
-rw-r--r--spec/integration/errors_spec.rb2
-rw-r--r--spec/mailers/request_mailer_spec.rb3
20 files changed, 42 insertions, 45 deletions
diff --git a/app/controllers/admin_censor_rule_controller.rb b/app/controllers/admin_censor_rule_controller.rb
index 68ca57510..dd0af002d 100644
--- a/app/controllers/admin_censor_rule_controller.rb
+++ b/app/controllers/admin_censor_rule_controller.rb
@@ -52,7 +52,7 @@ class AdminCensorRuleController < AdminController
flash[:notice] = 'CensorRule was successfully created.'
if !@censor_rule.info_request.nil?
- redirect_to admin_request_show_url(@censor_rule.info_request)
+ redirect_to admin_request_url(@censor_rule.info_request)
elsif !@censor_rule.user.nil?
redirect_to admin_user_show_url(@censor_rule.user)
else
@@ -83,7 +83,7 @@ class AdminCensorRuleController < AdminController
flash[:notice] = 'CensorRule was successfully updated.'
if !@censor_rule.info_request.nil?
- redirect_to admin_request_show_url(@censor_rule.info_request)
+ redirect_to admin_request_url(@censor_rule.info_request)
elsif !@censor_rule.user.nil?
redirect_to admin_user_show_url(@censor_rule.user)
else
@@ -112,7 +112,7 @@ class AdminCensorRuleController < AdminController
flash[:notice] = "CensorRule was successfully destroyed."
if !info_request.nil?
- redirect_to admin_request_show_url(info_request)
+ redirect_to admin_request_url(info_request)
elsif !user.nil?
redirect_to admin_user_show_url(user)
else
diff --git a/app/controllers/admin_incoming_message_controller.rb b/app/controllers/admin_incoming_message_controller.rb
index 6b50d0e36..46460d466 100644
--- a/app/controllers/admin_incoming_message_controller.rb
+++ b/app/controllers/admin_incoming_message_controller.rb
@@ -20,7 +20,7 @@ class AdminIncomingMessageController < AdminController
:prominence_reason => @incoming_message.prominence_reason)
expire_for_request(@incoming_message.info_request)
flash[:notice] = 'Incoming message successfully updated.'
- redirect_to admin_request_show_url(@incoming_message.info_request)
+ redirect_to admin_request_url(@incoming_message.info_request)
else
render :action => 'edit'
end
@@ -37,7 +37,7 @@ class AdminIncomingMessageController < AdminController
# expire cached files
expire_for_request(@info_request)
flash[:notice] = 'Incoming message successfully destroyed.'
- redirect_to admin_request_show_url(@info_request)
+ redirect_to admin_request_url(@info_request)
end
def redeliver
@@ -54,7 +54,7 @@ class AdminIncomingMessageController < AdminController
end
if destination_request.nil?
flash[:error] = "Failed to find destination request '" + m + "'"
- return redirect_to admin_request_show_url(previous_request)
+ return redirect_to admin_request_url(previous_request)
end
raw_email_data = incoming_message.raw_email.data
@@ -74,7 +74,7 @@ class AdminIncomingMessageController < AdminController
expire_for_request(previous_request)
incoming_message.fully_destroy
end
- redirect_to admin_request_show_url(destination_request)
+ redirect_to admin_request_url(destination_request)
end
end
diff --git a/app/controllers/admin_outgoing_message_controller.rb b/app/controllers/admin_outgoing_message_controller.rb
index ec0981677..76166ec05 100644
--- a/app/controllers/admin_outgoing_message_controller.rb
+++ b/app/controllers/admin_outgoing_message_controller.rb
@@ -14,7 +14,7 @@ class AdminOutgoingMessageController < AdminController
{ :editor => admin_current_user(), :deleted_outgoing_message_id => outgoing_message_id })
flash[:notice] = 'Outgoing message successfully destroyed.'
- redirect_to admin_request_show_url(@info_request)
+ redirect_to admin_request_url(@info_request)
end
def update
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 8f023bf12..90811104b 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -8,11 +8,6 @@ require 'ostruct'
class AdminRequestController < AdminController
def index
- list
- render :action => 'list'
- end
-
- def list
@query = params[:query]
if @query
info_requests = InfoRequest.where(["lower(title) like lower('%'||?||'%')", @query])
@@ -108,7 +103,7 @@ class AdminRequestController < AdminController
# expire cached files
expire_for_request(@info_request)
flash[:notice] = 'Request successfully updated.'
- redirect_to admin_request_show_url(@info_request)
+ redirect_to admin_request_url(@info_request)
else
render :action => 'edit'
end
@@ -125,7 +120,7 @@ class AdminRequestController < AdminController
expire_for_request(@info_request)
email = user.try(:email) ? user.email : 'This request is external so has no associated user'
flash[:notice] = "Request #{ url_title } has been completely destroyed. Email of user who made request: #{ email }"
- redirect_to admin_request_list_url
+ redirect_to admin_requests_url
end
def edit_comment
@@ -146,7 +141,7 @@ class AdminRequestController < AdminController
:old_visible => old_visible, :visible => @comment.visible,
})
flash[:notice] = 'Comment successfully updated.'
- redirect_to admin_request_show_url(@comment.info_request)
+ redirect_to admin_request_url(@comment.info_request)
else
render :action => 'edit_comment'
end
@@ -172,7 +167,7 @@ class AdminRequestController < AdminController
info_request.reindex_request_events
flash[:notice] = "Message has been moved to new user"
end
- redirect_to admin_request_show_url(info_request)
+ redirect_to admin_request_url(info_request)
elsif params[:commit] == 'Move request to authority' && !params[:public_body_url_name].blank?
old_public_body = info_request.public_body
destination_public_body = PublicBody.find_by_url_name(params[:public_body_url_name])
@@ -191,10 +186,10 @@ class AdminRequestController < AdminController
flash[:notice] = "Request has been moved to new body"
end
- redirect_to admin_request_show_url(info_request)
+ redirect_to admin_request_url(info_request)
else
flash[:error] = "Please enter the user or authority to move the request to"
- redirect_to admin_request_show_url(info_request)
+ redirect_to admin_request_url(info_request)
end
end
@@ -218,7 +213,7 @@ class AdminRequestController < AdminController
if !info_request.public_body.is_foi_officer?(user)
flash[:notice] = user.email + " is not an email at the domain @" + info_request.public_body.foi_officer_domain_required + ", so won't be able to upload."
- redirect_to admin_request_show_url(info_request)
+ redirect_to admin_request_url(info_request)
return
end
@@ -231,7 +226,7 @@ class AdminRequestController < AdminController
url = confirm_url(:email_token => post_redirect.email_token)
flash[:notice] = ("Send \"#{name}\" &lt;<a href=\"mailto:#{email}\">#{email}</a>&gt; this URL: <a href=\"#{url}\">#{url}</a> - it will log them in and let them upload a response to this request.").html_safe
- redirect_to admin_request_show_url(info_request)
+ redirect_to admin_request_url(info_request)
end
def show_raw_email
@@ -281,7 +276,7 @@ class AdminRequestController < AdminController
info_request_event.save!
flash[:notice] = "Old response marked as having been a clarification"
- redirect_to admin_request_show_url(info_request_event.info_request)
+ redirect_to admin_request_url(info_request_event.info_request)
end
def hide_request
@@ -314,7 +309,7 @@ class AdminRequestController < AdminController
end
# expire cached files
expire_for_request(info_request)
- redirect_to admin_request_show_url(info_request)
+ redirect_to admin_request_url(info_request)
end
end
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index 151e53758..10b259ef5 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -21,7 +21,7 @@ module AdminHelper
def request_both_links(info_request)
link_to(eye, request_path(info_request), :title => "view request on public website") + " " +
- link_to(info_request.title, admin_request_show_path(info_request), :title => "view full details")
+ link_to(info_request.title, admin_request_path(info_request), :title => "view full details")
end
def public_body_both_links(public_body)
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 768257ba8..96917d63f 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -58,7 +58,7 @@ class RequestMailer < ApplicationMailer
user = set_by || info_request.user
@reported_by = user
@url = request_url(info_request)
- @admin_url = admin_request_show_url(info_request)
+ @admin_url = admin_request_url(info_request)
@info_request = info_request
@message = message
diff --git a/app/views/admin_general/_admin_navbar.html.erb b/app/views/admin_general/_admin_navbar.html.erb
index 14fc06092..a663e62d4 100644
--- a/app/views/admin_general/_admin_navbar.html.erb
+++ b/app/views/admin_general/_admin_navbar.html.erb
@@ -11,7 +11,7 @@
<li><%= link_to 'Debug', admin_debug_path %></li>
<li><%= link_to 'Authorities', admin_body_list_path %></li>
<li><%= link_to 'Categories', admin_categories_path %></li>
- <li><%= link_to 'Requests', admin_request_list_path %></li>
+ <li><%= link_to 'Requests', admin_requests_path %></li>
<li><%= link_to 'Users', admin_user_list_path %></li>
<li><%= link_to 'Tracks', admin_track_list_path %></li>
<li><%= link_to 'Log out', signout_path %></li>
diff --git a/app/views/admin_outgoing_message/edit.html.erb b/app/views/admin_outgoing_message/edit.html.erb
index d5f5f43bf..9fae60da9 100644
--- a/app/views/admin_outgoing_message/edit.html.erb
+++ b/app/views/admin_outgoing_message/edit.html.erb
@@ -36,8 +36,8 @@
<% end %>
<p>
-<%= link_to 'Show', admin_request_show_path(@outgoing_message.info_request) %> |
-<%= link_to 'List all', admin_request_list_path %>
+<%= link_to 'Show', admin_request_path(@outgoing_message.info_request) %> |
+<%= link_to 'List all', admin_requests_path %>
</p>
<%= form_tag admin_outgoing_destroy_path do %>
diff --git a/app/views/admin_request/_some_requests.html.erb b/app/views/admin_request/_some_requests.html.erb
index cff94956d..cd5fb4841 100644
--- a/app/views/admin_request/_some_requests.html.erb
+++ b/app/views/admin_request/_some_requests.html.erb
@@ -4,7 +4,7 @@
<div class="accordion-heading accordion-toggle row">
<span class="item-title span6">
<a href="#request_<%=info_request.id%>" data-toggle="collapse" data-parent="requests"><%= chevron_right %></a>
- <%= link_to(info_request.title, admin_request_show_path(info_request), :title => "view full details") %>
+ <%= 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
diff --git a/app/views/admin_request/edit.html.erb b/app/views/admin_request/edit.html.erb
index 552b31bbb..b97ffab35 100644
--- a/app/views/admin_request/edit.html.erb
+++ b/app/views/admin_request/edit.html.erb
@@ -43,8 +43,8 @@
<% end %>
<p>
-<%= link_to 'Show', admin_request_show_path(@info_request) %> |
-<%= link_to 'List all', admin_request_list_path %>
+<%= link_to 'Show', admin_request_path(@info_request) %> |
+<%= link_to 'List all', admin_requests_path %>
</p>
<hr>
diff --git a/app/views/admin_request/edit_comment.html.erb b/app/views/admin_request/edit_comment.html.erb
index 2cf49a4a8..a177deb7e 100644
--- a/app/views/admin_request/edit_comment.html.erb
+++ b/app/views/admin_request/edit_comment.html.erb
@@ -16,7 +16,7 @@
<% end %>
<p>
-<%= link_to 'Show', admin_request_show_path(@comment.info_request) %> |
-<%= link_to 'List all', admin_request_list_path %>
+<%= link_to 'Show', admin_request_path(@comment.info_request) %> |
+<%= link_to 'List all', admin_requests_path %>
</p>
diff --git a/app/views/admin_request/list.html.erb b/app/views/admin_request/index.html.erb
index 2bd3e3326..2bd3e3326 100644
--- a/app/views/admin_request/list.html.erb
+++ b/app/views/admin_request/index.html.erb
diff --git a/app/views/admin_track/list.html.erb b/app/views/admin_track/list.html.erb
index 5e967a926..2b1dc5737 100644
--- a/app/views/admin_track/list.html.erb
+++ b/app/views/admin_track/list.html.erb
@@ -14,7 +14,7 @@
<h2>Current top tracks:</h2>
<ol>
<% for row in @popular %>
- <li><%= link_to row['title'], admin_request_show_path(row['info_request_id']) %> (<%= row['count'] %> people following)</li>
+ <li><%= link_to row['title'], admin_request_path(row['info_request_id']) %> (<%= row['count'] %> people following)</li>
<% end %>
</ol>
diff --git a/app/views/request/show.html.erb b/app/views/request/show.html.erb
index 153b0b861..20530e660 100644
--- a/app/views/request/show.html.erb
+++ b/app/views/request/show.html.erb
@@ -37,7 +37,7 @@
:user => request_user_link(@info_request, _('An anonymous user')),
:law_used_full => h(@info_request.law_used_full),
:user_admin_link => user_admin_link_for_request(@info_request, _('external'), _('admin')),
- :request_admin_url => admin_request_show_url(@info_request),
+ :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)) %>
<% else %>
diff --git a/config/routes.rb b/config/routes.rb
index 4b2eb5695..7e40ceb29 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -213,10 +213,13 @@ Alaveteli::Application.routes.draw do
####
#### AdminRequest controller
- match '/admin/request' => 'admin_request#index', :as => :admin_request_index
- match '/admin/request/list' => 'admin_request#list', :as => :admin_request_list
- match '/admin/request/show/:id' => 'admin_request#show', :as => :admin_request_show
match '/admin/request/resend' => 'admin_request#resend', :as => :admin_request_resend
+ scope '/admin', :as => 'admin' do
+ resources :requests,
+ :controller => 'admin_request',
+ :except => [:new, :create] do
+ 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/destroy/:id' => 'admin_request#fully_destroy', :as => :admin_request_destroy
diff --git a/spec/controllers/admin_incoming_message_controller_spec.rb b/spec/controllers/admin_incoming_message_controller_spec.rb
index 21c744e5b..fb91e026c 100644
--- a/spec/controllers/admin_incoming_message_controller_spec.rb
+++ b/spec/controllers/admin_incoming_message_controller_spec.rb
@@ -130,7 +130,7 @@ describe AdminIncomingMessageController, "when administering incoming messages"
it 'should redirect to the admin info request view' do
make_request
- response.should redirect_to admin_request_show_url(@incoming.info_request)
+ response.should redirect_to admin_request_url(@incoming.info_request)
end
it 'should show a message that the incoming message has been updated' do
diff --git a/spec/controllers/admin_outgoing_message_controller_spec.rb b/spec/controllers/admin_outgoing_message_controller_spec.rb
index 0dde53b86..a46a077da 100644
--- a/spec/controllers/admin_outgoing_message_controller_spec.rb
+++ b/spec/controllers/admin_outgoing_message_controller_spec.rb
@@ -79,7 +79,7 @@ describe AdminOutgoingMessageController do
it 'should redirect to the admin info request view' do
make_request
- response.should redirect_to admin_request_show_url(@info_request)
+ response.should redirect_to admin_request_url(@info_request)
end
it 'should show a message that the incoming message has been updated' do
diff --git a/spec/integration/admin_spec.rb b/spec/integration/admin_spec.rb
index 8e6351d2c..ceb010143 100644
--- a/spec/integration/admin_spec.rb
+++ b/spec/integration/admin_spec.rb
@@ -39,7 +39,7 @@ describe "When administering the site" do
post_params = {'redeliver_incoming_message_id' => new_im.id,
'url_title' => ir.url_title}
admin.post '/en/admin/incoming/redeliver', post_params
- admin.response.location.should == 'http://www.example.com/en/admin/request/show/101'
+ admin.response.location.should == 'http://www.example.com/en/admin/requests/101'
ir = InfoRequest.find_by_url_title(ir.url_title)
ir.incoming_messages.length.should == 2
@@ -67,7 +67,7 @@ describe "When administering the site" do
ir1.incoming_messages.length.should == 2
ir2.reload
ir2.incoming_messages.length.should == 2
- admin.response.location.should == 'http://www.example.com/en/admin/request/show/106'
+ admin.response.location.should == 'http://www.example.com/en/admin/requests/106'
InfoRequest.holding_pen_request.incoming_messages.length.should == 0
end
diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb
index 110626058..a28b34da6 100644
--- a/spec/integration/errors_spec.rb
+++ b/spec/integration/errors_spec.rb
@@ -131,7 +131,7 @@ describe "When errors occur" do
it 'should show a full trace for general errors' do
InfoRequest.stub!(:find).and_raise("An example error")
- get("/admin/request/show/333")
+ get("/admin/requests/333")
response.body.should have_selector('div[id=traces]')
response.body.should match('An example error')
end
diff --git a/spec/mailers/request_mailer_spec.rb b/spec/mailers/request_mailer_spec.rb
index 8ba2a7bec..9e98dbc00 100644
--- a/spec/mailers/request_mailer_spec.rb
+++ b/spec/mailers/request_mailer_spec.rb
@@ -427,8 +427,7 @@ describe RequestMailer, 'requires_admin' do
it 'body should contain the full admin URL' do
mail = RequestMailer.requires_admin(@info_request).deliver
-
- mail.body.should include('http://test.host/en/admin/request/show/123')
+ mail.body.should include('http://test.host/en/admin/requests/123')
end
it "body should contain the message from the user" do