From 91f361f2e5676000a51a45f25294484a1b50eb05 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 30 Jan 2013 08:17:00 +1100 Subject: If now query is supplied get all the requests --- app/controllers/admin_request_controller.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index c7c8d4972..15b8b0ddf 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -14,10 +14,16 @@ class AdminRequestController < AdminController def list @query = params[:query] - @info_requests = InfoRequest.paginate :order => "created_at desc", - :page => params[:page], - :per_page => 100, - :conditions => @query.nil? ? nil : ["lower(title) like lower('%'||?||'%')", @query] + if @query + @info_requests = InfoRequest.paginate :order => "created_at desc", + :page => params[:page], + :per_page => 100, + :conditions => ["lower(title) like lower('%'||?||'%')", @query] + else + @info_requests = InfoRequest.all.paginate :order => "created_at desc", + :page => params[:page], + :per_page => 100 + end end def list_old_unclassified -- cgit v1.2.3 From 08c182e09c9eee4b06fb1507f606a54dbe8d1c6d Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 30 Jan 2013 08:56:41 +1100 Subject: Convert query to more activerecord 3 form --- app/controllers/admin_request_controller.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 15b8b0ddf..eec684b0a 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -15,15 +15,13 @@ class AdminRequestController < AdminController def list @query = params[:query] if @query - @info_requests = InfoRequest.paginate :order => "created_at desc", - :page => params[:page], - :per_page => 100, - :conditions => ["lower(title) like lower('%'||?||'%')", @query] + info_requests = InfoRequest.where(["lower(title) like lower('%'||?||'%')", @query]) else - @info_requests = InfoRequest.all.paginate :order => "created_at desc", - :page => params[:page], - :per_page => 100 + info_requests = InfoRequest.all end + @info_requests = info_requests.paginate :order => "created_at desc", + :page => params[:page], + :per_page => 100 end def list_old_unclassified -- cgit v1.2.3 From 532a21ba4941197a13524ac3f1ce9267a46bec1d Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Mon, 25 Feb 2013 17:25:59 +1100 Subject: Update to new mail sending API --- app/controllers/admin_request_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 9f94b41b2..80dbd730c 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -380,11 +380,11 @@ class AdminRequestController < AdminController info_request.save! if ! info_request.is_external? - ContactMailer.deliver_from_admin_message( + ContactMailer.from_admin_message( info_request.user, subject, params[:explanation] - ) + ).deliver flash[:notice] = _("Your message to {{recipient_user_name}} has been sent",:recipient_user_name=>CGI.escapeHTML(info_request.user.name)) else flash[:notice] = _("This external request has been hidden") -- cgit v1.2.3 From 835b51c1de0d49e652fe9c9a60f0974275de070c Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Wed, 27 Feb 2013 10:34:47 +1100 Subject: Rename ALL THE TEMPLATES!!1!!!one!!1!! .rhtml is deprecated in favour of .erb in Rails 3 --- app/controllers/admin_request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 80dbd730c..45a898759 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -48,7 +48,7 @@ class AdminRequestController < AdminController :info_request => @info_request, :reason => params[:reason], :info_request_url => 'http://' + Configuration::domain + request_url(@info_request), :site_name => site_name) - template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.rhtml")) + template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.html.erb")) @request_hidden_user_explanation = ERB.new(template).result(vars.instance_eval { binding }) end -- cgit v1.2.3 From cbdff06aa95a7987b54c712dc6729e138f608eca Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Sun, 3 Mar 2013 14:52:30 +1100 Subject: Rename Configuration class to avoid conflict with ActiveSupport::Configurable --- app/controllers/admin_request_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 45a898759..56fd731fe 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -44,9 +44,9 @@ class AdminRequestController < AdminController # XXX is this *really* the only way to render a template to a # variable, rather than to the response? vars = OpenStruct.new(:name_to => @info_request.user_name, - :name_from => Configuration::contact_name, + :name_from => AlaveteliConfiguration::contact_name, :info_request => @info_request, :reason => params[:reason], - :info_request_url => 'http://' + Configuration::domain + request_url(@info_request), + :info_request_url => 'http://' + AlaveteliConfiguration::domain + request_url(@info_request), :site_name => site_name) template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.html.erb")) @request_hidden_user_explanation = ERB.new(template).result(vars.instance_eval { binding }) -- cgit v1.2.3 From eb4e833901e2d9e4133103c85be2084d90505df9 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Sun, 3 Mar 2013 17:10:49 +1100 Subject: In will_paginate 3 you can call paginate directly on the model --- app/controllers/admin_request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 56fd731fe..fc2cf8e97 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -17,7 +17,7 @@ class AdminRequestController < AdminController if @query info_requests = InfoRequest.where(["lower(title) like lower('%'||?||'%')", @query]) else - info_requests = InfoRequest.all + info_requests = InfoRequest end @info_requests = info_requests.paginate :order => "created_at desc", :page => params[:page], -- cgit v1.2.3 From 67bfa6a05079ae2f6642bb8eb20fd8d342124f53 Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Fri, 15 Mar 2013 15:40:50 +1100 Subject: Removed in eadfc265ff83524cbd54b2682f2de818bca24bf4 --- app/controllers/admin_request_controller.rb | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 3ad2713d2..699c79b47 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -24,21 +24,6 @@ class AdminRequestController < AdminController :per_page => 100 end - def list_old_unclassified - @info_requests = WillPaginate::Collection.create((params[:page] or 1), 50) do |pager| - info_requests = InfoRequest.find_old_unclassified(:conditions => ["prominence = 'normal'"], - :limit => pager.per_page, - :offset => pager.offset) - # inject the result array into the paginated collection: - pager.replace(info_requests) - - unless pager.total_entries - # the pager didn't manage to guess the total count, do it manually - pager.total_entries = InfoRequest.count_old_unclassified(:conditions => ["prominence = 'normal'"]) - end - end - end - def show @info_request = InfoRequest.find(params[:id]) # XXX is this *really* the only way to render a template to a -- cgit v1.2.3 From 44ec166b8691743e0ffbcc108eaf41ab0d2ef3cd Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Tue, 26 Mar 2013 09:47:06 +1100 Subject: Change email address in header of source code to hello@mysociety.org --- app/controllers/admin_request_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/admin_request_controller.rb') diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 699c79b47..66989ea93 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -2,7 +2,7 @@ # Controller for viewing FOI requests from the admin interface. # # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ require 'ostruct' -- cgit v1.2.3