diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/public_body_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 3 | ||||
-rw-r--r-- | app/models/about_me_validator.rb | 2 | ||||
-rw-r--r-- | app/models/foi_attachment.rb | 4 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 1 | ||||
-rw-r--r-- | app/views/admin_general/timeline.rhtml | 10 | ||||
-rw-r--r-- | app/views/general/_topnav.rhtml | 4 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 2 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 2 | ||||
-rw-r--r-- | app/views/request/select_authority.rhtml | 6 | ||||
-rw-r--r-- | app/views/user/show.rhtml | 2 |
11 files changed, 21 insertions, 17 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 62229a441..c31134641 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -129,7 +129,7 @@ class PublicBodyController < ApplicationController end PublicBody.with_locale(@locale) do @public_bodies = PublicBody.paginate( - :order => "public_body_translations.name", :page => params[:page], :per_page => 1000, # fit all councils on one page + :order => "public_body_translations.name", :page => params[:page], :per_page => 100, :conditions => conditions, :joins => :translations ) diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 8672fdf75..f3bbd6708 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -814,7 +814,8 @@ class RequestController < ApplicationController for message in info_request.incoming_messages attachments = message.get_attachments_for_display for attachment in attachments - zipfile.get_output_stream(attachment.display_filename) { |f| + filename = "#{attachment.url_part_number}_#{attachment.display_filename}" + zipfile.get_output_stream(filename) { |f| f.puts(attachment.body) } end diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb index ec2b03201..e24c5512c 100644 --- a/app/models/about_me_validator.rb +++ b/app/models/about_me_validator.rb @@ -21,7 +21,7 @@ class AboutMeValidator < ActiveRecord::BaseWithoutTable def validate if !self.about_me.blank? && self.about_me.size > 500 - errors.add(_("Please keep it shorter than 500 characters")) + errors.add(:about_me, _("Please keep it shorter than 500 characters")) end end diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb index 057dcdb69..16e202bee 100644 --- a/app/models/foi_attachment.rb +++ b/app/models/foi_attachment.rb @@ -19,7 +19,7 @@ class FoiAttachment < ActiveRecord::Base before_destroy :delete_cached_file! def directory - base_dir = File.join("cache", "attachments_#{ENV['RAILS_ENV']}") + base_dir = File.join(File.dirname(__FILE__), "../../cache", "attachments_#{ENV['RAILS_ENV']}") return File.join(base_dir, self.hexdigest[0..2]) end @@ -302,7 +302,7 @@ class FoiAttachment < ActiveRecord::Base body = $1.to_s body_without_tags = body.gsub(/\s+/,"").gsub(/\<[^\>]*\>/, "") contains_images = html.match(/<img/mi) ? true : false - if !$?.success? || html.size == 0 || (body_without_tags.size == 0 && !contains_images) + if html.size == 0 || !$?.success? || (body_without_tags.size == 0 && !contains_images) ret = "<html><head></head><body>"; if self.has_google_docs_viewer? wrapper_id = "wrapper_google_embed" diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 4ea89bf81..3514702da 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -147,6 +147,7 @@ class InfoRequestEvent < ActiveRecord::Base return event.calculated_state end end + return end def waiting_classification diff --git a/app/views/admin_general/timeline.rhtml b/app/views/admin_general/timeline.rhtml index dc72e46cd..39a4b3e36 100644 --- a/app/views/admin_general/timeline.rhtml +++ b/app/views/admin_general/timeline.rhtml @@ -36,10 +36,9 @@ end %> <% elsif event.event_type == 'edit_outgoing' %> - <% outgoing_messages = OutgoingMessage.find(:all, event.params[:outgoing_message_id].to_i) %> + <% outgoing_message = OutgoingMessage.find(event.params[:outgoing_message_id].to_i) %> had outgoing message edited by administrator <strong><%=h event.params[:editor] %></strong>. - <% if outgoing_messages.size > 0 %> - <% outgoing_message = outgoing_messages[0] %> + <% if outgoing_message %> <% for p in ['body'] if event.params[p.to_sym] != event.params[('old_'+p).to_sym] %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <% @@ -50,10 +49,9 @@ Missing outgoing message, internal error. <% end %> <% elsif event.event_type == 'edit_comment' %> - <% comments = Comment.find(:all, event.params[:comment_id].to_i) %> + <% comment = Comment.find(event.params[:comment_id].to_i) %> had annotation edited by administrator <strong><%=h event.params[:editor] %></strong>. - <% if comments.size > 0 %> - <% comment = comments[0] %> + <% if comment %> <% for p in ['body'] if event.params[p.to_sym] != event.params[('old_'+p).to_sym] %> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <% diff --git a/app/views/general/_topnav.rhtml b/app/views/general/_topnav.rhtml index 619ff3593..8ef928bba 100644 --- a/app/views/general/_topnav.rhtml +++ b/app/views/general/_topnav.rhtml @@ -1,10 +1,10 @@ <div id="topnav"> <ul id="navigation"> - <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' %>"><%= link_to _("Home"), frontpage_url %></li> + <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' and params[:action] != 'search' %>"><%= link_to _("Home"), frontpage_url %></li> <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("Make a request"), select_authority_url, :id => 'make-request-link' %></li> <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("View requests"), request_list_successful_url %></li> <li class="<%= 'selected' if params[:controller] == 'public_body' %>"><%= link_to _("View authorities"), list_public_bodies_default %></li> <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_url %></li> <li class="<%= 'selected' if params[:controller] == 'help' %>"><%= link_to _("Help"), help_about_url %></li> </ul> -</div>
\ No newline at end of file +</div> diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml index 35751b6a4..da45a8c37 100644 --- a/app/views/general/frontpage.rhtml +++ b/app/views/general/frontpage.rhtml @@ -60,7 +60,7 @@ <%= public_body_link(event.info_request.public_body) %> <%= _('answered a request about') %> <%=link_to h(event.info_request.title), request_url(event.info_request)%> <%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(event.described_at)) %> - <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.info_request.title, "", 200) %></p> + <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.search_text_main(true), "", 200) %></p> </li> <% end %> </ul> diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 87a6ab446..43aa9785a 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -187,6 +187,8 @@ <%= render :partial => 'user/user_listing_single', :locals => { :display_user => result[:model] } %> <% end %> </div> + <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %> + <% end %> </div> diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml index 55ebc40c4..1e78168e9 100644 --- a/app/views/request/select_authority.rhtml +++ b/app/views/request/select_authority.rhtml @@ -14,7 +14,7 @@ })); // We're using the existing body list: we intercept the clicks on the titles to // display a preview on the right hand side of the screen - $("#typeahead_response a").live('click', function() { + $("#typeahead_response .head a").live('click', function() { $("#authority_preview").load(this.href+" #public_body_show", function() { $("#authority_preview").show(); $("#authority_preview #header_right").hide(); @@ -33,7 +33,7 @@ <p> <p> <%= _('First, type in the <strong>name of the UK public authority</strong> you\'d - <br>like information from. <strong>By law, they have to respond</strong> + like information from. <strong>By law, they have to respond</strong> (<a href="%s">why?</a>).') % help_about_url %> </p> <%= text_field_tag 'query', params[:query], { :size => 30 } %> @@ -56,6 +56,8 @@ <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %> <% end %> </div> + <%= will_paginate WillPaginate::Collection.new(@page, 10, @xapian_requests.matches_estimated) %> + <% end %> diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 9ac203541..9845f6b89 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -147,7 +147,7 @@ <% end %> <% else %> <h2 class="foi_results" id="foi_requests"> - <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.results.size) % @xapian_requests.results.size : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_requests.results.size) % @xapian_requests.results.size %> + <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.results.size) % @xapian_requests.results.size : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_bodies.matches_estimated.to_s) % @xapian_bodies.matches_estimated %> <!-- matches_estimated <%=@xapian_requests.matches_estimated%> --> <%= @match_phrase %> <%= @page_desc %> |