Change ad_banner preview from using title to id
This commit is contained in:
parent
8e444a88d0
commit
ddf7931123
|
@ -7,9 +7,7 @@ $(document).ready(function() {
|
||||||
$(this).after("<span id='show_preview'></span>");
|
$(this).after("<span id='show_preview'></span>");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
//async : true,
|
|
||||||
url:$(this).attr("href"),
|
url:$(this).attr("href"),
|
||||||
contentType: 'application/javascript; charset=utf-8',
|
|
||||||
data:$(this).parents("form").serialize(),
|
data:$(this).parents("form").serialize(),
|
||||||
success: function (msg) {
|
success: function (msg) {
|
||||||
$("#"+start_modal_with_id).modal('show'); },
|
$("#"+start_modal_with_id).modal('show'); },
|
||||||
|
|
|
@ -45,8 +45,8 @@ class Admin::AdBannersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def realtime_preview
|
def realtime_preview
|
||||||
@ad_banner = AdBanner.first(conditions: { title: params[:title] }).preview_clone
|
@ad_banner = AdBanner.find( params[:id] ).preview_clone
|
||||||
#@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images])
|
@ad_banner.update_attributes(params[:ad_banner])#.update_attributes(params[:ad_images])
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div class="adbanner-list">
|
<div class="adbanner-list">
|
||||||
<div class="adbanner-action">
|
<div class="adbanner-action">
|
||||||
<%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
|
<%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
|
||||||
<%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%>
|
<%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger btn btn-success'%>
|
||||||
</div>
|
</div>
|
||||||
<ul class="clear">
|
<ul class="clear">
|
||||||
<%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
|
<%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<% if ad_banner -%>
|
<% if ad_banner -%>
|
||||||
|
|
||||||
<div class="modal hide fade in banner-preview" id='slideshow-<%=ad_banner.title.dehumanize%>'>
|
<div class="modal hide fade in banner-preview" id="slideshow-<%=ad_banner.title.dehumanize%>">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
<h3><%= t("modal.preview") %></h3>
|
<h3><%= t("modal.preview") %></h3>
|
||||||
|
@ -8,28 +8,30 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p class="ad_banner_slideshow">
|
<p class="ad_banner_slideshow">
|
||||||
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
|
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
|
||||||
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
|
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
|
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div>
|
||||||
|
<script type="text/javascript" src="/static/kernel.js"></script>
|
||||||
<% end -%>
|
<script type="text/javascript">
|
||||||
|
|
||||||
<script type='text/javascript' src='/static/kernel.js'></script>
|
|
||||||
<script type='text/javascript'>
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#slideshow-<%=ad_banner.title.dehumanize%>').on('show', function () {
|
$("#slideshow-<%=ad_banner.title.dehumanize%>").on("show", function () {
|
||||||
$('#slideshow-banner_1').find(".ad_banner_slideshow").cycle({delay: -1000, fx: '<%= ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx %>', timeoutFn: getTimeout });
|
console.info("<%= ad_banner.ad_fx.nil?? "fade": ad_banner.ad_fx %>"+" <%= ad_banner.transition_msec %>");
|
||||||
|
$("#slideshow-<%=ad_banner.title.dehumanize%>").find(".ad_banner_slideshow").cycle({delay: -1000, fx: "<%= ad_banner.ad_fx.nil?? "fade": ad_banner.ad_fx %>", timeoutFn: getTimeout });
|
||||||
});
|
});
|
||||||
$(".modal").on('hidden', function () {
|
$(".modal").on("hidden", function () {
|
||||||
$("#show_preview").remove();
|
$("#show_preview").remove();
|
||||||
});
|
});
|
||||||
//$('#slideshow-<%=ad_banner.title.dehumanize%>').show();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<% end -%>
|
||||||
|
|
|
@ -25,7 +25,7 @@ Orbit::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
match 'ad_banner/:title/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put
|
match 'ad_banner/:id/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put
|
||||||
resources :ad_banners do
|
resources :ad_banners do
|
||||||
collection do
|
collection do
|
||||||
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get
|
match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get
|
||||||
|
|
Loading…
Reference in New Issue