AdImage and AnBanner JS fixed
This commit is contained in:
parent
51190a79cb
commit
8d776fd30d
|
@ -6,7 +6,7 @@ $(document).ready(function() {
|
|||
$("a.preview_trigger").click(function(){
|
||||
$(this).after("<span id='show_preview'></span>");
|
||||
$.ajax({
|
||||
type:"PUT",
|
||||
type:"put",
|
||||
url:$(this).attr("href"),
|
||||
data:$(this).parents("form").serialize()
|
||||
}).done(function(){ $("#"+start_modal_with_id).modal('show');});
|
||||
|
|
|
@ -22,9 +22,14 @@ class Admin::AdBannersController < ApplicationController
|
|||
|
||||
def create
|
||||
@ad_banner = AdBanner.new(params[:ad_banner])
|
||||
@ad_banner.save
|
||||
redirect_to admin_ad_banners_url
|
||||
|
||||
if @ad_banner.save
|
||||
@active = @ad_banner
|
||||
respond_to do |format|
|
||||
format.js {render 'new_created_node'}
|
||||
end
|
||||
else
|
||||
render 'create_error_msg'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -40,8 +45,8 @@ class Admin::AdBannersController < ApplicationController
|
|||
end
|
||||
|
||||
def realtime_preview
|
||||
@ad_banner = AdBanner.find(conditions: { title: params[:title] }).preview_clone
|
||||
#@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images])
|
||||
@ad_banner = AdBanner.first(conditions: { title: params[:title] }).preview_clone
|
||||
@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images])
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3>Add AdBanner</h3>
|
||||
<h3><%= t("admin.ad.new_banner") %></h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body form-horizontal">
|
||||
|
@ -30,7 +30,7 @@
|
|||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary',:remote=>true %>
|
||||
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
alert("Error occures:<%= @ad_banner.errors.full_messages%>");
|
|
@ -0,0 +1,7 @@
|
|||
$('<%= escape_javascript(content_tag(:li,link_to(@ad_banner.title,"##{@ad_banner.title}",:data=>{:toggle=>"tab"}))) %>').insertBefore("#new_ad_banner_tab_but");
|
||||
$('<%= escape_javascript(render(:partial => "ad_banner_tab",:locals => {:ad_banner_tab => @ad_banner})) %>').insertBefore($("#new-a-banner"));
|
||||
|
||||
$('.modal').modal('hide');
|
||||
$('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active");
|
||||
$('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active");
|
||||
|
Loading…
Reference in New Issue