diff options
-rw-r--r-- | app/controllers/public_body_controller.rb (renamed from app/controllers/body_controller.rb) | 8 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 2 | ||||
-rw-r--r-- | app/views/public_body/_alphabet.rhtml (renamed from app/views/body/_alphabet.rhtml) | 0 | ||||
-rw-r--r-- | app/views/public_body/_body_listing.rhtml (renamed from app/views/body/_body_listing.rhtml) | 2 | ||||
-rw-r--r-- | app/views/public_body/_body_listing_single.rhtml (renamed from app/views/body/_body_listing_single.rhtml) | 0 | ||||
-rw-r--r-- | app/views/public_body/list.rhtml (renamed from app/views/body/list.rhtml) | 0 | ||||
-rw-r--r-- | app/views/public_body/show.rhtml (renamed from app/views/body/show.rhtml) | 0 | ||||
-rw-r--r-- | app/views/public_body/view_email.rhtml (renamed from app/views/body/view_email.rhtml) | 0 | ||||
-rw-r--r-- | app/views/public_body/view_email_captcha.rhtml (renamed from app/views/body/view_email_captcha.rhtml) | 0 | ||||
-rw-r--r-- | config/routes.rb | 4 | ||||
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb (renamed from spec/controllers/body_controller_spec.rb) | 8 | ||||
-rw-r--r-- | spec/views/public_body/show.rhtml_spec.rb (renamed from spec/views/body/show.rhtml_spec.rb) | 16 |
12 files changed, 20 insertions, 20 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/public_body_controller.rb index cd72356d1..b668cb576 100644 --- a/app/controllers/body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -4,9 +4,9 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: body_controller.rb,v 1.26 2009-06-16 22:21:13 francis Exp $ +# $Id: public_body_controller.rb,v 1.1 2009-06-22 12:54:44 francis Exp $ -class BodyController < ApplicationController +class PublicBodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL def show if MySociety::Format.simplify_url_part(params[:url_name]) != params[:url_name] @@ -47,12 +47,12 @@ class BodyController < ApplicationController if params[:submitted_view_email] if verify_recaptcha flash.discard(:error) - render :template => "body/view_email" + render :template => "public_body/view_email" return end flash.now[:error] = "There was an error with the words you entered, please try again." end - render :template => "body/view_email_captcha" + render :template => "public_body/view_email_captcha" end def list diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 3bca4677e..402232be4 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -70,7 +70,7 @@ <h1><%= "Public authorities " + ((@page-1)*@bodies_per_page+1).to_s + "-" + [@page*@bodies_per_page, @xapian_bodies.matches_estimated].min.to_s + " of " + @xapian_bodies.matches_estimated.to_s + " for '" + h(@query) + "'" %></h1> <% for result in @xapian_bodies.results %> - <%= render :partial => 'body/body_listing_single', :locals => { :public_body => result[:model] } %> + <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %> diff --git a/app/views/body/_alphabet.rhtml b/app/views/public_body/_alphabet.rhtml index 92674b8aa..92674b8aa 100644 --- a/app/views/body/_alphabet.rhtml +++ b/app/views/public_body/_alphabet.rhtml diff --git a/app/views/body/_body_listing.rhtml b/app/views/public_body/_body_listing.rhtml index 7d673a552..48eb649c2 100644 --- a/app/views/body/_body_listing.rhtml +++ b/app/views/public_body/_body_listing.rhtml @@ -2,6 +2,6 @@ None found. <% else %> <% for public_body in public_bodies %> - <%= render :partial => 'body/body_listing_single', :locals => { :public_body => public_body } %> + <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => public_body } %> <% end %> <% end %> diff --git a/app/views/body/_body_listing_single.rhtml b/app/views/public_body/_body_listing_single.rhtml index c3c1c6730..c3c1c6730 100644 --- a/app/views/body/_body_listing_single.rhtml +++ b/app/views/public_body/_body_listing_single.rhtml diff --git a/app/views/body/list.rhtml b/app/views/public_body/list.rhtml index 8496fdd35..8496fdd35 100644 --- a/app/views/body/list.rhtml +++ b/app/views/public_body/list.rhtml diff --git a/app/views/body/show.rhtml b/app/views/public_body/show.rhtml index 4c9df8646..4c9df8646 100644 --- a/app/views/body/show.rhtml +++ b/app/views/public_body/show.rhtml diff --git a/app/views/body/view_email.rhtml b/app/views/public_body/view_email.rhtml index 9c61ff0fa..9c61ff0fa 100644 --- a/app/views/body/view_email.rhtml +++ b/app/views/public_body/view_email.rhtml diff --git a/app/views/body/view_email_captcha.rhtml b/app/views/public_body/view_email_captcha.rhtml index 13741c292..13741c292 100644 --- a/app/views/body/view_email_captcha.rhtml +++ b/app/views/public_body/view_email_captcha.rhtml diff --git a/config/routes.rb b/config/routes.rb index 788ce8afc..11bdf9e48 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: routes.rb,v 1.87 2009-05-11 13:06:34 tony Exp $ +# $Id: routes.rb,v 1.88 2009-06-22 12:54:45 francis Exp $ ActionController::Routing::Routes.draw do |map| @@ -58,7 +58,7 @@ ActionController::Routing::Routes.draw do |map| user.river '/river', :action => 'river' end - map.with_options :controller => 'body' do |body| + map.with_options :controller => 'public_body' do |body| body.list_public_bodies "/body", :action => 'list' body.list_public_bodies "/body/list/:tag", :action => 'list' body.show_public_body "/body/:url_name", :action => 'show' diff --git a/spec/controllers/body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 6d108c686..aae72dad9 100644 --- a/spec/controllers/body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -1,6 +1,6 @@ require File.dirname(__FILE__) + '/../spec_helper' -describe BodyController, "when showing a body" do +describe PublicBodyController, "when showing a body" do integrate_views fixtures :public_bodies, :public_body_versions @@ -21,16 +21,16 @@ describe BodyController, "when showing a body" do it "should redirect to newest name if you use historic name of public body in URL" do get :show, :url_name => "hdink" - response.should redirect_to(:controller => 'body', :action => 'show', :url_name => "dfh") + response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh") end it "should redirect to lower case name if you use mixed case name in URL" do get :show, :url_name => "dFh" - response.should redirect_to(:controller => 'body', :action => 'show', :url_name => "dfh") + response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh") end end -describe BodyController, "when listing bodies" do +describe PublicBodyController, "when listing bodies" do integrate_views fixtures :public_bodies, :public_body_versions diff --git a/spec/views/body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb index 24f86aafb..fbd05b9d1 100644 --- a/spec/views/body/show.rhtml_spec.rb +++ b/spec/views/public_body/show.rhtml_spec.rb @@ -31,47 +31,47 @@ describe "when viewing a body" do end it "should be successful" do - render "body/show" + render "public_body/show" response.should be_success end it "should be valid HTML" do - render "body/show" + render "public_body/show" validate_as_body response.body end it "should show the body's name" do - render "body/show" + render "public_body/show" response.should have_tag("h1", "Test Quango") end it "should tell total number of requests" do - render "body/show" + render "public_body/show" response.should have_tag("h2", "4 Freedom of Information requests made") end it "should cope with no results" do @xap.stub!(:results).and_return([]) - render "body/show" + render "public_body/show" response.should have_tag("p", /Nobody has made any Freedom of Information requests/m) end it "should cope with Xapian being down" do assigns[:xapian_requests] = nil - render "body/show" + render "public_body/show" response.should have_tag("p", /The search index is currently offline/m) end it "should link to Charity Commission site if we have a number" do @pb.stub!(:charity_number).and_return('98765') - render "body/show" + render "public_body/show" response.should have_tag("div#request_sidebar") do with_tag("a[href*=?]", /charity-commission.gov.uk.*RegisteredCharityNumber=98765$/) end end it "should not link to Charity Commission site if we don't have number" do - render "body/show" + render "public_body/show" response.should have_tag("div#request_sidebar") do without_tag("a[href*=?]", /charity-commission.gov.uk/) end |