improves banners helper

This commit is contained in:
Alberto Garcia Cabeza
2017-04-28 13:05:05 +02:00
parent 73e46bf3f1
commit 442dc2dc70
4 changed files with 9 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
module BannersHelper module BannersHelper
def has_banners def has_banners?
@banners.count > 0 @banners.present? && @banners.count > 0
end end
end end

View File

@@ -27,7 +27,7 @@
<% end %> <% end %>
</div> </div>
<% if has_banners %> <% if has_banners? %>
<%= render "shared/banner" %> <%= render "shared/banner" %>
<% end %> <% end %>

View File

@@ -29,7 +29,7 @@
<% end %> <% end %>
</div> </div>
<% if has_banners %> <% if has_banners? %>
<%= render "shared/banner" %> <%= render "shared/banner" %>
<% end %> <% end %>

View File

@@ -1,9 +1,9 @@
<% banner = @banners.sample%> <% banner = @banners.sample %>
<div class="<%= banner.style %>"> <div class="<%= banner.style %>">
<div class="<%= banner.image %>"> <div class="<%= banner.image %>">
<%= link_to banner.target_url do %> <%= link_to banner.target_url do %>
<h2><%=banner.title%></h2> <h2><%=banner.title %></h2>
<h3><%=banner.description%></h3> <h3><%=banner.description %></h3>
<% end %> <% end %>
</div> </div>
</div> </div>