fix js
This commit is contained in:
parent
0ddb66a3c9
commit
170c12bcdd
|
@ -36,17 +36,15 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
if(window.location.pathname == "/admin/ad_banners/new"){
|
||||
$('#new-a-banner').modal({show: true});
|
||||
}
|
||||
|
||||
$('#new_ad_banner_tab_but').on('shown', function (e) {
|
||||
$('#new-a-banner').modal({show: true});
|
||||
})
|
||||
|
||||
$('#new-a-banner').modal({show: true});
|
||||
});
|
||||
|
||||
<% if params[:action] == "new" -%>
|
||||
$('#new-a-banner').modal({show: true});
|
||||
<% end -%>
|
||||
$('#new-a-banner').on('hidden', function (e) {
|
||||
$(".nav.nav-tabs a[id!='new_ad_banner_tab_but']:last").tab('show');
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<% @ad_banners.each do |ab| %>
|
||||
<%= content_tag :li,link_to(ab.title,"##{ab.title}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %>
|
||||
<% end -%>
|
||||
<%= content_tag :li,link_to('New',"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %>
|
||||
<%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %>
|
||||
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ $('<%= escape_javascript(content_tag(:li,link_to(@ad_banner.title,"##{@ad_banner
|
|||
$('<%= escape_javascript(render(:partial => "ad_banner_tab",:locals => {:ad_banner_tab => @ad_banner})) %>').insertBefore($("#new-a-banner"));
|
||||
|
||||
$('.modal').modal('hide');
|
||||
$('#new-a-banner').unbind();
|
||||
$('#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");
|
||||
|
||||
|
|
Reference in New Issue