Orbit/app/views/admin/ad_banners/new_created_node.js.erb

18 lines
1.1 KiB
Plaintext
Raw Normal View History

2012-04-18 07:26:59 +00:00
$('<%= 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})) %>').insertAfter($("#ad_banner-tab-content").children(".tab-pane").last());
2012-04-18 07:26:59 +00:00
$('.modal').modal('hide');
$("#ad_banner-modal-info").empty();
$("#new-a-banner form").each(function(){this.reset();});
2012-04-18 08:24:17 +00:00
$('#new-a-banner').unbind();
2012-04-18 07:26:59 +00:00
$('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active");
$("#ad_banner-tab-content").children(".tab-pane").removeClass("active");
2012-04-18 07:26:59 +00:00
$('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active");
$("#ad_banner-tab-content").children(".tab-pane").last().addClass("active");
<% if params[:action] && params[:action] =='create'%>
var trigger = $("#ad_banner-tab-content").children(".tab-pane").last().find(".preview_trigger");
new_url = trigger.attr("href").replace(/\/admin\/ad_banners\/.*\/preview/gi,"/admin/ad_banners/<%= @ad_banner.id %>/preview");
trigger.attr("href",new_url);
<% end %>