aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-06-11 14:57:29 -0700
committerLouise Crow <louise.crow@gmail.com>2013-06-11 14:57:29 -0700
commitbe4a2e1de69d4c12a018052f3906ddd8ea5587f1 (patch)
treeaf73257f1ec30cb621c4d827f4543ba0d362e2d2
parent7e0ff79a97d9085d60f88d9d211102a758eb3087 (diff)
Only render the popup banner in the layout where it's actually used.
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/views/layouts/default.html.erb6
2 files changed, 3 insertions, 7 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d1d702616..a8ba52e4f 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -27,7 +27,6 @@ class ApplicationController < ActionController::Base
before_filter :check_in_post_redirect
before_filter :session_remember_me
before_filter :set_vary_header
- before_filter :set_popup_banner
def set_vary_header
response.headers['Vary'] = 'Cookie'
@@ -540,9 +539,6 @@ class ApplicationController < ActionController::Base
return country
end
- def set_popup_banner
- @popup_banner = render_to_string(:partial => "general/popup_banner").strip.html_safe
- end
# URL generating functions are needed by all controllers (for redirects),
# views (for links) and mailers (for use in emails), so include them into
# all of all.
diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb
index 023a93138..32ea5e4ff 100644
--- a/app/views/layouts/default.html.erb
+++ b/app/views/layouts/default.html.erb
@@ -67,11 +67,11 @@
<% if is_admin? %>
<%= render :partial => 'admin_general/admin_navbar' %>
<% end %>
-
-<% if !@popup_banner.blank? %>
+<% popup_banner = render(:partial => "general/popup_banner").strip %>
+<% if popup_banner.present? %>
<div id="everypage" class="jshide">
<p class="popup-close"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;"><%= _('Close') %></a></p>
- <%= @popup_banner %>
+ <%= raw popup_banner %>
<p class="popup-close"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;"><%= _('Close') %></a></p>
</div>
<% end %>