new layout for ad banner
This commit is contained in:
parent
e36bfddf0f
commit
62a05edc05
|
@ -60,7 +60,7 @@ $(function() {
|
||||||
bannerSpeed = null,
|
bannerSpeed = null,
|
||||||
bannerW = null,
|
bannerW = null,
|
||||||
bannerH = null,
|
bannerH = null,
|
||||||
$preview = $('#pageslide .preview');
|
$preview = $('.main-forms .preview');
|
||||||
|
|
||||||
$(".ad_banner_ad_fx").change(function () {
|
$(".ad_banner_ad_fx").change(function () {
|
||||||
var suckIE = false;
|
var suckIE = false;
|
||||||
|
|
|
@ -2,56 +2,62 @@ class Admin::AdBannersController < OrbitAdminController
|
||||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@table_fields = ["ad_banner.banner", :title, :category]
|
||||||
|
@categories = @module_app.categories.enabled
|
||||||
|
@filter_fields = filter_fields(@categories, [])
|
||||||
|
@filter_fields.delete(:status)
|
||||||
|
@filter_fields.delete(:tags)
|
||||||
@banners = Banner.all
|
@banners = Banner.all
|
||||||
@categories = @module_app.categories.enabled.collect{|c|[c.title, c.id]}
|
.order_by(sort)
|
||||||
|
.with_categories(filters("category"))
|
||||||
|
|
||||||
|
@banners = search_data(@banners,[:title]).page(params[:page]).per(6)
|
||||||
|
if request.xhr?
|
||||||
|
render :partial => "index_table"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@ad_banners = Banner.all
|
@banner = Banner.find(params[:id])
|
||||||
@active = Banner.find(params[:id])
|
@images = @banner.ad_images.desc(:created_at).page(params[:page]).per(10)
|
||||||
render :action => 'index'
|
@table_fields = [:banner, :title, "ad_banner.duration", :link]
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
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
|
||||||
@ad_banner = Banner.new
|
@ad_banner = Banner.new
|
||||||
render layout: false
|
render_401 if !user_has_rights
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@ad_banner = Banner.new(banner_params)
|
ad_banner = Banner.new(banner_params)
|
||||||
if @ad_banner.save
|
ad_banner.save
|
||||||
redirect_to admin_ad_banners_url
|
redirect_to admin_ad_banners_url
|
||||||
else
|
|
||||||
@ad_banner = Banner.new(params[:ad_banner])
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
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
|
||||||
@ad_banner = Banner.find(params[:id])
|
@ad_banner = Banner.find(params[:id])
|
||||||
render layout: false
|
render_401 if !user_has_rights
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@ad_banner = Banner.find(params[:id])
|
ad_banner = Banner.find(params[:id])
|
||||||
if @ad_banner.update_attributes(banner_params)
|
ad_banner.update_attributes(banner_params)
|
||||||
redirect_to admin_ad_banners_url, :status => 303
|
redirect_to params[:referer_url]
|
||||||
else
|
|
||||||
render :edit
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@ad_banner = Banner.find(params[:id])
|
ad_banner = Banner.find(params[:id])
|
||||||
@ad_banner.destroy
|
ad_banner.destroy
|
||||||
redirect_to admin_ad_banners_url
|
redirect_to admin_ad_banners_path(:page => params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def banner_params
|
def banner_params
|
||||||
params.require(:ad_banner).permit!
|
params.require(:banner).permit!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@ad_image = AdImage.find(params[:id])
|
@ad_image = AdImage.find(params[:id])
|
||||||
if can_edit_or_delete?(@ad_image)
|
if can_edit_or_delete?(@ad_image.banner)
|
||||||
@ad_banner = @ad_image.banner
|
@ad_banner = @ad_image.banner
|
||||||
else
|
else
|
||||||
render_401
|
render_401
|
||||||
|
@ -19,41 +19,33 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@ad_image = AdImage.find(params[:id])
|
ad_image = AdImage.find(params[:id])
|
||||||
if @ad_image.update_attributes(ad_image_params)
|
ad_image.update_attributes(ad_image_params)
|
||||||
redirect_to params['referer_url']
|
redirect_to params[:referer_url]
|
||||||
else
|
|
||||||
@ad_banners = Banner.all
|
|
||||||
@tags = @module_app.tags || []
|
|
||||||
render action: :edit
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@ad_image = AdImage.new
|
@ad_image = AdImage.new
|
||||||
@ad_banner = Banner.find(params[:banner])
|
@ad_banner = Banner.find(params[:banner_id])
|
||||||
@tags = @module_app.tags || []
|
if can_edit_or_delete?(@ad_banner)
|
||||||
|
@tags = @module_app.tags || []
|
||||||
@ad_image.postdate = Date.today
|
@ad_image.postdate = Date.today
|
||||||
|
else
|
||||||
|
render_401
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@ad_image = AdImage.new(ad_image_params)
|
@ad_image = AdImage.new(ad_image_params)
|
||||||
if @ad_image.save
|
@ad_image.save
|
||||||
redirect_to params['referer_url']
|
redirect_to params[:referer_url]
|
||||||
else
|
|
||||||
@ad_banners = Banner.all
|
|
||||||
@tags = @module_app.tags || []
|
|
||||||
@ad_image = AdImage.new(ad_image_params)
|
|
||||||
render action: :new
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@ad_image = AdImage.find params[:id]
|
ad_image = AdImage.find params[:id]
|
||||||
if @ad_image.destroy
|
banner = ad_image.banner
|
||||||
redirect_to admin_ad_banners_url
|
ad_image.destroy
|
||||||
end
|
redirect_to admin_ad_banner_path(banner.id, :page => params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,29 +1,96 @@
|
||||||
<%#= flash_messages %>
|
<% content_for :page_specific_css do %>
|
||||||
<%#= f.error_messages %>
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||||
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||||
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||||
|
<%= javascript_include_tag "lib/module-area" %>
|
||||||
|
<%= javascript_include_tag "validator" %>
|
||||||
|
<%= javascript_include_tag "cycle2" %>
|
||||||
|
<%= javascript_include_tag "ad_banner/banner_preview" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= f.label :title, t('ad_banner.banner_name') %>
|
<style type="text/css">
|
||||||
<%= f.text_field :title, class: 'input-large', placeholder: t('ad_banner.banner_name'), id: 'name' %>
|
.preview{
|
||||||
<span class="help-block"><%= t('ad_banner.name_only_english') %></span>
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!-- Input Area -->
|
||||||
|
<div class="input-area">
|
||||||
|
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||||||
|
<ul class="nav nav-pills module-nav">
|
||||||
|
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
||||||
|
</ul>
|
||||||
|
<!-- Module -->
|
||||||
|
<div class="tab-content module-area">
|
||||||
|
|
||||||
<%= f.label :timeout, t('ad_banner.transition_interval') %>
|
<!-- Basic Module -->
|
||||||
<%= f.number_field :timeout, in: 0..60, step: 1, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;", id: 'timeout' %>
|
<div class="tab-pane fade in active" id="basic">
|
||||||
<span class="help-block"><%= t('ad_banner.number_seconds') %></span>
|
<!-- Title-->
|
||||||
|
<div class="control-group">
|
||||||
<%= f.label :speed, t('ad_banner.transition_speed') %>
|
<%= f.label :title, t('ad_banner.banner_name'), :class => "control-label muted" %>
|
||||||
<%= f.number_field :speed, in: 0..1000, step: 100, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;", id: 'speed' %>
|
<div class="controls">
|
||||||
<span class="help-block"><%= t('ad_banner.number_milliseconds') %></span>
|
<%= f.text_field :title, class: 'input-large', placeholder: t('ad_banner.banner_name') %>
|
||||||
|
<span class="help-block"><%= t('ad_banner.name_only_english') %></span>
|
||||||
<%= f.label :size, t('ad_banner.size') %>
|
</div>
|
||||||
<span class="banner_set">Base Image:</span>
|
</div>
|
||||||
<%= f.number_field :base_image, in: 1..1, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;", id: 'base_image' %>
|
<!-- timeout -->
|
||||||
|
<div class="control-group">
|
||||||
<%= f.label :category_id, t('ad_banner.categories') %>
|
<%= f.label :timeout, t('ad_banner.transition_interval'), :class => "control-label muted" %>
|
||||||
<%= f.select :category_id, @categories, {} %>
|
<div class="controls">
|
||||||
|
<%= f.number_field :timeout, in: 0..60, step: 1, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
|
||||||
<%= f.label :ad_fx, t('ad_banner.effect') %>
|
<span class="help-block"><%= t('ad_banner.number_seconds') %></span>
|
||||||
<%= f.select :ad_fx, Banner::FX_TYPES, {}, {class: 'ad_banner_ad_fx', id: 'ad_fx'} %>
|
</div>
|
||||||
<p class="suckIE hide"><i class="icons-warning"></i> <%= t('ad_banner.no_ie_10_effect_support') %></p>
|
</div>
|
||||||
<div class="preview">
|
<!-- transition speed -->
|
||||||
<%= image_tag "slideshow_preview_A.png", width: "100%", height: 80 %>
|
<div class="control-group">
|
||||||
<%= image_tag "slideshow_preview_B.png", width: "100%", height: 80 %>
|
<%= f.label :speed, t('ad_banner.transition_speed'), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :speed, in: 0..1000, step: 100, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
|
||||||
|
<span class="help-block"><%= t('ad_banner.number_milliseconds') %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- size -->
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :size, t('ad_banner.size'), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :base_image, in: 1..(@ad_banner.new_record? ? 1 : (@ad_banner.ad_images.count == 0 ? 1 : @ad_banner.ad_images.count)), class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Category -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t(:category) %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= select_category(f, @module_app) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- effect -->
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :size, t('ad_banner.size'), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.select :ad_fx, Banner::FX_TYPES, {}, {class: 'ad_banner_ad_fx', id: 'ad_fx'} %>
|
||||||
|
<p class="suckIE hide"><i class="icons-warning"></i> <%= t('ad_banner.no_ie_10_effect_support') %></p>
|
||||||
|
<div class="preview">
|
||||||
|
<%= image_tag "slideshow_preview_A.png", width: "400", height: 80 %>
|
||||||
|
<%= image_tag "slideshow_preview_B.png", width: "400", height: 80 %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Form Actions -->
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
|
<input type="hidden" name="referer_url" value="<%= admin_ad_banners_path(:page => params[:page]) %>">
|
||||||
|
<%= link_to t('cancel'), admin_ad_banners_path(:page => params[:page]), :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<% if @ad_banner.new_record? %>
|
||||||
|
slideshow($(".preview"), "fade" , 2000, 1000);
|
||||||
|
<% else %>
|
||||||
|
slideshow($(".preview"), "<%= @ad_banner.ad_fx %>" , <%= @ad_banner.timeout * 1000 rescue 2000 %>, <%= @ad_banner.speed %>);
|
||||||
|
<% end %>
|
||||||
|
</script>
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if can_edit_or_delete?(banner) && current_user.is_admin? or current_user.is_manager?(@module_app) or current_user.is_sub_manager?(@module_app) %>
|
<% if can_edit_or_delete?(banner) %>
|
||||||
<div class="ad-banner-edit">
|
<div class="ad-banner-edit">
|
||||||
<a data-title="<%= t("ad_banner.setting") %>"
|
<a data-title="<%= t("ad_banner.setting") %>"
|
||||||
data-id="<%= banner.id.to_s %>"
|
data-id="<%= banner.id.to_s %>"
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<% 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">
|
||||||
|
<% 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>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @ad_banner, url: admin_ad_banner_path(@ad_banner), html: {class: "form-horizontal main-forms"} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render partial: 'form', locals: {f: f} %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
|
@ -3,52 +3,12 @@
|
||||||
<%= javascript_include_tag "cycle2" %>
|
<%= javascript_include_tag "cycle2" %>
|
||||||
<%= javascript_include_tag "ad_banner/banner_preview" %>
|
<%= javascript_include_tag "ad_banner/banner_preview" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= render_filter @filter_fields, "index_table" %>
|
||||||
<div id="banner_index">
|
<span id="index_table">
|
||||||
<%= render 'index' %>
|
<%= render 'index_table'%>
|
||||||
</div>
|
</span>
|
||||||
|
|
||||||
<% if current_user.is_admin? or current_user.is_manager?(@module_app) %>
|
|
||||||
<div class="bottomnav clearfix" style="left: 81px;">
|
|
||||||
<div class="action pull-right">
|
|
||||||
<a data-title="<%= t("ad_banner.new_banner") %>" data-id="new" data-fx="fade" class="btn btn-primary open-slide" href="#">
|
|
||||||
<i class="icon-plus"></i><%= t("ad_banner.new_banner") %>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="pagination pagination-centered"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="pageslide">
|
|
||||||
<div class="page-title clearfix">
|
|
||||||
<a class="pull-right" href="javascript:$.pageslide.close()">
|
|
||||||
<i class="icons-arrow-left-2"></i>
|
|
||||||
</a>
|
|
||||||
<span></span>
|
|
||||||
</div>
|
|
||||||
<div class="view-page">
|
|
||||||
<div class="nano">
|
|
||||||
<div class="content">
|
|
||||||
<%= form_for :ad_banner, url: nil, remote: true do |f| %>
|
|
||||||
<fieldset>
|
|
||||||
<%= render :partial => "form", :locals => { :f => f } %>
|
|
||||||
<div class="form-actions">
|
|
||||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
|
||||||
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).on("ajaxSuccess",function(event, xhr, settings){
|
||||||
$.pageslide.openCallback(function(form,element){
|
$(".cycle-slideshow").cycle();
|
||||||
form.find("#base_image").attr("max",element.data("max"));
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @ad_banner, url: admin_ad_banners_path, html: {class: "form-horizontal main-forms"} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render partial: 'form', locals: {f: f} %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,63 @@
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<style type="text/css">
|
||||||
|
.banner-image{
|
||||||
|
height: 140px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<% end %>
|
||||||
|
<h3><%= @banner.title %></h3>
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @images.each do |image| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= image_tag image.file.thumb, :class => "banner-image" %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= image.title rescue "" %>
|
||||||
|
<% if can_edit_or_delete?(@banner) %>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li><a href="<%= edit_admin_ad_image_path(image.id, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="<%= admin_ad_image_path(image.id, :page => params[:page]) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?" ><%= t(:delete_) %></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td class="span3">
|
||||||
|
<% if !image.postdate.nil? %>
|
||||||
|
<%= image.postdate.strftime("%Y-%m-%d %H:%M") rescue "" %>
|
||||||
|
<% if !image.deadline.nil? %>
|
||||||
|
~ <%= image.deadline.strftime("%Y-%m-%d %H:%M") rescue "" %>
|
||||||
|
<% if image.expired? %>
|
||||||
|
<span class="label"><%= t("ad_banner.expired") %></span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= image.out_link rescue "" %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<% if can_edit_or_delete?(@banner) %>
|
||||||
|
<div class="bottomnav clearfix" style="left: 81px;">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<a class="btn btn-primary" href="<%= new_admin_ad_image_path(:page => params[:page], :banner_id => @banner.id) %>">
|
||||||
|
<%= t("ad_banner.add") %>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<%= content_tag :div, paginate(@images), class: "pagination pagination-centered" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -26,5 +26,6 @@ en:
|
||||||
all: All
|
all: All
|
||||||
categories: Categories
|
categories: Categories
|
||||||
add: Add
|
add: Add
|
||||||
|
duration: Duration
|
||||||
setting: Settings
|
setting: Settings
|
||||||
expired: Expired
|
expired: Expired
|
|
@ -24,4 +24,5 @@ zh_tw:
|
||||||
transition_interval: 轉換間隔
|
transition_interval: 轉換間隔
|
||||||
transition_speed: 轉換速度
|
transition_speed: 轉換速度
|
||||||
type: 開啟方式
|
type: 開啟方式
|
||||||
expired: 已下架
|
expired: 已下架
|
||||||
|
duration: Duration
|
Loading…
Reference in New Issue