Move conditional into shared banner partial

To avoid always writing if has_banners? every time the partial is used it has been moved within this partial.
This commit is contained in:
decabeza
2020-05-08 12:00:03 +02:00
parent dcf0a50b73
commit 8e01b11569
6 changed files with 11 additions and 19 deletions

View File

@@ -1,6 +1,4 @@
<% if has_banners? %>
<%= render "shared/banner" %>
<% end %>
<%= render "shared/banner" %>
<% provide :title do %><%= t("budgets.index.title") %><% end %>

View File

@@ -40,9 +40,7 @@
<div class="row">
<div id="debates" class="debates-list small-12 medium-9 column">
<% if has_banners? %>
<%= render "shared/banner" %>
<% end %>
<%= render "shared/banner" %>
<% unless @search_terms || !has_featured? %>
<%= render "featured_debates" %>

View File

@@ -3,9 +3,7 @@
<%= render "shared/canonical", href: help_url %>
<% end %>
<% if has_banners? %>
<%= render "shared/banner" %>
<% end %>
<%= render "shared/banner" %>
<div class="jumbo light">
<div class="row">

View File

@@ -49,9 +49,7 @@
<div class="row">
<div id="proposals" class="proposals-list small-12 medium-9 column">
<% if has_banners? %>
<%= render "shared/banner" %>
<% end %>
<%= render "shared/banner" %>
<% if show_featured_proposals? %>
<div id="featured-proposals" class="row featured-proposals">

View File

@@ -1,4 +1,6 @@
<% banner ||= @banners.sample %>
<div class="banner" style="background-color:<%= banner.background_color %>;">
<%= sanitize banner_target_link(banner), attributes: %w[href style] %>
</div>
<% if has_banners? || controller.class == Admin::BannersController %>
<% banner ||= @banners.sample %>
<div class="banner" style="background-color:<%= banner.background_color %>;">
<%= sanitize banner_target_link(banner), attributes: %w[href style] %>
</div>
<% end %>

View File

@@ -4,9 +4,7 @@
<%= render "shared/canonical", href: root_url %>
<% end %>
<% if has_banners? %>
<%= render "shared/banner" %>
<% end %>
<%= render "shared/banner" %>
<% provide :social_media_meta_tags do %>
<%= render "shared/social_media_meta_tags",