mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-14 17:14:54 +08:00
fix selection of tab after redirection
This commit is contained in:
parent
71c523c406
commit
0004c2b7d5
2 changed files with 12 additions and 7 deletions
|
@ -30,8 +30,16 @@ function loadRepositoryTab() {
|
|||
});
|
||||
});
|
||||
|
||||
// load first tab content
|
||||
$('#repository-tabs a:first').click();
|
||||
// on page load
|
||||
if( getParam('repository') ){
|
||||
// load selected tab
|
||||
var param = getParam('repository');
|
||||
$('a[href="#custom_repo_'+param+'"]').click();
|
||||
}
|
||||
else {
|
||||
// load first tab content
|
||||
$('#repository-tabs a:first').click();
|
||||
}
|
||||
|
||||
// clean tab content
|
||||
$('a[data-toggle="tab"]').on('hide.bs.tab', function (e) {
|
||||
|
|
|
@ -4,13 +4,10 @@
|
|||
<%= render partial: "repositories/breadcrumbs.html.erb",
|
||||
locals: { teams: @teams, current_team: current_team, type: @type } %>
|
||||
|
||||
<% active_repo = @repositories.find_by_id(params[:repository]) %>
|
||||
<% active_repo = @repositories.first if !active_repo %>
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs nav-settings" role="tablist" id="repository-tabs">
|
||||
<% @repositories.each do |repo| %>
|
||||
<li role="presentation" class="<%= 'active' if repo == active_repo %>">
|
||||
<li role="presentation">
|
||||
<a href="#custom_repo_<%= repo.id %>"
|
||||
data-toggle="tab"
|
||||
aria-controls="custom_repo_<%= repo.id %>"
|
||||
|
@ -39,7 +36,7 @@
|
|||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<% @repositories.each do |repo| %>
|
||||
<div class="tab-pane tab-pane-settings <%= 'active' if repo == active_repo %>" id="custom_repo_<%= repo.id %>">
|
||||
<div class="tab-pane tab-pane-settings" id="custom_repo_<%= repo.id %>">
|
||||
<!-- Tab Content -->
|
||||
<div class="tab-content-body"></div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue