This commit is contained in:
Matthew K. Fu JuYuan 2012-04-18 16:24:17 +08:00 committed by Christophe Vilayphiou
parent 8eedbc951e
commit 67ba2389a2
3 changed files with 8 additions and 9 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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");