diff options
-rw-r--r-- | app/helpers/application_helper.rb | 19 | ||||
-rw-r--r-- | app/models/raw_email.rb | 4 | ||||
-rw-r--r-- | app/views/help/api.rhtml | 2 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 4 | ||||
-rw-r--r-- | app/views/request/select_authority.rhtml | 4 | ||||
-rw-r--r-- | config/environment.rb | 11 | ||||
-rw-r--r-- | lib/world_foi_websites.rb | 6 | ||||
-rw-r--r-- | public/stylesheets/main.css | 2 | ||||
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/application_mailer_spec.rb | 6 |
10 files changed, 31 insertions, 36 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ab953cb25..5c856383b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -77,25 +77,6 @@ module ApplicationHelper return LanguageNames::get_language_name(locale) end - # Use our own algorithm for finding path of cache - def foi_cache(name = {}, options = nil, &block) - if @controller.perform_caching - key = name.merge(:only_path => true) - key_path = @controller.foi_fragment_cache_path(key) - - if @controller.foi_fragment_cache_exists?(key_path) - cached = @controller.foi_fragment_cache_read(key_path) - output_buffer.concat(cached) - return - end - - pos = output_buffer.length - content = block.call - @controller.foi_fragment_cache_write(key_path, output_buffer[pos..-1]) - else - block.call - end - end # (unfortunately) ugly way of getting id of generated form element # ids # see http://chrisblunt.com/2009/10/12/rails-getting-the-id-of-form-fields-inside-a-fields_for-block/ diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb index bae144931..de7978b82 100644 --- a/app/models/raw_email.rb +++ b/app/models/raw_email.rb @@ -22,7 +22,7 @@ class RawEmail < ActiveRecord::Base if request_id.empty? raise "Failed to find the id number of the associated request: has it been saved?" end - + if ENV["RAILS_ENV"] == "test" return File.join(Rails.root, 'files/raw_email_test') else @@ -49,7 +49,7 @@ class RawEmail < ActiveRecord::Base end def data - File.open(self.filepath, "rb").read + File.open(self.filepath, "r").read end def destroy_file_representation! diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml index 76d2992fb..facddce41 100644 --- a/app/views/help/api.rhtml +++ b/app/views/help/api.rhtml @@ -51,11 +51,11 @@ <dd> <p>Quite a few pages have JSON versions, which let you download information about objects in a structured form. Find them by: + </p> <ul> <li>Adding <tt>.json</tt> to the end of the URL. </li> <li>Look for the <tt><link rel="alternate" type="application/json"></tt> tag in the head of the HTML. </li> </ul> - </p> <p>Requests, users and authorities all have JSON versions containing basic information about them. Every Atom feed has a JSON equivalent, containing diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 76bdbd2dd..29ff209b9 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -140,11 +140,11 @@ </div> <% unless Configuration::ga_code.empty? || (@user && @user.super?) %> - <script> + <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> - <script> + <script type="text/javascript"> var pageTracker = _gat._getTracker("<%= Configuration::ga_code %>"); pageTracker._trackPageview(); </script> diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml index 521136f8e..1166c3ff9 100644 --- a/app/views/request/select_authority.rhtml +++ b/app/views/request/select_authority.rhtml @@ -31,7 +31,7 @@ <div id="authority_selection"> <% form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %> - <p> + <div> <p> <%= _('First, type in the <strong>name of the UK public authority</strong> you\'d like information from. <strong>By law, they have to respond</strong> @@ -40,7 +40,7 @@ <%= text_field_tag 'query', params[:query], { :size => 30 } %> <%= hidden_field_tag 'bodies', 1 %> <%= submit_tag _('Search') %> - </p> + </div> <% end %> <div id="typeahead_response"> <% if !@xapian_requests.nil? %> diff --git a/config/environment.rb b/config/environment.rb index de20e73e4..492446a43 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,8 +1,14 @@ # Be sure to restart your web server when you modify this file. - -# the default encoding for IO is utf-8, and we use utf-8 internally if RUBY_VERSION.to_f >= 1.9 + # the default encoding for IO is utf-8, and we use utf-8 internally Encoding.default_external = Encoding.default_internal = Encoding::UTF_8 + # Suppress warning messages and require inflector to avoid iconv deprecation message + # "iconv will be deprecated in the future, use String#encode instead." when loading + # it as part of rails + original_verbose, $VERBOSE = $VERBOSE, nil + require 'active_support/inflector' + # Activate warning messages again. + $VERBOSE = original_verbose end # Uncomment below to force Rails into production mode when @@ -20,7 +26,6 @@ $:.push(File.join(File.dirname(__FILE__), '../commonlib/rblib')) # ... if these fail to include, you need the commonlib submodule from git # (type "git submodule update --init" in the whatdotheyknow directory) -# ruby-ole and ruby-msg. We use a custom ruby-msg to avoid a name conflict $:.unshift(File.join(File.dirname(__FILE__), '../vendor/plugins/globalize2/lib')) load "validate.rb" diff --git a/lib/world_foi_websites.rb b/lib/world_foi_websites.rb index 2ff924713..c3f3655df 100644 --- a/lib/world_foi_websites.rb +++ b/lib/world_foi_websites.rb @@ -46,10 +46,10 @@ class WorldFOIWebsites :country_name => "Chile", :country_iso_code => "CL", :url => "http://accesointeligente.org"}, - {:country_name => "Australia", + {:name => "Right To Know", + :country_name => "Australia", :country_iso_code => "AU", - # The Australian site is not yet live. So, not including name & url yet. - }, + :url => "http://www.righttoknow.org.au"}, {:name => "Informace pro Vsechny", :country_name => "Česká republika", :country_iso_code => "CZ", diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 93230cf4f..23c4b32ae 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -562,7 +562,7 @@ max-width:50em; text-align:left; background-color:#E7E7E7; border-bottom:1px solid #5f5f5f; -height:6%; +height:3em; padding:0.5em 1em; } diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 08e68d85e..18341ae6f 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -39,7 +39,14 @@ describe ApplicationController, "when caching fragments" do it "should not fail with long filenames" do long_name = "blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah.txt" - path = self.controller.send(:foi_fragment_cache_path, long_name) + params = { :only_path => true, + :file_name => [long_name], + :controller => "request", + :action => "get_attachment_as_html", + :id => "132", + :incoming_message_id => "44", + :part => "2" } + path = self.controller.send(:foi_fragment_cache_path, params) self.controller.send(:foi_fragment_cache_write, path, "whassap") end diff --git a/spec/models/application_mailer_spec.rb b/spec/models/application_mailer_spec.rb index a90f79c01..acf5f43bc 100644 --- a/spec/models/application_mailer_spec.rb +++ b/spec/models/application_mailer_spec.rb @@ -80,7 +80,8 @@ describe ApplicationMailer do it 'should raise an error if the template is in neither core nor theme' do prepend_theme_views('theme_one') - lambda{ ApplicationMailer.create_neither() }.should raise_error('Missing template application_mailer/neither.erb in view path spec/fixtures/theme_views/theme_one:spec/fixtures/theme_views/core') + expected_error = 'Missing template application_mailer/neither.erb in view path' + lambda{ ApplicationMailer.create_neither() }.should raise_error(/#{expected_error}/) end it 'should render a multipart email using a theme template' do @@ -125,7 +126,8 @@ describe ApplicationMailer do it 'should raise an error if the template is in neither core nor theme' do append_theme_views('theme_one') - lambda{ ApplicationMailer.create_neither() }.should raise_error('Missing template application_mailer/neither.erb in view path spec/fixtures/theme_views/core:spec/fixtures/theme_views/theme_one') + expected_error = 'Missing template application_mailer/neither.erb in view path' + lambda{ ApplicationMailer.create_neither() }.should raise_error(/#{expected_error}/) end it 'should render a multipart email using a core template' do |