adbanner-test/app/views/admin/ad_banners/_index_table.html.erb

71 lines
2.8 KiB
Plaintext
Raw Normal View History

2016-01-05 11:57:19 +00:00
<% content_for :page_specific_css do %>
<style type="text/css">
.slide-img{
width: 100%;
height: 140px;
background-repeat: no-repeat;
}
</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| %>
<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| %>
<div class="slide-img" style=" background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;"></div>
<% end %>
<% else %>
<div class="slide-img" style="background: 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('http://placehold.it/<%= banner.width %>x<%= banner.height %>/666&text=B'); background-size: cover; background-position: center;"></div>
<% end %>
</div>
</td>
<td>
<a href="<%= admin_ad_banner_path(banner.id) %>"><%= banner.title rescue "" %> </a>
<div class="quick-edit">
<ul class="nav nav-pills">
2016-01-05 12:35:31 +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>
</td>
<td>
<%= banner.category.title rescue "" %>
</td>
</tr>
<% 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>