aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb6
-rw-r--r--app/controllers/user_controller.rb3
-rw-r--r--app/views/request/list.rhtml2
-rw-r--r--public/images/navimg/logo-trans.pngbin4763 -> 6040 bytes
-rw-r--r--public/stylesheets/main.css67
-rw-r--r--spec/controllers/request_controller_spec.rb14
-rw-r--r--spec/controllers/user_controller_spec.rb7
7 files changed, 55 insertions, 44 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 11812b729..75bdac2a9 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -168,7 +168,8 @@ class RequestController < ApplicationController
query = make_query_from_params
@title = _("View and search requests")
sortby = "newest"
- behavior_cache :tag => [@query, @page, I18n.locale] do
+ @cache_tag = Digest::MD5.hexdigest(query + @page.to_s)
+ behavior_cache :tag => [@cache_tag] do
xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse')
@list_results = xapian_object.results.map { |r| r[:model] }
@matches_estimated = xapian_object.matches_estimated
@@ -696,7 +697,8 @@ class RequestController < ApplicationController
@incoming_message.parse_raw_email!
@info_request = @incoming_message.info_request
if @incoming_message.info_request_id != params[:id].to_i
- raise ActiveRecord::RecordNotFound.new(sprintf("Incoming message %d does not belong to request %d", @incoming_message.info_request_id, params[:id]))
+ message = "Incoming message %d does not belong to request %d" % [@incoming_message.info_request_id, params[:id]]
+ raise ActiveRecord::RecordNotFound.new(message)
end
@part_number = params[:part].to_i
@filename = params[:file_name].join("/")
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 45b71a3a9..f49fc9165 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -489,7 +489,8 @@ class UserController < ApplicationController
raise ActiveRecord::RecordNotFound.new("user not found, url_name=" + params[:url_name])
end
if !@display_user.profile_photo
- raise "user has no profile photo, url_name=" + params[:url_name]
+ raise ActiveRecord::RecordNotFound.new("user has no profile photo, url_name=" + params[:url_name])
+
end
response.content_type = "image/png"
diff --git a/app/views/request/list.rhtml b/app/views/request/list.rhtml
index 42cd41498..7cbd982f1 100644
--- a/app/views/request/list.rhtml
+++ b/app/views/request/list.rhtml
@@ -14,7 +14,7 @@
<div style="clear:both"></div>
<div class="results_section">
- <% view_cache :ttl => 5.minutes.to_i, :tag => [@query, @page, I18n.locale] do %>
+ <% view_cache :ttl => 5.minutes.to_i, :tag => [@cache_tag] do %>
<% if @list_results.empty? %>
<p> <%= _('No requests of this sort yet.')%></p>
<% else %>
diff --git a/public/images/navimg/logo-trans.png b/public/images/navimg/logo-trans.png
index 917bec8b0..320a52efd 100644
--- a/public/images/navimg/logo-trans.png
+++ b/public/images/navimg/logo-trans.png
Binary files differ
diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css
index 2d3eaa38e..0fa298e38 100644
--- a/public/stylesheets/main.css
+++ b/public/stylesheets/main.css
@@ -1,7 +1,7 @@
body {
text-align:center;
color:#444;
-font-size:12px;
+font-size:15px;
font-family:Arial, sans-serif;
margin:0;
padding:0;
@@ -10,7 +10,7 @@ padding:0;
#banner {
position:absolute;
top:0;
-background-color:#EEE;
+background-color:#F3F3F3;
left:0;
width:100%;
border:none;
@@ -60,7 +60,7 @@ top:120px;
margin-left:115px;
width:auto;
font-family:Arial, sans-serif;
-font-size:18px;
+font-size:1.2em;
padding:0;
}
@@ -84,11 +84,11 @@ color:#000;
#logged_in_bar {
clear:none;
-font-size:0.8em;
+font-size:0.9em;
z-index:200;
color:#444;
top:18px;
-right:210px;
+right:22em;
float:none;
position:absolute;
padding:0.2em 10px 0.25em 1em;
@@ -135,7 +135,7 @@ clear:left;
}
h1 {
-font-size:42px;
+font-size:2.2em;
margin-bottom:15px;
margin-top:10px;
}
@@ -171,7 +171,7 @@ border:1px solid #222;
border-radius:5px;
-moz-border-radius:5px;
color:#222;
-font-size:18px;
+font-size:1.1em;
text-align:left;
width:412px;
margin:0 14em 40px 0;
@@ -223,7 +223,7 @@ margin-bottom:2em;
}
.request_listing,.body_listing,.user_listing {
-font-size:0.8em;
+font-size:0.9em;
margin-top:1.5em;
border-bottom:#9C9C9C;
overflow:hidden;
@@ -401,7 +401,6 @@ color:#FFF;
#error,.errorExplanation,#hidden_request {
color:#FF0606;
-font-size:1.4em;
font-weight:700;
background-color:#fee;
border-color:#FF0C11;
@@ -424,7 +423,7 @@ border-width:1px;
padding:0.2em;
}
-#notice,.describe_state_form,.undescribed_requests,.gone_postal_help {
+#notice, {
color:#16C132;
font-size:1.4em;
font-weight:700;
@@ -487,7 +486,7 @@ div[id|="outgoing"] p {
}
div[id|="incoming"] {
-background-color:#DEDEDE;
+background-color:#F3F3F3;
}
div[id|="incoming"] p {
@@ -878,12 +877,12 @@ text-decoration:none;
}
h2,dt {
-font-size:21px;
+font-size:1.8em;
}
h3 {
text-decoration:none;
-font-size:20px;
+font-size:1.6em;
margin-top:3px;
margin-bottom:10px;
}
@@ -916,7 +915,6 @@ margin-left:-4px;
}
#navigation_search input[type=text] {
-font-size:12px;
border-radius:5px 0 0 5px;
-moz-border-radius:5px 0 0 5px;
border-color:#222;
@@ -951,7 +949,7 @@ margin-left:6px;
p.subtitle {
margin-top:10px;
margin-bottom:20px;
-font-size:18px;
+font-size:1.2em;
font-style:normal;
color:#222;
}
@@ -973,27 +971,25 @@ padding:12px 0 6px;
.request_listing span.head,.user_listing span.head,.body_listing span.head {
background:none;
-font-size:21px;
+font-size: 1.5em;
margin-bottom:6px;
padding:0;
}
.request_listing span.head a,.user_listing span.head a,.body_listing span.head a {
text-decoration:none;
-font-size:20px;
+font-size:1.3em;
margin-top:3px;
display:block;
margin-bottom:-6px;
}
.request_listing .requester {
-font-size:12px;
padding-bottom:0;
}
.body_listing span.desc,.body_listing span.bottomline,.user_listing span.bottomline {
font-style:normal;
-font-size:12px;
font-weight:400;
margin:0;
padding:0;
@@ -1004,7 +1000,7 @@ font-style:normal;
margin-bottom:0;
margin-top:12px;
background-position:top left;
-font-size:14px;
+font-size:1.1em;
font-weight:400;
min-height:36px;
padding:3px 0 0 27px;
@@ -1022,7 +1018,6 @@ color:#C1272D;
#request_sidebar {
width:212px;
-font-size:12px;
}
.feed_link {
@@ -1032,7 +1027,6 @@ padding:4px 0;
.request_listing span.desc {
background:url(/images/quote-marks.png) no-repeat;
min-height:60px;
-font-size:12px;
width:auto;
color:#444;
line-height:18px;
@@ -1072,7 +1066,6 @@ padding-right:2px;
}
form.feed_form input[type="submit"] {
-font-size:12px;
line-height:12px;
padding:2px 4px;
}
@@ -1113,7 +1106,7 @@ padding-bottom:5px;
}
#request_form label,label.form_label,span#to_public_body {
-font-size:18px;
+font-size: 1.1em;
}
#date_range label,#filter_requests_form label {
@@ -1187,7 +1180,7 @@ width:10%;
height:100px;
text-align:center;
margin-top:45px;
-font-size:16px;
+font-size:1.2em;
font-family:Georgia;
font-style:italic;
color:#444;
@@ -1203,7 +1196,7 @@ margin-left:10.5em;
}
form input[type=text],form input[type=password] {
-font-size:14px;
+font-size:1.1em;
width:200px;
color:#555;
border-radius:3px;
@@ -1219,7 +1212,7 @@ width:130px !important;
background:url(/images/calendar.png) no-repeat 115px 3px;
border-radius:3px !important;
-moz-border-radius:3px !important;
-font-size:14px !important;
+font-size:1.1em !important;
margin:0 !important;
}
@@ -1233,20 +1226,20 @@ border:solid 1px #69952F;
border-radius:2px;
-moz-border-radius:2px;
text-shadow:1px 1px 0 #5B841D;
-font-size:18px;
+font-size:14px;
cursor:hand;
padding:5px 11px;
}
a.link_button_green_large {
background:url(/images/button-gradient-large.png);
-font-size:22px;
+font-size:2em;
line-height:22px;
padding-bottom:7px;
}
form input[type=submit].small {
-font-size:15px;
+font-size:1.1em;
line-height:10px;
padding:4px 9px;
}
@@ -1281,7 +1274,6 @@ border:1px solid #DEBEDD;
border-radius:5px;
-moz-border-radius:5px;
color:#DDD;
-font-size:18px;
text-align:center;
width:255px;
height:210px;
@@ -1314,7 +1306,6 @@ padding:5px 0;
#frontpage_examples .excerpt {
cursor:pointer;
background:url(/images/quote-marks.png) no-repeat;
-font-size:12px;
color:#444;
line-height:18px;
min-height:30px;
@@ -1328,7 +1319,6 @@ background:url(/images/defaultprofilepic.png);
div.correspondence,div.comment_in_request {
width:600px;
-font-size:13px;
border-radius:6px;
-moz-border-radius:6px;
border-width:1px;
@@ -1336,11 +1326,10 @@ padding:4px 20px 0 9px;
}
div.outgoing.correspondence {
- background: #EFEFEF;
+ background: #FFFFD2;
}
div[id|="comment"] p {
-font-size:13px;
}
div.comment_in_request {
@@ -1489,7 +1478,7 @@ opacity:1px;
#other-country-notice {
background:#222;
color:#FFF;
-font-size:16px;
+font-size:1.1em;
width:100%;
z-index:999;
display:block;
@@ -1502,7 +1491,7 @@ p.public-body-name-prefix {
color:#888;
margin-top:15px;
margin-bottom:-15px;
-font-size: 16px;
+font-size: 1.2em;
}
#other-country-notice a {
@@ -1565,14 +1554,12 @@ border:solid 1px Red !important;
.errorExplanation {
border-radius:6px;
-moz-border-radius:6px;
-font-size:12px;
font-weight:400;
width:554px;
margin:20px 0 30px;
}
#notice,.describe_state_form,#other_recipients {
-font-size:12px;
font-weight:400;
background:#E9FDD3 !important;
color:#517704;
@@ -1603,7 +1590,7 @@ margin-bottom:0;
}
div.correspondence p.preview_subject {
-font-size:18px !important;
+font-size:1.2em !important;
margin-left:10px;
line-height:25px;
}
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 18ccbba7e..a0ea9bb48 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -39,6 +39,11 @@ describe RequestController, "when listing recent requests" do
assigns[:list_results].size.should == 1
end
+ it "should make a sane-sized cache tag" do
+ get :list, :view => 'all', :request_date_after => '13/10/2007', :request_date_before => '01/11/2007'
+ assigns[:cache_tag].size.should <= 32
+ end
+
it "should list internal_review requests as unresolved ones" do
get :list, :view => 'awaiting'
assigns[:list_results].size.should == 0
@@ -190,6 +195,15 @@ describe RequestController, "when showing one request" do
get :get_attachment_as_html, :incoming_message_id => ir.incoming_messages[1].id, :id => ugly_id, :part => 2, :file_name => ['hello.txt.html'], :skip_cache => 1
}.should raise_error(ActiveRecord::RecordNotFound)
end
+ it "should return 404 when incoming message and request ids don't match " do
+ ir = info_requests(:fancy_dog_request)
+ wrong_id = info_requests(:naughty_chicken_request).id
+ receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email)
+ ir.reload
+ lambda {
+ get :get_attachment_as_html, :incoming_message_id => ir.incoming_messages[1].id, :id => wrong_id, :part => 2, :file_name => ['hello.txt.html'], :skip_cache => 1
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
it "should generate valid HTML verson of PDF attachments " do
ir = info_requests(:fancy_dog_request)
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 1e25c1b44..a90fa18df 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -543,6 +543,13 @@ describe UserController, "when using profile photos" do
post :set_profile_photo, { :id => @user.id, :file => @uploadedfile, :submitted_draft_profile_photo => 1, :automatically_crop => 1 }
end
+ it "should return a 404 not a 500 when a profile photo has not been set" do
+ @user.profile_photo.should be_nil
+ lambda {
+ get :get_profile_photo, {:url_name => @user.url_name }
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
+
it "should let you change profile photo if you're logged in as the user" do
@user.profile_photo.should be_nil
session[:user_id] = @user.id