Browse Source

Update URL when changing tab (#13900).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11765 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/2.4.0
Jean-Baptiste Barth 11 years ago
parent
commit
501007f01d
2 changed files with 7 additions and 2 deletions
  1. 1
    1
      app/views/common/_tabs.html.erb
  2. 6
    1
      public/javascripts/application.js

+ 1
- 1
app/views/common/_tabs.html.erb View File

@@ -6,7 +6,7 @@
<li><%= link_to l(tab[:label]), { :tab => tab[:name] },
:id => "tab-#{tab[:name]}",
:class => (tab[:name] != selected_tab ? nil : 'selected'),
:onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %></li>
:onclick => "showTab('#{tab[:name]}', this.href); this.blur(); return false;" %></li>
<% end -%>
</ul>
<div class="tabs-buttons" style="display:none;">

+ 6
- 1
public/javascripts/application.js View File

@@ -290,11 +290,16 @@ function submit_query_form(id) {
$('#'+id).submit();
}

function showTab(name) {
function showTab(name, url) {
$('div#content .tab-content').hide();
$('div.tabs a').removeClass('selected');
$('#tab-content-' + name).show();
$('#tab-' + name).addClass('selected');
//replaces current URL with the "href" attribute of the current link
//(only triggered if supported by browser)
if ("replaceState" in window.history) {
window.history.replaceState(null, document.title, url);
}
return false;
}


Loading…
Cancel
Save