Fix bug.
This commit is contained in:
parent
c5add605f9
commit
cfe0fd9c5a
|
@ -225,15 +225,21 @@
|
||||||
<% banner.ad_images.can_display.desc(:created_at).each do |image| %>
|
<% banner.ad_images.can_display.desc(:created_at).each do |image| %>
|
||||||
<% if image.exchange_item == '1' %>
|
<% if image.exchange_item == '1' %>
|
||||||
<div class="slide-img" style=" background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;"></div>
|
<div class="slide-img" style=" background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;"></div>
|
||||||
<% elsif image.video_snapshot %>
|
<% elsif image.video_snapshot.present? %>
|
||||||
<div class="slide-img" style=" background: url('<%= image.video_snapshot %>'); background-size: cover; background-position: center;"></div>
|
<div class="slide-img" style=" background: url('<%= image.video_snapshot %>'); background-size: cover; background-position: center;"></div>
|
||||||
<% elsif image.exchange_item == '2' %>
|
<% elsif image.exchange_item == '2' %>
|
||||||
<div class="slide-img" style=" background: url('<%= image.youtube_thumb %>'); background-size: cover; background-position: center;"></div>
|
<div class="slide-img" style=" background: url('<%= image.youtube_thumb %>'); background-size: cover; background-position: center;"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="slide-img" style="background: url('/annc_url?url=http://placehold.it/<%= banner.width %>x<%= banner.height %>/888&text=A'); background-size: cover; background-position: center;"></div>
|
<%
|
||||||
<div class="slide-img" style="background: url('/annc_url?url=http://placehold.it/<%= banner.width %>x<%= banner.height %>/666&text=B'); background-size: cover; background-position: center;"></div>
|
width = banner.width
|
||||||
|
height = banner.height
|
||||||
|
width = 200 if width.blank?
|
||||||
|
height = 80 if height.blank?
|
||||||
|
%>
|
||||||
|
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= width %>x<%= height %>/888&text=A'); background-size: cover; background-position: center;"></div>
|
||||||
|
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= width %>x<%= height %>/666&text=B'); background-size: cover; background-position: center;"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<% content_for :page_specific_css do %>
|
<% content_for :page_specific_css do %>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.slide-img{
|
.slide-img{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 140px;
|
height: 140px;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<% end %>
|
<% end %>
|
||||||
<table class="table main-list">
|
<table class="table main-list">
|
||||||
|
@ -18,43 +18,55 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<% user_has_rights = (current_user.is_admin? ? true : (current_user.is_manager?(@module_app) ? true : current_user.is_manager_with_role?(@module_app) ? true : false)) rescue false %>
|
<% user_has_rights = (current_user.is_admin? ? true : (current_user.is_manager?(@module_app) ? true : current_user.is_manager_with_role?(@module_app) ? true : false)) rescue false %>
|
||||||
<% @banners.each do |banner| %>
|
<% @banners.each do |banner| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="span5">
|
<td class="span5">
|
||||||
<div class="cycle-slideshow ad-banner-images "
|
<div class="cycle-slideshow ad-banner-images "
|
||||||
data-cycle-slides=".slide-img"
|
data-cycle-slides=".slide-img"
|
||||||
data-cycle-fx="<%= banner.ad_fx %>"
|
data-cycle-fx="<%= banner.ad_fx %>"
|
||||||
data-cycle-speed="<%= banner.speed %>"
|
data-cycle-speed="<%= banner.speed %>"
|
||||||
data-cycle-timeout="<%= banner.timeout.to_i*1000 %>"
|
data-cycle-timeout="<%= banner.timeout.to_i*1000 %>"
|
||||||
>
|
>
|
||||||
<% if !banner.ad_images.can_display.blank? %>
|
<% if !banner.ad_images.can_display.blank? %>
|
||||||
<% banner.ad_images.can_display.desc(:created_at).each do |image| %>
|
<% banner.ad_images.can_display.desc(:created_at).each do |image| %>
|
||||||
<div class="slide-img" style=" background: url('<%= image.exchange_item == "1" ? image.file.thumb.url : image.youtube_thumb %>'); background-size: cover; background-position: center;"></div>
|
<% if image.exchange_item == '1' %>
|
||||||
<% end %>
|
<div class="slide-img" style=" background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;"></div>
|
||||||
<% else %>
|
<% elsif image.video_snapshot.present? %>
|
||||||
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= banner.width %>x<%= banner.height %>/888&text=A'); background-size: cover; background-position: center;"></div>
|
<div class="slide-img" style=" background: url('<%= image.video_snapshot %>'); background-size: cover; background-position: center;"></div>
|
||||||
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= banner.width %>x<%= banner.height %>/666&text=B'); background-size: cover; background-position: center;"></div>
|
<% elsif image.exchange_item == '2' %>
|
||||||
<% end %>
|
<div class="slide-img" style=" background: url('<%= image.youtube_thumb %>'); background-size: cover; background-position: center;"></div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<%
|
||||||
|
width = banner.width
|
||||||
|
height = banner.height
|
||||||
|
width = 200 if width.blank?
|
||||||
|
height = 80 if height.blank?
|
||||||
|
%>
|
||||||
|
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= width %>x<%= height %>/888&text=A'); background-size: cover; background-position: center;"></div>
|
||||||
|
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= width %>x<%= height %>/666&text=B'); background-size: cover; background-position: center;"></div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<%= admin_ad_banner_path(banner.id) %>"><%= banner.title rescue "" %> </a>
|
<a href="<%= admin_ad_banner_path(banner.id) %>"><%= banner.title rescue "" %> </a>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<% if can_edit_or_delete?(banner) %>
|
<% if can_edit_or_delete?(banner) %>
|
||||||
<li><a href="<%= admin_ad_banner_path(banner.id) %>"><%= t("ad_banner.add") %></a></li>
|
<li><a href="<%= admin_ad_banner_path(banner.id) %>"><%= t("ad_banner.add") %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if user_has_rights %>
|
<% if user_has_rights %>
|
||||||
<li><a href="<%= edit_admin_ad_banner_path(banner.id, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
<li><a href="<%= edit_admin_ad_banner_path(banner.id, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
||||||
<li><a href="<%= admin_ad_banner_path(banner.id, :page => params[:page]) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?" ><%= t(:delete_) %></a></li>
|
<li><a href="<%= admin_ad_banner_path(banner.id, :page => params[:page]) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?" ><%= t(:delete_) %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= banner.category.title rescue "" %>
|
<%= banner.category.title rescue "" %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue