mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Merge pull request #2706 from aignatov-bio/ai-sci-4820-fix-sidebar-inventory-refresh
Improve active/archive switcher [SCI-4820]
This commit is contained in:
commit
716319354b
2 changed files with 7 additions and 7 deletions
|
@ -100,9 +100,9 @@
|
|||
|
||||
function reloadSidebar() {
|
||||
var slidePanel = $('#slide-panel');
|
||||
var archived;
|
||||
if ($('.repositories-index').hasClass('archived')) archived = true;
|
||||
$.get(slidePanel.data('sidebar-url'), { archived: archived }, function(data) {
|
||||
$.get(slidePanel.data('sidebar-url'), {
|
||||
archived: $('.repositories-index').hasClass('archived')
|
||||
}, function(data) {
|
||||
slidePanel.html(data.html);
|
||||
$('.create-new-repository').initializeModal('#create-repo-modal');
|
||||
});
|
||||
|
@ -111,12 +111,12 @@
|
|||
function initRepositoryViewSwitcher() {
|
||||
var viewSwitch = $('.view-switch');
|
||||
viewSwitch.on('click', '.view-switch-archived', function() {
|
||||
$('.repositories-index').toggleClass('archived active');
|
||||
$('.repositories-index').removeClass('active').addClass('archived');
|
||||
initRepositoriesDataTable('#repositoriesList', true);
|
||||
reloadSidebar();
|
||||
});
|
||||
viewSwitch.on('click', '.view-switch-active', function() {
|
||||
$('.repositories-index').toggleClass('archived active');
|
||||
$('.repositories-index').removeClass('archived').addClass('active');
|
||||
initRepositoriesDataTable('#repositoriesList');
|
||||
reloadSidebar();
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ class RepositoriesController < ApplicationController
|
|||
render json: {
|
||||
html: render_to_string(partial: 'repositories/sidebar_list.html.erb', locals: {
|
||||
repositories: @repositories,
|
||||
archived: params[:archived]
|
||||
archived: params[:archived] == 'true'
|
||||
})
|
||||
}
|
||||
end
|
||||
|
@ -376,7 +376,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def load_repositories
|
||||
@repositories = Repository.accessible_by_teams(current_team).order('repositories.created_at ASC')
|
||||
@repositories = if params[:archived] || @repository&.archived?
|
||||
@repositories = if params[:archived] == 'true' || @repository&.archived?
|
||||
@repositories.archived
|
||||
else
|
||||
@repositories.active
|
||||
|
|
Loading…
Reference in a new issue