aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb6
m---------commonlib0
-rw-r--r--config/routes.rb6
-rw-r--r--public/stylesheets/print.css7
-rw-r--r--spec/controllers/request_controller_spec.rb24
5 files changed, 37 insertions, 6 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 313a57d7d..ef958ae9d 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -137,6 +137,8 @@ class RequestController < ApplicationController
@per_page = 25
@page = (params[:page] || "1").to_i
@info_request = InfoRequest.find_by_url_title(params[:url_title])
+ raise ActiveRecord::RecordNotFound.new("Request not found") if @info_request.nil?
+
if !@info_request.user_can_view?(authenticated_user)
render :template => 'request/hidden', :status => 410 # gone
return
@@ -146,7 +148,7 @@ class RequestController < ApplicationController
if (@page > 1)
@page_desc = " (page " + @page.to_s + ")"
- else
+ else
@page_desc = ""
end
end
@@ -837,7 +839,7 @@ class RequestController < ApplicationController
logger.error("Could not convert info request #{info_request.id} to PDF with command '#{convert_command} #{url} #{tempfile.path}'")
end
tempfile.close
- else
+ else
logger.warn("No HTML -> PDF converter found at #{convert_command}")
end
if !done
diff --git a/commonlib b/commonlib
-Subproject c200fcbb73981113fcb2ccd132e1a2b386823c6
+Subproject 95be1291ff71e37196643b6b83b99d8e25c0d82
diff --git a/config/routes.rb b/config/routes.rb
index fa387a106..747cc9b06 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,6 +6,9 @@
#
# $Id: routes.rb,v 1.92 2009-10-14 22:01:27 francis Exp $
+# Allow easy extension from themes. Note these will have the highest priority.
+load File.join('config', 'custom-routes.rb')
+
ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
@@ -14,9 +17,6 @@ ActionController::Routing::Routes.draw do |map|
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
- # Allow easy extension from themes. Note these will have the highest priority.
- require File.join('config', 'custom-routes')
-
map.with_options :controller => 'general' do |general|
general.frontpage '/', :action => 'frontpage'
general.blog '/blog', :action => 'blog'
diff --git a/public/stylesheets/print.css b/public/stylesheets/print.css
index 43d7a1807..89be21019 100644
--- a/public/stylesheets/print.css
+++ b/public/stylesheets/print.css
@@ -39,4 +39,9 @@ div.correspondence {
#other-country-notice {
display: none;
-} \ No newline at end of file
+}
+
+.not-for-print {
+ display: none !IMPORTANT;
+}
+
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 9018f76fe..ddcb621e9 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1738,6 +1738,30 @@ describe RequestController, "when doing type ahead searches" do
assigns[:xapian_requests].results.size.should == 1
end
+describe "when showing similar requests" do
+ integrate_views
+
+ it "should work" do
+ get :similar, :url_title => info_requests(:badger_request).url_title
+ response.should render_template("request/similar")
+ assigns[:info_request].should == info_requests(:badger_request)
+ end
+
+ it "should show similar requests" do
+ get :similar, :url_title => info_requests(:badger_request).url_title
+ assigns[:xapian_object].results.map{|x|x[:model].info_request}.should =~ [
+ info_requests(:fancy_dog_request),
+ info_requests(:naughty_chicken_request),
+ ]
+ end
+
+ it "should 404 for non-existent paths" do
+ lambda {
+ get :similar, :url_title => "there_is_really_no_such_path_owNAFkHR"
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
+end
+
end