aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/public_body_controller.rb12
-rw-r--r--app/controllers/request_controller.rb1
-rw-r--r--app/models/application_mailer.rb4
-rw-r--r--app/views/general/_localised_datepicker.rhtml18
-rw-r--r--app/views/general/search.rhtml10
-rw-r--r--app/views/request/_request_filter_form.rhtml6
7 files changed, 35 insertions, 20 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index cb7f3b23d..cb64cb922 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -413,10 +413,10 @@ class ApplicationController < ActionController::Base
def get_date_range_from_params
query = ""
if param_exists(:request_date_after) && !param_exists(:request_date_before)
- params[:request_date_before] = Date.now.strftime("%d/%m/%Y")
+ params[:request_date_before] = Time.now.strftime("%d/%m/%Y")
query += " #{params[:request_date_after]}..#{params[:request_date_before]}"
elsif !param_exists(:request_date_after) && param_exists(:request_date_before)
- params[:request_date_after] = "01/01/2008"
+ params[:request_date_after] = "01/01/2001"
end
if param_exists(:request_date_after)
query = " #{params[:request_date_after]}..#{params[:request_date_before]}"
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index d7d8c2c56..830f37855 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -90,27 +90,27 @@ class PublicBodyController < ApplicationController
@query = "%#{params[:public_body_query].nil? ? "" : params[:public_body_query]}%"
@tag = params[:tag]
@locale = self.locale_from_params()
- locale_condition = "upper(public_body_translations.name) LIKE upper(?) AND public_body_translations.locale = ?"
+ locale_condition = "(upper(public_body_translations.name) LIKE upper(?) OR upper(public_body_translations.notes) LIKE upper (?)) AND public_body_translations.locale = ?"
if @tag.nil? or @tag == "all"
@tag = "all"
- conditions = [locale_condition, @query, @locale]
+ conditions = [locale_condition, @query, @query, @locale]
elsif @tag == 'other'
category_list = PublicBodyCategories::CATEGORIES.map{|c| "'"+c+"'"}.join(",")
conditions = [locale_condition + ' AND (select count(*) from has_tag_string_tags where has_tag_string_tags.model_id = public_bodies.id
and has_tag_string_tags.model = \'PublicBody\'
- and has_tag_string_tags.name in (' + category_list + ')) = 0', @query, @locale]
+ and has_tag_string_tags.name in (' + category_list + ')) = 0', @query, @query, @locale]
elsif @tag.size == 1
@tag.upcase!
- conditions = [locale_condition + ' AND public_body_translations.first_letter = ?', @query, @locale, @tag]
+ conditions = [locale_condition + ' AND public_body_translations.first_letter = ?', @query, @query, @locale, @tag]
elsif @tag.include?(":")
name, value = HasTagString::HasTagStringTag.split_tag_into_name_value(@tag)
conditions = [locale_condition + ' AND (select count(*) from has_tag_string_tags where has_tag_string_tags.model_id = public_bodies.id
and has_tag_string_tags.model = \'PublicBody\'
- and has_tag_string_tags.name = ? and has_tag_string_tags.value = ?) > 0', @query, @locale, name, value]
+ and has_tag_string_tags.name = ? and has_tag_string_tags.value = ?) > 0', @query, @query, @locale, name, value]
else
conditions = [locale_condition + ' AND (select count(*) from has_tag_string_tags where has_tag_string_tags.model_id = public_bodies.id
and has_tag_string_tags.model = \'PublicBody\'
- and has_tag_string_tags.name = ?) > 0', @query, @locale, @tag]
+ and has_tag_string_tags.name = ?) > 0', @query, @query, @locale, @tag]
end
if @tag.size == 1
@description = _("beginning with") + " '" + @tag + "'"
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 3c283baae..79b8e4816 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -134,6 +134,7 @@ class RequestController < ApplicationController
@title = "View and search requests"
sortby = "newest"
@page = get_search_page_from_params if !@page # used in cache case, as perform_search sets @page as side effect
+
behavior_cache :tag => [@view, @page] do
xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse')
@list_results = xapian_object.results.map { |r| r[:model] }
diff --git a/app/models/application_mailer.rb b/app/models/application_mailer.rb
index 9628d7339..e9f82a2c3 100644
--- a/app/models/application_mailer.rb
+++ b/app/models/application_mailer.rb
@@ -15,8 +15,8 @@ class ApplicationMailer < ActionMailer::Base
self.raise_delivery_errors = true
def contact_from_name_and_email
- contact_name = MySociety::Config.get("CONTACT_NAME", 'contact@localhost')
- contact_email = MySociety::Config.get("CONTACT_EMAIL", 'Alaveteli')
+ contact_name = MySociety::Config.get("CONTACT_NAME", 'Alaveteli')
+ contact_email = MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost')
return "#{contact_name} <#{contact_email}>"
end
diff --git a/app/views/general/_localised_datepicker.rhtml b/app/views/general/_localised_datepicker.rhtml
new file mode 100644
index 000000000..5fdd63644
--- /dev/null
+++ b/app/views/general/_localised_datepicker.rhtml
@@ -0,0 +1,18 @@
+<script type="text/javascript">
+ $(function() {
+ $(".use-datepicker").datepicker(
+ {closeText: '<%= _("Done") %>',
+ prevText: '<%= _("Prev") %>',
+ nextText: '<%= _("Next") %>',
+ currentText: '<%= _("Today") %>',
+ monthNames: <%= I18n.translate('date.month_names')[1..-1].to_json %>,
+ monthNamesShort: <%= I18n.translate('date.abbr_month_names')[1..-1].to_json %>,
+ dayNames: <%= I18n.translate('date.day_names').to_json %>,
+ dayNamesShort: <%= I18n.translate('date.abbr_day_names').to_json %>,
+ dayNamesMin: <%= I18n.translate('date.abbr_day_names').collect{|x| x[0..0]}.to_json %>,
+ weekHeader: '<%= _("Wk") %>',
+ dateFormat: '<%= I18n.translate('date.formats.default').sub("%Y", "yy").sub("%m", "mm").sub("%d", "dd").gsub("-", "/") %>'}
+ );
+ });
+</script>
+
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml
index 694ab932f..3e6a89582 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.rhtml
@@ -10,12 +10,8 @@
<% @include_request_link_in_authority_listing = true %>
<h1><%=@title%></h1>
-<script type="text/javascript">
- $(function() {
- $(".use-datepicker").datepicker({dateFormat: 'yy-mm-dd'});
- });
-</script>
+<%= render :partial => 'localised_datepicker' %>
<% if @advanced %>
<p><%= _('To use the advanced search, combine phrases and labels as described in the search tips below.') %></p>
@@ -168,7 +164,11 @@
<% if @xapian_requests_hits == 1 && @page == 1 %>
<h1><%= _("One FOI request matching your search", :user_search_query => h(@query)) %></h1>
<% else %>
+<<<<<<< HEAD
+ <h1><%= _("FOI requests {{start_count}} to {{end_count}} of {{total_count}}", :start_count => ((@page-1)*@requests_per_page+1).to_s, :end_count => [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s, :total_count => @xapian_requests.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
+=======
<h1><%= _("FOI requests {{start_count}} to {{end_count}} of {{total_count}}", :start_count => ((@page-1)*@requests_per_page+1).to_s, :end_count => [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s, :total_count => @xapian_requests.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
+>>>>>>> e8ff6d861faefb76c11475a112002cd1b0095590
<% end %>
<% if @track_thing %>
diff --git a/app/views/request/_request_filter_form.rhtml b/app/views/request/_request_filter_form.rhtml
index 122da9d33..33b7bfb27 100644
--- a/app/views/request/_request_filter_form.rhtml
+++ b/app/views/request/_request_filter_form.rhtml
@@ -1,8 +1,4 @@
-<script type="text/javascript">
- $(function() {
- $(".use-datepicker").datepicker();
- });
-</script>
+<%= render :partial => 'general/localised_datepicker' %>
<div id="list-filter">
<div class="list-filter-item">