diff options
-rwxr-xr-x | app/helpers/link_to_helper.rb | 3 | ||||
-rw-r--r-- | app/views/contact_mailer/from_admin_message.text.erb | 1 | ||||
-rw-r--r-- | app/views/general/search.html.erb | 27 | ||||
-rw-r--r-- | app/views/request/show.html.erb | 1 | ||||
-rw-r--r-- | config/general.yml-example | 5 | ||||
-rw-r--r-- | lib/mail_handler/backends/mail_extensions.rb | 5 | ||||
-rw-r--r-- | spec/models/info_request_spec.rb | 27 |
7 files changed, 48 insertions, 21 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 238a36ce4..5533402c5 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -218,9 +218,6 @@ module LinkToHelper return url end - def search_link(query, variety_postfix = nil, sort_postfix = nil, advanced = nil) - link_to h(query), search_url(query) - end def search_path(query, options = {}) search_url(query, options.merge(:only_path => true)) diff --git a/app/views/contact_mailer/from_admin_message.text.erb b/app/views/contact_mailer/from_admin_message.text.erb index 4169d8d3a..3af759c5d 100644 --- a/app/views/contact_mailer/from_admin_message.text.erb +++ b/app/views/contact_mailer/from_admin_message.text.erb @@ -1,2 +1 @@ <%= raw @message %> - diff --git a/app/views/general/search.html.erb b/app/views/general/search.html.erb index 6234687f2..d526a93c0 100644 --- a/app/views/general/search.html.erb +++ b/app/views/general/search.html.erb @@ -35,15 +35,23 @@ <% end %> </div> <% else %> - <%= form_tag(request.url, {:method => "get", :id => "search_form"}) do %> + + + <%= form_tag(search_redirect_path, {:method => "get", :id => "search_form"}) do %> <p> <%= text_field_tag 'query', params[:query], { :size => 40, :title => "type your search term here" } %> + + <%= submit_tag _("Search") %> + <%= link_to(_("Advanced search"), advanced_search_path) %> + </p> + <% end %> + <%= form_tag(request.url, {:method => "get", :id => "filter_form"}) do %> + <p> <%= hidden_field_tag 'sortby', @inputted_sortby %> <% if @bodies %> <%= hidden_field_tag 'bodies', 1 %> <% end %> - <%= submit_tag _("Search") %> - <%= link_to(_("Advanced search"), advanced_search_path) %> + </p> <div id="common-subfilters"> @@ -63,18 +71,6 @@ <%= "|" unless variety == labels.last[0]%> <% end %> </div> - - <% if false %> - <%-# Commented out for now as tags are of limited use when users can't see them. This will change in the future! -%> - <% if @variety_postfix != "users" %> - <div> - <%= label_tag(:query, _("Tags (separated by a space):")) %><%= text_field_tag(:tags, params[:tags], { :size => 20 }) %> - <% for tag in InfoRequest.get_tags %> - <%= tag.name_and_value %> - <% end %> - </div> - <% end %> - <% end %> </div> <% if @variety_postfix == "requests" %> @@ -139,7 +135,6 @@ <% end %> <div style="clear:both;"></div> - <% if @total_hits == 0 %> <h2><%=@title %></h2> <% end %> diff --git a/app/views/request/show.html.erb b/app/views/request/show.html.erb index 4b0663f76..1d5b9977f 100644 --- a/app/views/request/show.html.erb +++ b/app/views/request/show.html.erb @@ -25,6 +25,7 @@ <div id="left_column"> <h1><%=h(@info_request.title)%></h1> + <% if !@info_request.is_external? && @info_request.user.profile_photo %> <p class="user_photo_on_request"> <img src="<%= get_profile_photo_url(:url_name => @info_request.user.url_name) %>" alt=""> diff --git a/config/general.yml-example b/config/general.yml-example index 0753af46b..2cca2a1c1 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -172,6 +172,11 @@ VARNISH_HOST: localhost # Adding a value here will enable Google Analytics on all non-admin pages for non-admin users. GA_CODE: '' +# We need to add the WDTK survey variables here, or else the deployment +# system will cry. +SURVEY_SECRET: '' +SURVEY_URL: '' + # If you want to override *all* the public body request emails with your own # email so that request emails that would normally go to the public body # go to you, then uncomment below and fill in your email. diff --git a/lib/mail_handler/backends/mail_extensions.rb b/lib/mail_handler/backends/mail_extensions.rb index 322c49bb5..6d6a20f8c 100644 --- a/lib/mail_handler/backends/mail_extensions.rb +++ b/lib/mail_handler/backends/mail_extensions.rb @@ -78,7 +78,10 @@ module Mail # invalid character at the end of the string, even # with UTF-8//IGNORE: # http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ - str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str + " ")[0...-4] + begin + str = Iconv.conv('UTF-8//IGNORE', fix_encoding(encoding), str + " ")[0...-4] + rescue Iconv::InvalidEncoding + end end str end diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index f9ca44657..9b1ea0da5 100644 --- a/spec/models/info_request_spec.rb +++ b/spec/models/info_request_spec.rb @@ -454,6 +454,33 @@ describe InfoRequest do end + describe 'when an instance is asked if all can view it' do + + before do + @info_request = InfoRequest.new + end + + it 'should return true if its prominence is normal' do + @info_request.prominence = 'normal' + @info_request.all_can_view?.should == true + end + + it 'should return true if its prominence is backpage' do + @info_request.prominence = 'backpage' + @info_request.all_can_view?.should == true + end + + it 'should return false if its prominence is hidden' do + @info_request.prominence = 'hidden' + @info_request.all_can_view?.should == false + end + + it 'should return false if its prominence is requester_only' do + @info_request.prominence = 'requester_only' + @info_request.all_can_view?.should == false + end + end + describe 'when applying censor rules' do before do |