2016-01-05 11:57:19 +00:00
|
|
|
<% content_for :page_specific_css do %>
|
|
|
|
<style type="text/css">
|
2023-07-04 06:30:03 +00:00
|
|
|
.slide-img{
|
|
|
|
width: 100%;
|
|
|
|
height: 140px;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
}
|
2016-01-05 11:57:19 +00:00
|
|
|
</style>
|
|
|
|
<% end %>
|
|
|
|
<table class="table main-list">
|
|
|
|
<thead>
|
|
|
|
<tr class="sort-header">
|
|
|
|
<% @table_fields.each do |f| %>
|
|
|
|
<%= thead(f) %>
|
|
|
|
<% end %>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<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 %>
|
|
|
|
<% @banners.each do |banner| %>
|
2023-07-04 06:30:03 +00:00
|
|
|
<tr>
|
|
|
|
<td class="span5">
|
|
|
|
<div class="cycle-slideshow ad-banner-images "
|
|
|
|
data-cycle-slides=".slide-img"
|
|
|
|
data-cycle-fx="<%= banner.ad_fx %>"
|
|
|
|
data-cycle-speed="<%= banner.speed %>"
|
|
|
|
data-cycle-timeout="<%= banner.timeout.to_i*1000 %>"
|
|
|
|
>
|
|
|
|
<% if !banner.ad_images.can_display.blank? %>
|
|
|
|
<% banner.ad_images.can_display.desc(:created_at).each do |image| %>
|
|
|
|
<% if image.exchange_item == '1' %>
|
|
|
|
<div class="slide-img" style=" background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;"></div>
|
|
|
|
<% elsif image.video_snapshot.present? %>
|
|
|
|
<div class="slide-img" style=" background: url('<%= image.video_snapshot %>'); background-size: cover; background-position: center;"></div>
|
|
|
|
<% elsif image.exchange_item == '2' %>
|
|
|
|
<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 %>
|
2016-01-05 11:57:19 +00:00
|
|
|
|
2023-07-04 06:30:03 +00:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<a href="<%= admin_ad_banner_path(banner.id) %>"><%= banner.title rescue "" %> </a>
|
|
|
|
<div class="quick-edit">
|
2016-01-05 11:57:19 +00:00
|
|
|
<ul class="nav nav-pills">
|
2023-07-04 06:30:03 +00:00
|
|
|
<% if can_edit_or_delete?(banner) %>
|
|
|
|
<li><a href="<%= admin_ad_banner_path(banner.id) %>"><%= t("ad_banner.add") %></a></li>
|
|
|
|
<% end %>
|
2016-01-05 11:57:19 +00:00
|
|
|
<% if user_has_rights %>
|
|
|
|
<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>
|
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2023-07-04 06:30:03 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<%= banner.category.title rescue "" %>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2016-01-05 11:57:19 +00:00
|
|
|
<% end %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class="bottomnav clearfix" style="left: 81px;">
|
|
|
|
<% if user_has_rights %>
|
|
|
|
<div class="action pull-right">
|
|
|
|
<a class="btn btn-primary" href="<%= new_admin_ad_banner_path %>">
|
|
|
|
<%= t("ad_banner.new_banner") %>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<%= content_tag :div, paginate(@banners), class: "pagination pagination-centered" %>
|
|
|
|
</div>
|