aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/general_controller.rb4
-rw-r--r--app/views/general/_footer.html.erb2
-rw-r--r--app/views/general/_topnav.html.erb2
-rw-r--r--spec/controllers/general_controller_spec.rb11
4 files changed, 19 insertions, 0 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/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">&nbsp;</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/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index e67cc9492..7590a5b42 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -42,6 +42,17 @@ describe GeneralController, 'when getting the blog feed' do
assigns[:blog_items].count.should == 1
end
+ context 'if no feed is configured' do
+
+ before do
+ AlaveteliConfiguration.stub!(:blog_feed).and_return('')
+ end
+
+ it 'should raise an ActiveRecord::RecordNotFound error' do
+ lambda{ get :blog }.should raise_error(ActiveRecord::RecordNotFound)
+ end
+ end
+
end
describe GeneralController, "when showing the frontpage" do