diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/services_controller.rb | 32 | ||||
-rw-r--r-- | app/views/help/_sidebar.rhtml | 1 | ||||
-rw-r--r-- | app/views/help/alaveteli.rhtml | 30 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 6 | ||||
-rw-r--r-- | app/views/public_body/show.rhtml | 29 | ||||
-rw-r--r-- | app/views/request/_request_filter_form.rhtml | 38 | ||||
-rw-r--r-- | app/views/request/_sidebar.rhtml | 5 | ||||
-rw-r--r-- | app/views/request/list.rhtml | 2 | ||||
-rw-r--r-- | app/views/track/_tracking_links.rhtml | 5 | ||||
-rw-r--r-- | app/views/user/show.rhtml | 6 |
10 files changed, 117 insertions, 37 deletions
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb new file mode 100644 index 000000000..6fb20336e --- /dev/null +++ b/app/controllers/services_controller.rb @@ -0,0 +1,32 @@ +# controllers/application.rb: +# Parent class of all controllers in FOI site. Filters added to this controller +# apply to all controllers in the application. Likewise, all the methods added +# will be available for all controllers. +# +# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. +# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# +# $Id: application.rb,v 1.59 2009-09-17 13:01:56 francis Exp $ + +require 'open-uri' + +class ServicesController < ApplicationController + def other_country_message + text = "" + iso_country_code = MySociety::Config.get('ISO_COUNTRY_CODE').downcase + if country_from_ip.downcase != iso_country_code + found_country = WorldFOIWebsites.by_code(country_from_ip) + found_country_name = !found_country.nil? && found_country[:country_name] + if found_country_name + text = _("Hello! You can make Freedom of Information requests within {{country_name}} at {{link_to_website}}", :country_name => found_country_name, :link_to_website => "<a href=\"#{found_country[:url]}\">#{found_country[:name]}</a>") + else + current_country = WorldFOIWebsites.by_code(iso_country_code)[:country_name] + text = _("Hello! We have an <a href=\"/help/alaveteli?country_name=#{CGI.escape(current_country)}\">important message</a> for visitors outside {{country_name}}", :country_name => current_country) + end + end + if !text.empty? + text += ' <span class="close-button">X</span>' + end + render :text => text, :content_type => "text/plain" # XXX workaround the HTML validation in test suite + end +end diff --git a/app/views/help/_sidebar.rhtml b/app/views/help/_sidebar.rhtml index b6d26271e..db69f283b 100644 --- a/app/views/help/_sidebar.rhtml +++ b/app/views/help/_sidebar.rhtml @@ -5,6 +5,7 @@ <li><%= link_to_unless_current "Making requests", "/help/requesting" %></li> <li><%= link_to_unless_current "Your privacy", "/help/privacy" %></li> <li><%= link_to_unless_current "FOI officers", "/help/officers" %></li> + <li><%= link_to_unless_current "About the software", "/help/alaveteli" %></li> <li><%= link_to_unless_current "Credits", "/help/credits" %></li> <li><%= link_to_unless_current "Programmers API", "/help/api" %></li> <li><%= link_to_unless_current "Advanced search", "/search" %></li> diff --git a/app/views/help/alaveteli.rhtml b/app/views/help/alaveteli.rhtml new file mode 100644 index 000000000..f7accdd11 --- /dev/null +++ b/app/views/help/alaveteli.rhtml @@ -0,0 +1,30 @@ +<% @title = "Making requests" %> + +<%= render :partial => 'sidebar' %> +<div id="left_column"> + <% if params[:country_name] %> + <h1><%= _("Would you like to see a website like this in your country?") %></h1> + <% else %> + <h1>Powered by Alaveteli</h1> + <% end %> + <p>This website is powered by Alaveteli. Alaveteli is free software + for making Freedom of Information requests. It can easily be + translated into any language, and customised for variations of FOI + law.</p> + + <p>The development of Alaveteli is sponsored and supported by a + number of foundataions and charities who are interested in + transparency across the world.</p> + + <p>If you would like to set up an Alaveteli website in your own + country, we can help. You will need a few days to get the site + configured and ready to use, and will then have to spend at least an + hour a week moderating and managing the site (more for busy + websites).</p> + + <p>Read more on the <a href="http://alaveteli.org">Alaveteli + website</a>, or <a href="mailto:hello@alaveteli.org">drop us an + email</a>.</p> + + <div id="hash_link_padding"></div> +</div> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 75ba167e8..c802e7d45 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -20,7 +20,7 @@ <%= stylesheet_link_tag 'main', :title => "Main", :rel => "stylesheet" %> <%= stylesheet_link_tag 'fonts', :rel => "stylesheet" %> <%= stylesheet_link_tag 'theme', :rel => "stylesheet" %> - <%= javascript_include_tag 'jquery.js', 'jquery-ui.min' %> + <%= javascript_include_tag 'jquery.js', 'jquery-ui.min','jquery.cookie.js', 'general.js' %> <%= stylesheet_link_tag 'admin-theme/jquery-ui-1.8.15.custom.css', :rel => 'stylesheet'%> <!--[if LT IE 7]> <style type="text/css">@import url("/stylesheets/ie6.css");</style> @@ -132,7 +132,7 @@ </div> </div> <div id="wrapper"> - + <div id="content"> <% if flash[:notice] %> @@ -143,6 +143,8 @@ <% end %> <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_name %>"> + + <div id="other-country-notice"></div> <%= yield :layout %> </div> </div> diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index f7583614c..7091e2eec 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -2,7 +2,11 @@ <div id="main_content"> <div> <div id="header_right"> - <h2><%= _('Track this authority')%></h2> + <h2><%= _('Follow this authority')%></h2> + + <% follower_count = TrackThing.count(:all, :conditions => ["public_body_id = ?", @public_body.id]) %> + <p><%= n_("There is %d person following this authority", "There are %d people following this authority", follower_count) % follower_count %></p> + <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %> <h2><%= _('More about this authority')%></h2> <% if !@public_body.calculated_home_page.nil? %> @@ -24,6 +28,7 @@ </div> <div id="header_left"> + <p class="public-body-name-prefix">Freedom of information requests to</p> <h1><%=h(@public_body.name)%></h1> <p class="subtitle"> @@ -48,7 +53,7 @@ <% if @public_body.eir_only? %> <%= _('Make a new <strong>Environmental Information</strong> request')%> <% else %> - <%= _('Make a new <strong>Freedom of Information</strong> request')%> + <%= _('Make a new <strong>Freedom of Information</strong> request to {{public_body}}', :public_body => h(@public_body.name))%> <% end %> <%= _('<a class="link_button_green" href="{{url}}">{{text}}</a>', :url=>new_request_to_body_url(:url_name => @public_body.url_name), :text=>_("Start"))%> <% elsif @public_body.has_notes? %> @@ -63,9 +68,7 @@ <% end %> </div> </div> -</div> -<div style="clear:both"> </div> -<% if !@xapian_requests.nil? %> + <% if @public_body.info_requests.size == 0 %> <% if @public_body.eir_only? %> <h2><%= _('Environmental Information Regulations requests made using this site') %></h2> @@ -76,15 +79,26 @@ <% end %> <% else %> <h2 class="foi_results"> + <% if @public_body.eir_only? %> <%= pluralize(@public_body.info_requests.size, "Environmental Information Regulations request made using this site") %> <% else %> - <%= n_('%d Freedom of Information request made using this site', '%d Freedom of Information requests made using this site', @public_body.info_requests.size) % @public_body.info_requests.size %> + <% if @public_body.info_requests.size > 1 %> + <%= n_('Search within the %d Freedom of Information requests to %s', 'Search within the %d Freedom of Information requests made to %s', @public_body.info_requests.size) % [@public_body.info_requests.size, @public_body.name] %> + <% else %> + <%= n_('%d Freedom of Information request to %s', '%d Freedom of Information requests to %s', @public_body.info_requests.size) % [@public_body.info_requests.size, @public_body.name] %> + <% end %> <% end %> <%= @page_desc %> </h2> + <% if @public_body.info_requests.size > 1 %> + <%= render :partial => 'request/request_filter_form' %> + <% end %> + <% end %> - <%= render :partial => 'request/request_filter_form' %> +</div> +<div style="clear:both"> </div> +<% if !@xapian_requests.nil? %> <% for result in @xapian_requests.results %> <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> @@ -98,7 +112,6 @@ <p> <%= _('Only requests made using {{site_name}} are shown.', :site_name => site_name) %></p> <% end %> - <% end %> <% else %> <% if @public_body.eir_only? %> <h2><%= _('Environmental Information Regulations requests made') %></h2> diff --git a/app/views/request/_request_filter_form.rhtml b/app/views/request/_request_filter_form.rhtml index c1848c59a..ac133889d 100644 --- a/app/views/request/_request_filter_form.rhtml +++ b/app/views/request/_request_filter_form.rhtml @@ -1,25 +1,6 @@ <%= render :partial => 'general/localised_datepicker' %> <div id="list-filter"> - <div class="list-filter-item"> - <h3 class="title"><%= _("Showing") %></h3> - <% statuses = [["all", _("all requests")], - ["successful", _("successful requests")], - ["unsuccessful", _("unsuccessful requests")], - ["awaiting", _("unresolved requests")]] %> - <% for status, label in statuses %> - <% if params[:view] != status %> - <% if params[:controller] == "public_body" %> - <%= link_to label, url_for(:controller => "public_body", :action => "show", :view => status, :url_name => @public_body.url_name) + "?" + request.query_string %> - <% else %> - <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string %> - <% end %> - <% else %> - <%= label %> - <% end %> - <%= "|" unless statuses.last[0] == status %> - <% end %> - </div> <% form_tag(request.path, :method => "get", :id=>"filter_requests_form") do %> <div class="list-filter-item"> <%= label_tag(:query, _("Keywords"), :class=>"form_label title") %> @@ -44,6 +25,25 @@ <%= label_tag(:query, _("and"), :class=>"form_label") %> <%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %> </div> + <div class="list-filter-item"> + <h3 class="title">Showing</h3> + <% statuses = [["all", _("all requests")], + ["successful", _("successful requests")], + ["unsuccessful", _("unsuccessful requests")], + ["awaiting", _("unresolved requests")]] %> + <% for status, label in statuses %> + <% if params[:view] != status %> + <% if params[:controller] == "public_body" %> + <%= link_to label, url_for(:controller => "public_body", :action => "show", :view => status, :url_name => @public_body.url_name) + "?" + request.query_string %> + <% else %> + <%= link_to label, url_for(:controller => "request", :action => "list", :view => status) + "?" + request.query_string %> + <% end %> + <% else %> + <%= label %> + <% end %> + <%= "|" unless statuses.last[0] == status %> + <% end %> + </div> <div class="list-filter-item"> <%= submit_tag(_("Search")) %> diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index e562c4f6a..62ece4821 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -1,5 +1,8 @@ <div id="right_column"> - <h2><%= _('Track this request') %></h2> + <h2><%= _('Follow this request') %></h2> + + <% follower_count = TrackThing.count(:all, :conditions => ["info_request_id = ?", @info_request.id]) + 1 %> + <p><%= n_("There is %d person following this request", "There are %d people following this request", follower_count) % follower_count %></p> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => @info_request.user == @user, :location => 'sidebar' } %> <h2><%= _("Act on what you've learnt") %></h2> diff --git a/app/views/request/list.rhtml b/app/views/request/list.rhtml index 88d4279e1..0137cb6dd 100644 --- a/app/views/request/list.rhtml +++ b/app/views/request/list.rhtml @@ -5,7 +5,7 @@ </div> <div id="header_right"> - <h2><%= _("Track these requests") %></h2> + <h2><%= _("Follow these requests") %></h2> <% if @track_thing %> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> <% end %> diff --git a/app/views/track/_tracking_links.rhtml b/app/views/track/_tracking_links.rhtml index 53688867c..f50a8bbbf 100644 --- a/app/views/track/_tracking_links.rhtml +++ b/app/views/track/_tracking_links.rhtml @@ -4,11 +4,10 @@ end %> - <% if own_request %> <p><%= _('This is your own request, so you will be automatically emailed when new responses arrive.')%></p> <% elsif existing_track %> - <% form_tag({:controller => 'track', :action => 'update', :track_id => existing_track.id}, :class => "feed_form_" + location) do %> + <% form_tag({:controller => 'track', :action => 'update', :track_id => existing_track.id}, :class => "feed_form feed_form_" + location) do %> <p> <%= track_thing.params[:verb_on_page_already] %> <%= hidden_field_tag 'track_medium', "delete" %> @@ -19,7 +18,7 @@ <% elsif track_thing %> <div class="feed_link feed_link_<%=location%>"> <%= link_to '<img src="/images/email-16.png" alt="">', do_track_url(track_thing) %> - <%= link_to _("Track by email"), do_track_url(track_thing) %> + <%= link_to _("Follow by email"), do_track_url(track_thing) %> </div> <div class="feed_link feed_link_<%=location%>"> diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 63f9fe3a0..4c7635c5e 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -186,7 +186,7 @@ <% else %> <h2 id="email_subscriptions"> Your <%=pluralize(@track_things.size, _('email subscription')) %> </h2> <% if @track_things_grouped.size == 1 %> - <% form_tag :controller => 'track', :action => 'delete_all_type' do %> + <% form_tag ({:controller => 'track', :action => 'delete_all_type'}, :class => "feed_form") do %> <h3> <%=TrackThing.track_type_description(@track_things[0].track_type)%> <%= hidden_field_tag 'track_type', @track_things[0].track_type %> @@ -200,7 +200,7 @@ <% end %> <% for track_type, track_things in @track_things_grouped %> <% if @track_things_grouped.size > 1 %> - <% form_tag :controller => 'track', :action => 'delete_all_type' do %> + <% form_tag ({:controller => 'track', :action => 'delete_all_type'}, :class => "feed_form") do %> <h3> <%=TrackThing.track_type_description(track_type)%> <%= hidden_field_tag 'track_type', track_type %> @@ -216,7 +216,7 @@ <ul> <% for track_thing in track_things %> <li> - <% form_tag :controller => 'track', :action => 'update', :track_id => track_thing.id do %> + <% form_tag ({:controller => 'track', :action => 'update', :track_id => track_thing.id}, :class => "feed_form") do %> <div> <%= track_thing.params[:list_description] %> <%= hidden_field_tag 'track_medium', "delete", { :id => 'track_medium_' + track_thing.id.to_s } %> |