diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/general_controller.rb | 4 | ||||
-rw-r--r-- | app/models/public_body.rb | 7 | ||||
-rw-r--r-- | app/views/admin_public_body/_form.html.erb | 12 | ||||
-rw-r--r-- | app/views/general/_footer.html.erb | 2 | ||||
-rw-r--r-- | app/views/general/_topnav.html.erb | 2 | ||||
-rw-r--r-- | app/views/request/_act.html.erb | 15 | ||||
-rw-r--r-- | app/views/request/_sidebar.html.erb | 17 |
7 files changed, 34 insertions, 25 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index aac078829..b01a67027 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -17,6 +17,10 @@ class GeneralController < ApplicationController # Display blog entries def blog + if AlaveteliConfiguration::blog_feed.empty? + raise ActiveRecord::RecordNotFound.new("Page not enabled") + end + medium_cache @feed_autodetect = [] @feed_url = AlaveteliConfiguration::blog_feed diff --git a/app/models/public_body.rb b/app/models/public_body.rb index eb0905f9e..933825d2a 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -260,13 +260,13 @@ class PublicBody < ActiveRecord::Base # When name or short name is changed, also change the url name def short_name=(short_name) - globalize.write(I18n.locale, :short_name, short_name) + globalize.write(Globalize.locale, :short_name, short_name) self[:short_name] = short_name self.update_url_name end def name=(name) - globalize.write(I18n.locale, :name, name) + globalize.write(Globalize.locale, :name, name) self[:name] = name self.update_url_name end @@ -742,7 +742,8 @@ class PublicBody < ActiveRecord::Base # either from config, or based on a (slow!) query if not set body_short_names = AlaveteliConfiguration::frontpage_publicbody_examples.split(/\s*;\s*/) locale_condition = 'public_body_translations.locale = ?' - conditions = [locale_condition, locale] + underscore_locale = locale.gsub '-', '_' + conditions = [locale_condition, underscore_locale] bodies = [] I18n.with_locale(locale) do if body_short_names.empty? diff --git a/app/views/admin_public_body/_form.html.erb b/app/views/admin_public_body/_form.html.erb index 18bf1d15b..5a80386ec 100644 --- a/app/views/admin_public_body/_form.html.erb +++ b/app/views/admin_public_body/_form.html.erb @@ -51,12 +51,6 @@ </div> </div> <div class="control-group"> - <label for="<%= form_tag_id(t.object_name, :disclosure_log, locale) %>" class="control-label"><%=_("Disclosure log URL")%></label> - <div class="controls"> - <%= t.text_field :disclosure_log, :size => 60, :id => form_tag_id(t.object_name, :disclosure_log, locale), :class => "span3" %> - </div> - </div> - <div class="control-group"> <label for="<%= form_tag_id(t.object_name, :notes, locale) %>" class="control-label"><%=_("Public notes")%></label> <div class="controls"> <%= t.text_area :notes, :rows => 3, :id => form_tag_id(t.object_name, :notes, locale), :class => "span6" %> @@ -89,6 +83,12 @@ </div> </div> <div class="control-group"> + <label for="public_body_disclosure_log" class="control-label"><%=_("Disclosure log URL")%></label> + <div class="controls"> + <%= f.text_field :disclosure_log, :size => 60, :class => "span4" %> + </div> +</div> +<div class="control-group"> <label for="public_body_last_edit_comment" class="control-label"><strong>Comment</strong> for this edit</label> <div class="controls"> <%= f.text_area :last_edit_comment, :rows => 3, :class => "span6" %></p> diff --git a/app/views/general/_footer.html.erb b/app/views/general/_footer.html.erb index 04c60be3d..2e10a0f94 100644 --- a/app/views/general/_footer.html.erb +++ b/app/views/general/_footer.html.erb @@ -1,6 +1,8 @@ <div id="footer"> <%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_path %> +<% unless AlaveteliConfiguration::twitter_username.blank? %> | <%= image_tag "twitter-16.png", :alt => "twitter icon", :class => "twitter-icon" %> <a href="https://twitter.com/<%= AlaveteliConfiguration::twitter_username %>"><%= _("Follow us on twitter") %></a> +<% end %> <%= render :partial => 'general/credits' %> </div> <div class="after-footer"> </div> diff --git a/app/views/general/_topnav.html.erb b/app/views/general/_topnav.html.erb index c7f2cedea..d37bd97d1 100644 --- a/app/views/general/_topnav.html.erb +++ b/app/views/general/_topnav.html.erb @@ -4,7 +4,9 @@ <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("Make a request"), select_authority_path, :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_path %></li> <li class="<%= 'selected' if params[:controller] == 'public_body' %>"><%= link_to _("View authorities"), list_public_bodies_default_path %></li> +<% unless AlaveteliConfiguration::blog_feed.empty? %> <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_path %></li> +<% end %> <li class="<%= 'selected' if params[:controller] == 'help' %>"><%= link_to _("Help"), help_about_path %></li> </ul> </div> diff --git a/app/views/request/_act.html.erb b/app/views/request/_act.html.erb new file mode 100644 index 000000000..1199cb4a2 --- /dev/null +++ b/app/views/request/_act.html.erb @@ -0,0 +1,15 @@ +<h2><%= _("Act on what you've learnt") %></h2> + +<div class="act_link"> + <% tweet_link = "https://twitter.com/share?" + {:url => request.url, :via => AlaveteliConfiguration::twitter_username, :text => "'#{@info_request.title}'", :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name)}.to_query %> + <% link_to tweet_link do %> + <%= image_tag "twitter-16.png", :alt => "twitter icon" %> + <% end %> + <%= link_to _("Tweet this request"), tweet_link %> +</div> +<div class="act_link"> + <%= link_to "http://wordpress.com/" do %> + <%= image_tag "wordpress.png", :class => "rss" %> + <% end %> + <%= link_to _("Start your own blog"), "http://wordpress.com/"%> +</div> diff --git a/app/views/request/_sidebar.html.erb b/app/views/request/_sidebar.html.erb index 8400cd6ac..0f7965ffa 100644 --- a/app/views/request/_sidebar.html.erb +++ b/app/views/request/_sidebar.html.erb @@ -33,22 +33,7 @@ <%= link_to _("Report this request"), new_request_report_path(:request_id => @info_request.url_title) %> <% end %> <% end %> - <h2><%= _("Act on what you've learnt") %></h2> - - <div class="act_link"> - <% tweet_link = "https://twitter.com/share?" + {:url => request.url, :via => AlaveteliConfiguration::twitter_username, :text => "'#{@info_request.title}'", :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name)}.to_query %> - <% link_to tweet_link do %> - <%= image_tag "twitter-16.png", :alt => "twitter icon" %> - <% end %> - <%= link_to _("Tweet this request"), tweet_link %> - </div> - <div class="act_link"> - <%= link_to "http://wordpress.com/" do %> - <%= image_tag "wordpress.png", :class => "rss" %> - <% end %> - <%= link_to _("Start your own blog"), "http://wordpress.com/"%> - </div> - + <%= render :partial => 'request/act' %> <%= render :partial => 'request/next_actions' %> <% cache_if_caching_fragments(@similar_cache_key, :expires_in => 1.day) do %> |