diff options
-rw-r--r-- | app/controllers/services_controller.rb | 6 | ||||
-rw-r--r-- | app/models/user.rb | 11 | ||||
-rw-r--r-- | app/views/general/frontpage.rhtml | 11 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 2 | ||||
-rw-r--r-- | config/general.yml-example | 2 | ||||
-rw-r--r-- | lib/world_foi_websites.rb | 6 |
6 files changed, 27 insertions, 11 deletions
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index ead5d73b7..38bf51772 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -9,13 +9,13 @@ class ServicesController < ApplicationController iso_country_code = Configuration::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] old_fgt_locale = FastGettext.locale begin FastGettext.locale = FastGettext.best_locale_in(request.env['HTTP_ACCEPT_LANGUAGE']) - 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>") + if found_country && found_country[:country_name] && found_country[:url] && found_country[:name] + text = _("Hello! You can make Freedom of Information requests within {{country_name}} at {{link_to_website}}", + :country_name => found_country[: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) diff --git a/app/models/user.rb b/app/models/user.rb index 59f6c971c..4a68d60d1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -246,6 +246,11 @@ class User < ActiveRecord::Base # Does the user magically gain powers as if they owned every request? # e.g. Can classify it def owns_every_request? + self.super? + end + + # Does this user have extraordinary powers? + def super? self.admin_level == 'super' end @@ -255,18 +260,18 @@ class User < ActiveRecord::Base # Can the user see every request, even hidden ones? def User.view_hidden_requests?(user) - !user.nil? && user.admin_level == 'super' + !user.nil? && user.super? end # Should the user be kept logged into their own account # if they follow a /c/ redirect link belonging to another user? def User.stay_logged_in_on_redirect?(user) - !user.nil? && user.admin_level == 'super' + !user.nil? && user.super? end # Does the user get "(admin)" links on each page on the main site? def admin_page_links? - self.admin_level == 'super' + self.super? end # Is it public that they are banned? def public_banned? diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml index 7f25cdd14..ec7b9bd8f 100644 --- a/app/views/general/frontpage.rhtml +++ b/app/views/general/frontpage.rhtml @@ -63,11 +63,18 @@ <ul> <% for event in @request_events %> <li> - <%= public_body_link(event.info_request.public_body) %> <%= _('answered a request about') %> + <% if @request_events_all_successful %> + <%= _("{{public_body_link}} answered a request about", + :public_body_link => public_body_link(event.info_request.public_body)) %> + <% else %> + <%= _("{{public_body_link}} was sent a request about", + :public_body_link => public_body_link(event.info_request.public_body)) %> + <% end %> + <%=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.search_text_main(true), "", 200) %></p> - </li> + </li> <% end %> </ul> <p><strong> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 0dd493fd0..7b4c0f6a1 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -139,7 +139,7 @@ <input type="text"> </div> <% - unless Configuration::ga_code.empty? %> + unless Configuration::ga_code.empty? || (@user && @user.super?) %> <script> 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")); diff --git a/config/general.yml-example b/config/general.yml-example index 9646e45c8..1b30ffce6 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -160,7 +160,7 @@ MAX_REQUESTS_PER_USER_PER_DAY: 6 # unset if you aren't running behind varnish VARNISH_HOST: localhost -# Adding a value here will enable Google Analytics on all non-admin pages. +# Adding a value here will enable Google Analytics on all non-admin pages for non-admin users. GA_CODE: '' # If you want to override *all* the public body request emails with your own diff --git a/lib/world_foi_websites.rb b/lib/world_foi_websites.rb index f175afd3d..8cfd0dfae 100644 --- a/lib/world_foi_websites.rb +++ b/lib/world_foi_websites.rb @@ -45,7 +45,11 @@ class WorldFOIWebsites {:name => "Acceso Intelligente", :country_name => "Chile", :country_iso_code => "CL", - :url => "http://accesointeligente.org"}] + :url => "http://accesointeligente.org"}, + {:country_name => "Australia", + :country_iso_code => "AU", + # The Australian site is not yet live. So, not including name & url yet. + }] return world_foi_websites end |