New UI
This commit is contained in:
parent
94855f8900
commit
c3a78aaf54
|
@ -1,7 +1,7 @@
|
||||||
class AdBannersController < ApplicationController
|
class AdBannersController < ApplicationController
|
||||||
def widget
|
def widget
|
||||||
adbanner = Banner.find(OrbitHelper.widget_custom_value)
|
adbanner = Banner.find(OrbitHelper.widget_custom_value)
|
||||||
images = adbanner.ad_images.collect.with_index do |b,i|
|
images = adbanner.ad_images.can_display.collect.with_index do |b,i|
|
||||||
image_link = OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url
|
image_link = OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url
|
||||||
klass = i == 0 ? "active" : ""
|
klass = i == 0 ? "active" : ""
|
||||||
caption = i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : ""
|
caption = i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : ""
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
class Admin::AdBannersController < OrbitAdminController
|
class Admin::AdBannersController < OrbitAdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@banners = Banner.order_by(sort).page(params[:page]).per(10)
|
@banners = Banner.all
|
||||||
@table_fields = ["ad_banner.banner_name","ad_banner.effect","ad_banner.transition_interval","ad_banner.transition_speed","ad_banner.size","preview"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -12,8 +12,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)
|
||||||
@ad_banners = Banner.all
|
@ad_banner = @ad_image.banner
|
||||||
@tags = @module_app.tags || []
|
|
||||||
else
|
else
|
||||||
render_401
|
render_401
|
||||||
end
|
end
|
||||||
|
@ -22,7 +21,7 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
def update
|
def update
|
||||||
@ad_image = AdImage.find(params[:id])
|
@ad_image = AdImage.find(params[:id])
|
||||||
if @ad_image.update_attributes(ad_image_params)
|
if @ad_image.update_attributes(ad_image_params)
|
||||||
redirect_to admin_ad_images_url
|
redirect_to params['referer_url']
|
||||||
else
|
else
|
||||||
@ad_banners = Banner.all
|
@ad_banners = Banner.all
|
||||||
@tags = @module_app.tags || []
|
@tags = @module_app.tags || []
|
||||||
|
@ -32,17 +31,16 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@ad_image = AdImage.new
|
@ad_image = AdImage.new
|
||||||
@ad_banners = Banner.all
|
@ad_banner = Banner.find(params[:banner])
|
||||||
@tags = @module_app.tags || []
|
@tags = @module_app.tags || []
|
||||||
|
|
||||||
@ad_image.postdate = Date.today
|
@ad_image.postdate = Date.today
|
||||||
@ad_image.deadline = Date.today + 30
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@ad_image = AdImage.new(ad_image_params)
|
@ad_image = AdImage.new(ad_image_params)
|
||||||
if @ad_image.save
|
if @ad_image.save
|
||||||
redirect_to admin_ad_images_url
|
redirect_to params['referer_url']
|
||||||
else
|
else
|
||||||
@ad_banners = Banner.all
|
@ad_banners = Banner.all
|
||||||
@tags = @module_app.tags || []
|
@tags = @module_app.tags || []
|
||||||
|
@ -54,7 +52,7 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
def destroy
|
def destroy
|
||||||
@ad_image = AdImage.find params[:id]
|
@ad_image = AdImage.find params[:id]
|
||||||
if @ad_image.destroy
|
if @ad_image.destroy
|
||||||
redirect_to admin_ad_images_url
|
redirect_to admin_ad_banners_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,13 @@ class AdImage
|
||||||
before_validation :add_http
|
before_validation :add_http
|
||||||
validates :file, presence: true
|
validates :file, presence: true
|
||||||
validates :out_link, format: { with: URI::regexp(%w(http https)) }, allow_blank: true
|
validates :out_link, format: { with: URI::regexp(%w(http https)) }, allow_blank: true
|
||||||
validates :title, presence: true
|
# validates :title, presence: true
|
||||||
|
|
||||||
|
scope :can_display, ->{self.and(AdImage.or({:postdate.lte=>Time.now},{:postdate=>nil}).selector,AdImage.or({:deadline.gte=>Time.now},{:deadline=>nil}).selector)}
|
||||||
|
|
||||||
|
def expired?
|
||||||
|
self.deadline<Time.now rescue false
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,6 @@
|
||||||
<%= f.select :ad_fx, Banner::FX_TYPES, {}, {class: 'ad_banner_ad_fx', id: 'ad_fx'} %>
|
<%= 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>
|
<p class="suckIE hide"><i class="icons-warning"></i> <%= t('ad_banner.no_ie_10_effect_support') %></p>
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<%= image_tag "slideshow_preview_A.png", width: 200, height: 80 %>
|
<%= image_tag "slideshow_preview_A.png", width: "100%", height: 80 %>
|
||||||
<%= image_tag "slideshow_preview_B.png", width: 200, height: 80 %>
|
<%= image_tag "slideshow_preview_B.png", width: "100%", height: 80 %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,35 +1,345 @@
|
||||||
<table class="table main-list">
|
<%
|
||||||
<thead>
|
height = 140
|
||||||
<tr class="sort-header">
|
%>
|
||||||
<% @table_fields.each do |f| %>
|
<style type="text/css">
|
||||||
<%= thead(f) %>
|
#ad-banner-wrap{
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.ad-banner{
|
||||||
|
border: 0px solid #DDD;
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ad-banner a{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.ad-banner-edit{
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: -37px;
|
||||||
|
z-index: 998;
|
||||||
|
background: #000;
|
||||||
|
width: 100%;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
.ad-banner-edit-btn{
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 6px 0;
|
||||||
|
display: inline-block;
|
||||||
|
width: 32%;
|
||||||
|
}
|
||||||
|
.ad-banner-edit-btn:hover{
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
.ad-banner-edit a{
|
||||||
|
color: #EEE;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.ad-banner-edit a:hover{
|
||||||
|
color: #FFF;
|
||||||
|
}
|
||||||
|
.ad-banner-images{
|
||||||
|
width: 100%;
|
||||||
|
height: <%= height %>px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #555;
|
||||||
|
display: inline-block;
|
||||||
|
box-shadow: 0px 2px 7px #888;
|
||||||
|
}
|
||||||
|
.slide-img{
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-transition:-webkit-filter 0.3s ease-in-out;
|
||||||
|
-moz-transition:-webkit-filter 0.3s ease-in-out;
|
||||||
|
-o-transition:-webkit-filter 0.3s ease-in-out;
|
||||||
|
-ms-transition:-webkit-filter 0.3s ease-in-out;
|
||||||
|
transition:-webkit-filter 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
.grayscale{
|
||||||
|
-webkit-filter: grayscale(100%) brightness(60%);
|
||||||
|
-moz-filter: grayscale(100%) brightness(60%);
|
||||||
|
-o-filter: grayscale(100%) brightness(60%);
|
||||||
|
-ms-filter: grayscale(100%) brightness(60%);
|
||||||
|
filter: grayscale(100%) brightness(60%);
|
||||||
|
}
|
||||||
|
.grayscale-blur{
|
||||||
|
-webkit-filter: grayscale(70%) brightness(60%) blur(2px);
|
||||||
|
-moz-filter: grayscale(70%) brightness(60%) blur(2px);
|
||||||
|
-o-filter: grayscale(70%) brightness(60%) blur(2px);
|
||||||
|
-ms-filter: grayscale(70%) brightness(60%) blur(2px);
|
||||||
|
filter: grayscale(70%) brightness(60%) blur(2px);
|
||||||
|
}
|
||||||
|
.slide-img{
|
||||||
|
width: 100%;
|
||||||
|
height: <%= height %>px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
.ad-banner-title{
|
||||||
|
color: #FFF;
|
||||||
|
background: #000;
|
||||||
|
font-size: 1.5em;
|
||||||
|
padding: 3px 15px;
|
||||||
|
margin-top: 10px;
|
||||||
|
z-index: 998;
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
.ad-banner-info{
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: -100px;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 998;
|
||||||
|
background-color: #111;
|
||||||
|
color: #FFF;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
.ad-banner-info .table{
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.ad-banner-info .table td{
|
||||||
|
border-top: none;
|
||||||
|
text-align: left;
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
.ad-banner-info .table th{
|
||||||
|
border-top: none;
|
||||||
|
text-align: right;
|
||||||
|
padding: 8px 0;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
.bottomnav{
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
.ad-banner-detail{
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 999;
|
||||||
|
margin: 0px auto 70px auto;
|
||||||
|
}
|
||||||
|
.ad-banner-images-wrap-arrow{
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 5px solid transparent;
|
||||||
|
border-right: 5px solid transparent;
|
||||||
|
border-bottom: 5px solid #000;
|
||||||
|
margin: -5px auto 0 auto;
|
||||||
|
}
|
||||||
|
.ad-banner-images-wrap{
|
||||||
|
z-index: 999;
|
||||||
|
background: #333;
|
||||||
|
box-shadow: inset 0 5px 10px #000;
|
||||||
|
padding: 5px 15px 1px 15px;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.ad-banner-images-wrap table{
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.ad-banner-images-wrap table td, .ad-banner-images-wrap table th{
|
||||||
|
border: none;
|
||||||
|
padding: 4px 5px;
|
||||||
|
}
|
||||||
|
.ad-banner-images-wrap table th{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.ad-banner-image-wrap{
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
}
|
||||||
|
.ad-banner-image{
|
||||||
|
width: 100%;
|
||||||
|
height: 120px;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2px 10px #000;
|
||||||
|
}
|
||||||
|
.ad-image-info-wrap{
|
||||||
|
display: none;
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
.ad-image-info{
|
||||||
|
background: #DDD;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.ad-image-btn{
|
||||||
|
padding: 2px 25px;
|
||||||
|
line-height: 22px;
|
||||||
|
color: #FFF;
|
||||||
|
background: #000;
|
||||||
|
margin-top: 94px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
.ad-image-new-btn{
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 3px;
|
||||||
|
line-height: 22px;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
margin: 3px 0 10px 0;
|
||||||
|
background: #0088cc;
|
||||||
|
color: #FFF;
|
||||||
|
box-shadow: 0 0 10px #000;
|
||||||
|
}
|
||||||
|
.ad-image-new-btn:hover{
|
||||||
|
color: #FFF;
|
||||||
|
background: #009EEC;
|
||||||
|
}
|
||||||
|
.ad-image-expired{
|
||||||
|
background: #000;
|
||||||
|
opacity: 0.7;
|
||||||
|
color: #FFF;
|
||||||
|
padding: 5px 10px;
|
||||||
|
margin-bottom: -30px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
@media all and (max-width: 768px) {
|
||||||
|
.ad-banner-detail{
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="ad-banner-wrap">
|
||||||
|
<% @banners.each_with_index do |banner,i| %>
|
||||||
|
<% if (i+1)%3==1 %><div class="row-fluid"><% end %>
|
||||||
|
<div class="ad-banner span4">
|
||||||
|
<div class="ad-banner-title"><%= banner.title %></div>
|
||||||
|
<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.each do |image| %>
|
||||||
|
<div class="slide-img" style=" background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
<% else %>
|
||||||
</thead>
|
<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>
|
||||||
<tbody>
|
<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>
|
||||||
<% @banners.each do |banner| %>
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ad-banner-edit">
|
||||||
|
<a data-title="<%= t(:setting) %>"
|
||||||
|
data-id="<%= banner.id.to_s %>"
|
||||||
|
data-fx="<%= banner.ad_fx %>"
|
||||||
|
data-form="<%= banner.data_attribute_hash.to_s %>"
|
||||||
|
class="open-slide"
|
||||||
|
href="#">
|
||||||
|
<div class="ad-banner-edit-btn">
|
||||||
|
<i class="icons-cog"></i>
|
||||||
|
<%= t(:setting) %>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<a class="" href="#" onclick="toggleBannerDetail('<%= banner.id.to_s %>'); return false;">
|
||||||
|
<div class="ad-banner-edit-btn">
|
||||||
|
<i class="icons-pictures"></i>
|
||||||
|
<%= t(:images) %>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<a href="#" class="delete text-error" rel="/admin/ad_banners/<%= banner.id.to_s %>">
|
||||||
|
<div class="ad-banner-edit-btn">
|
||||||
|
<i class="icons-trash"></i>
|
||||||
|
<%= t(:delete_) %>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ad-banner-info">
|
||||||
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<th><%= t("ad_banner.size") %> : </th>
|
||||||
<%= banner.title %>
|
<td><%= banner.size %></td>
|
||||||
<div class="quick-edit">
|
<th><%= t("ad_banner.effect") %> : </th>
|
||||||
<% if can_edit_or_delete?(banner) %>
|
<td><%= banner.ad_fx %></td>
|
||||||
<ul class="nav nav-pills">
|
<th><%= t("ad_banner.transition_interval") %> : </th>
|
||||||
<li>
|
<td><%= banner.timeout %></td>
|
||||||
<a data-title="Edit Banner" data-id="<%= banner.id.to_s %>" data-fx="<%= banner.ad_fx %>" data-form="<%= banner.data_attribute_hash.to_s %>" class="open-slide" href="#">Edit</a>
|
<th><%= t("ad_banner.transition_speed") %> : </th>
|
||||||
</li>
|
<td><%= banner.speed %></td>
|
||||||
<li>
|
</tr>
|
||||||
<a href="/admin/ad_banners/<%= banner.id.to_s %>" data-method="delete" data-confirm="Are you sure?" ><%= t(:delete_) %></a>
|
</table>
|
||||||
</li>
|
</div>
|
||||||
</ul>
|
|
||||||
|
<div id="ad-banner-<%= banner.id.to_s %>" class="ad-banner-detail">
|
||||||
|
<div class="ad-banner-images-wrap-arrow"></div>
|
||||||
|
<div class="ad-banner-images-wrap">
|
||||||
|
<a href="<%= new_admin_ad_image_path(banner: banner.id.to_s) %>" class="ad-image-new-btn">
|
||||||
|
<i class="icon-plus"></i> <%= t("ad.new_image") %>
|
||||||
|
</a>
|
||||||
|
<% banner.ad_images.each_with_index do |image,idx| %>
|
||||||
|
<div class="ad-banner-image-wrap">
|
||||||
|
<div class="ad-banner-image <%= image.expired? ? "grayscale" : "" %>" style="background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;">
|
||||||
|
<% if image.expired? %>
|
||||||
|
<div class="ad-image-expired"><%= t("ad_banner.expired") %></div>
|
||||||
|
<% end %>
|
||||||
|
<% if (image.postdate > Time.now rescue false) %>
|
||||||
|
<div class="ad-image-expired"><%= t("start_date")+': '+(format_value image.postdate) %></div>
|
||||||
|
<% end %>
|
||||||
|
<a class="ad-image-btn pull-left" href="<%= edit_admin_ad_image_path(image) %>"><i class="icon-edit"></i><%= t(:edit) %></a>
|
||||||
|
<a class="ad-image-btn pull-right delete text-error" href="#" class="delete text-error" rel="/admin/ad_images/<%= image.id.to_s %>"><i class="icons-trash"></i><%= t(:delete_) %></a>
|
||||||
|
</div>
|
||||||
|
<div class="ad-image-info-wrap">
|
||||||
|
<table class="ad-image-info table table-striped">
|
||||||
|
<tr>
|
||||||
|
<th><%= t("title") %> : </th>
|
||||||
|
<td><%= image.title %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><%= t("start_date") %> : </th>
|
||||||
|
<td><%= format_value image.postdate %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><%= t("end_date") %> : </th>
|
||||||
|
<td><%= format_value image.deadline %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><%= t("link") %> : </th>
|
||||||
|
<td><%= image.out_link rescue " " %></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</div>
|
||||||
<td><%= banner.ad_fx %></td>
|
|
||||||
<td><%= banner.timeout %></td>
|
</div>
|
||||||
<td><%= banner.speed %></td>
|
<% if ((i+1)%3==0) or (i+1 == @banners.count) %></div><br/ ><% end %>
|
||||||
<td><%= banner.size %></td>
|
|
||||||
<td><%= banner.preview_link %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
|
||||||
|
<script>
|
||||||
|
$(".ad-banner").on("mouseover",function(){
|
||||||
|
$(this).find(".slide-img").addClass("grayscale-blur");
|
||||||
|
$(this).find(".ad-banner-edit").stop().fadeIn(100);
|
||||||
|
$(this).find(".ad-banner-info").stop().fadeIn(100);
|
||||||
|
});
|
||||||
|
$(".ad-banner").on("mouseleave",function(){
|
||||||
|
$(this).find(".slide-img").removeClass("grayscale-blur");
|
||||||
|
$(this).find(".ad-banner-edit").stop().fadeOut(100);
|
||||||
|
$(this).find(".ad-banner-info").stop().fadeOut(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
function toggleBannerDetail(banner){
|
||||||
|
$.each($('.ad-banner-detail'),function(){
|
||||||
|
if(this.id!="ad-banner-"+banner){
|
||||||
|
$(this).stop().hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!$('#ad-banner-'+banner).is(":visible")){
|
||||||
|
$('html, body').stop().animate({
|
||||||
|
scrollTop: $('#ad-banner-'+banner).parent().offset().top-50
|
||||||
|
}, 300, 'swing');
|
||||||
|
}
|
||||||
|
$('#ad-banner-'+banner).stop().slideToggle(300);
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -8,26 +8,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="bottomnav clearfix" style="left: 81px;">
|
<div class="bottomnav clearfix" style="left: 81px;">
|
||||||
<div class="action pull-right">
|
<div class="action pull-right">
|
||||||
<a data-title="New Banner" data-id="new" data-fx="fade" class="btn btn-primary open-slide" href="#">
|
<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> Add
|
<i class="icon-plus"></i><%= t("ad_banner.new_banner") %>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination pagination-centered"></div>
|
<div class="pagination pagination-centered"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="preview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3 id="ModalLabel"><%= t(:preview) %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="preview">
|
|
||||||
<%= image_tag "slideshow_preview_A.png", class: 'hide' %>
|
|
||||||
<%= image_tag "slideshow_preview_B.png", class: 'hide' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="pageslide">
|
<div id="pageslide">
|
||||||
<div class="page-title clearfix">
|
<div class="page-title clearfix">
|
||||||
|
@ -52,3 +38,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
|
@ -1,4 +1,5 @@
|
||||||
$("#banner_index").html("<%= j render 'index' %>")
|
|
||||||
$.pageslide.close();
|
$.pageslide.close();
|
||||||
|
$("#banner_index").html("<%= j render 'index' %>");
|
||||||
|
$(".cycle-slideshow").cycle();
|
||||||
openSlide();
|
openSlide();
|
||||||
preview();
|
preview();
|
|
@ -14,40 +14,62 @@
|
||||||
<!-- Input Area -->
|
<!-- Input Area -->
|
||||||
<div class="input-area">
|
<div class="input-area">
|
||||||
|
|
||||||
<!-- Module Tabs -->
|
|
||||||
<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>
|
|
||||||
<li>
|
|
||||||
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#type" data-toggle="tab"><%= t('ad_banner.type') %></a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#frequency" data-toggle="tab"><%= t(:frequency) %></a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#link" data-toggle="tab"><%= t(:link) %></a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!-- Module -->
|
<!-- Module -->
|
||||||
<div class="tab-content module-area">
|
<div class="tab-content">
|
||||||
|
|
||||||
<!-- Basic Module -->
|
<!-- Basic Module -->
|
||||||
<div class="tab-pane fade in active" id="basic">
|
<div class="tab-pane fade in active" id="basic">
|
||||||
|
<input type="hidden" name="ad_image[banner_id]" value="<%= @ad_banner.id.to_s %>">
|
||||||
|
|
||||||
<!-- Category -->
|
<!-- Images Upload -->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('ad_banner.banner') %></label>
|
<label class="control-label muted"><%= t(:image) %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.select :banner_id, @ad_banners.collect{|t| [ t.title, t.id ]} %>
|
<div><%= t("ad_banner.best_size") %>: <%= @ad_banner.width %>px X <%= @ad_banner.height %>px</div>
|
||||||
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @ad_image.file.file %>" data-provides="fileupload">
|
||||||
|
<div class="fileupload-new thumbnail pull-left">
|
||||||
|
<% if @ad_image.file.file %>
|
||||||
|
<%= image_tag @ad_image.file %>
|
||||||
|
<% else %>
|
||||||
|
<img src="http://www.placehold.it/200x80/EFEFEF/AAAAAA&text=<%= @ad_banner.width %>x<%= @ad_banner.height %>" />
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||||
|
<span class="btn btn-file">
|
||||||
|
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||||||
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
||||||
|
<%= f.file_field :file %>
|
||||||
|
</span>
|
||||||
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||||
|
<div class="controls" data-toggle="buttons-checkbox">
|
||||||
|
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||||
|
<%= f.check_box :remove_file %><%= t(:remove) %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Title-->
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="first_name" class="control-label muted" function="field_label"><%= t("title")%></label>
|
||||||
|
<div class="controls add-input">
|
||||||
|
<div class="input-append">
|
||||||
|
<div class="tab-content">
|
||||||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="title_<%= locale %>">
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<%= f.text_field locale, :value => (@ad_image.title_translations[locale] rescue nil), :placeholder=>"#{t(locale.to_s)+t("title")}" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group" data-toggle="buttons-radio">
|
||||||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#title_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -67,30 +89,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<!-- Link -->
|
||||||
|
|
||||||
<!-- Tag Module -->
|
|
||||||
<div class="tab-pane fade" id="tag">
|
|
||||||
|
|
||||||
<!-- Tag -->
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t(:tags) %></label>
|
<label class="control-label muted"><%= t(:link) %></label>
|
||||||
<div class="controls" data-toggle="buttons-checkbox">
|
<div class="controls">
|
||||||
<% @tags.each do |tag| %>
|
<%= f.text_field :out_link, placeholder: t('ad_banner.enter_url') %>
|
||||||
<label class="checkbox inline btn <%= 'active' if @ad_image.tag_ids.include?(tag.id) %>">
|
|
||||||
<%= check_box_tag 'ad_image[tag_ids][]', tag.id, @ad_image.tag_ids.include?(tag.id) %> <%= tag.name %>
|
|
||||||
<%= hidden_field_tag 'ad_image[tag_ids][]', '' %>
|
|
||||||
</label>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Type Module -->
|
|
||||||
<div class="tab-pane fade" id="type">
|
|
||||||
|
|
||||||
<!-- Type -->
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('ad_banner.type') %></label>
|
<label class="control-label muted"><%= t('ad_banner.type') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
@ -100,71 +106,9 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Frequency Module -->
|
|
||||||
<div class="tab-pane fade" id="frequency">
|
|
||||||
|
|
||||||
<!-- Frequency -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:frequency) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.number_field :weight, placeholder: t(:frequency), in: 1..99, maxlength: 2, onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
|
|
||||||
<span class="help-block"><%= t('ad_banner.enter_number') %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Link Module -->
|
|
||||||
<div class="tab-pane fade" id="link">
|
|
||||||
|
|
||||||
<!-- Link -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:link) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field :out_link, placeholder: t(:url) %>
|
|
||||||
<span class="help-block"><%= t('ad_banner.enter_url') %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Images Module -->
|
|
||||||
<div class="tab-pane fade" id="imageupload">
|
|
||||||
|
|
||||||
<!-- Images Upload -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label muted"><%= t(:image) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @ad_image.file.file %>" data-provides="fileupload">
|
|
||||||
<div class="fileupload-new thumbnail pull-left">
|
|
||||||
<% if @ad_image.file.file %>
|
|
||||||
<%= image_tag @ad_image.file %>
|
|
||||||
<% else %>
|
|
||||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
|
||||||
<span class="btn btn-file">
|
|
||||||
<span class="fileupload-new"><%= t(:select_image) %></span>
|
|
||||||
<span class="fileupload-exists"><%= t(:change) %></span>
|
|
||||||
<%= f.file_field :file %>
|
|
||||||
</span>
|
|
||||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
|
||||||
<div class="controls" data-toggle="buttons-checkbox">
|
|
||||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
|
||||||
<%= f.check_box :remove_file %><%= t(:remove) %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Language Tabs -->
|
<!-- Language Tabs -->
|
||||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
|
||||||
<ul class="nav nav-pills language-nav">
|
<ul class="nav nav-pills language-nav">
|
||||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
<li class="<%= 'active' if i == 0 %>">
|
<li class="<%= 'active' if i == 0 %>">
|
||||||
|
@ -180,19 +124,9 @@
|
||||||
|
|
||||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||||
|
|
||||||
<!-- Title-->
|
|
||||||
<div class="control-group input-title">
|
|
||||||
<label class="control-label muted"><%= t(:title) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@ad_image.title_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
<div class="control-group input-content">
|
<div class="control-group input-content">
|
||||||
<label class="control-label muted"><%= t(:content) %></label>
|
<label class="control-label muted"><%= t(:description) %> (<%= t(locale.to_s) %>)</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="textarea">
|
<div class="textarea">
|
||||||
<%= f.fields_for :context_translations do |f| %>
|
<%= f.fields_for :context_translations do |f| %>
|
||||||
|
@ -212,5 +146,6 @@
|
||||||
|
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,17 +8,17 @@ en:
|
||||||
effect: Effect
|
effect: Effect
|
||||||
enter_number: Please enter a number
|
enter_number: Please enter a number
|
||||||
enter_url: Please enter the URL
|
enter_url: Please enter the URL
|
||||||
local: Current page
|
local: Open In Current page
|
||||||
name_only_english: Banner Name can only in English
|
name_only_english: Banner Name can only in English
|
||||||
new_banner: New Banner
|
new_banner: New Banner
|
||||||
new_window: New window
|
new_window: Open In New window
|
||||||
no_ie_10_effect_support: IE10 earlier do not support this effect
|
no_ie_10_effect_support: IE10 earlier do not support this effect
|
||||||
number_milliseconds: Please enter the number of milliseconds
|
number_milliseconds: Please enter the number of milliseconds
|
||||||
number_seconds: Please enter the number of seconds
|
number_seconds: Please enter the number of seconds
|
||||||
size: Size
|
size: Size
|
||||||
transition_interval: Transition Interval
|
transition_interval: Interval
|
||||||
transition_speed: Transition Speed
|
transition_speed: Speed
|
||||||
type: Type
|
type: Link Open Type
|
||||||
banner_name_note: Banner Name only english
|
banner_name_note: Banner Name only english
|
||||||
ste: Transition Interval
|
ste: Transition Interval
|
||||||
ste_note: Please enter the number of seconds
|
ste_note: Please enter the number of seconds
|
||||||
|
@ -26,3 +26,4 @@ en:
|
||||||
all: All
|
all: All
|
||||||
categories: Categories
|
categories: Categories
|
||||||
add: Add
|
add: Add
|
||||||
|
expired: Expired
|
|
@ -8,6 +8,9 @@ zh_tw:
|
||||||
edit_banner: 編輯橫幅
|
edit_banner: 編輯橫幅
|
||||||
enter_number: 請輸入數字
|
enter_number: 請輸入數字
|
||||||
enter_url: 請輸入網址
|
enter_url: 請輸入網址
|
||||||
|
local: 當前視窗開啟
|
||||||
|
new_banner: 新增橫幅
|
||||||
|
new_window: 新視窗開啟
|
||||||
ste: 轉換間隔時間
|
ste: 轉換間隔時間
|
||||||
number_seconds: 請輸入秒數
|
number_seconds: 請輸入秒數
|
||||||
number_milliseconds: 請輸入毫秒數
|
number_milliseconds: 請輸入毫秒數
|
||||||
|
@ -16,8 +19,8 @@ zh_tw:
|
||||||
all: 全部
|
all: 全部
|
||||||
categories: 類別
|
categories: 類別
|
||||||
add: 新增
|
add: 新增
|
||||||
new_banner: 新增
|
|
||||||
size: 大小
|
size: 大小
|
||||||
transition_interval: 轉換間隔時間
|
transition_interval: 轉換間隔
|
||||||
transition_speed: 轉換速度
|
transition_speed: 轉換速度
|
||||||
type: 類型
|
type: 開啟方式
|
||||||
|
expired: 已下架
|
|
@ -17,20 +17,8 @@ module AdBanner
|
||||||
head_link_path "admin_ad_banners_path"
|
head_link_path "admin_ad_banners_path"
|
||||||
|
|
||||||
context_link 'ad_banner.all',
|
context_link 'ad_banner.all',
|
||||||
:link_path=>"admin_ad_images_path" ,
|
|
||||||
:priority=>1,
|
|
||||||
:active_for_action=>{'admin/ad_images'=>"index"},
|
|
||||||
:available_for => 'users'
|
|
||||||
|
|
||||||
context_link 'ad_banner.add',
|
|
||||||
:link_path=>"new_admin_ad_image_path" ,
|
|
||||||
:priority=>1,
|
|
||||||
:active_for_action=>{'admin/ad_images'=>"new"},
|
|
||||||
:available_for => 'managers'
|
|
||||||
|
|
||||||
context_link 'ad_banner.banner',
|
|
||||||
:link_path=>"admin_ad_banners_path" ,
|
:link_path=>"admin_ad_banners_path" ,
|
||||||
:priority=>3,
|
:priority=>1,
|
||||||
:active_for_action=>{'admin/ad_banners'=>"index"},
|
:active_for_action=>{'admin/ad_banners'=>"index"},
|
||||||
:available_for => 'users'
|
:available_for => 'users'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue