Fix mobile page 500 error when there's no adbanner named "Home"

This commit is contained in:
manson 2014-04-28 10:23:24 +08:00
parent d23a956085
commit f342c585c6
1 changed files with 6 additions and 0 deletions

View File

@ -1,8 +1,11 @@
<% unless @ad_banner.nil? %>
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class="orbit-cycle-slideshow" data-cycle-timeout="<%= @ad_banner.timeout_millisecond %>" data-cycle-fx="<%= @ad_banner.ad_fx %>" data-cycle-random='true' style="z-index: 0">
<% @ad_banner.ad_images.can_display.each do |image| %>
<%= image_tag image.file.url, width: @ad_banner.width, height: @ad_banner.height %>
<% end %>
</div>
<% end %>
<div class="newlist clear">
<% @bulletins.each do |bulletin| %>
<div class="newitem">
@ -17,6 +20,8 @@
</div>
<% end %>
</div>
<% unless @ad_banner.nil? %>
<script type='text/javascript'>
$(function(){
if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){
@ -33,3 +38,4 @@
}
});
</script>
<% end %>