diff --git a/app/assets/javascripts/my_modules/repositories.js b/app/assets/javascripts/my_modules/repositories.js index 6dde1d3f1..20e3664f4 100644 --- a/app/assets/javascripts/my_modules/repositories.js +++ b/app/assets/javascripts/my_modules/repositories.js @@ -11,11 +11,14 @@ var MyModuleRepositories = (function() { var FULL_VIEW_TABLE_SCROLLBAR; var SELECTED_ROWS = {}; - function reloadRepositoriesList() { + function reloadRepositoriesList(repositoryId) { var repositoriesContainer = $('#assigned-items-container'); $.get(repositoriesContainer.data('repositories-list-url'), function(result) { repositoriesContainer.html(result.html); $('.assigned-items-title').attr('data-assigned-items-count', result.assigned_rows_count); + // expand recently updated repository + $('#assigned-items-container').collapse('show'); + $('#assigned-repository-items-container-' + repositoryId).collapse('show'); }); } @@ -600,7 +603,7 @@ var MyModuleRepositories = (function() { $(FULL_VIEW_TABLE.table().container()).find('.dataTable') .attr('data-assigned-items-count', data.rows_count); FULL_VIEW_TABLE.ajax.reload(null, false); - reloadRepositoriesList(); + reloadRepositoriesList(data.repository_id); updateFullViewRowsCount(data.rows_count); renderFullViewAssignButtons(); }, diff --git a/app/controllers/my_module_repositories_controller.rb b/app/controllers/my_module_repositories_controller.rb index 283691371..a8ae22c54 100644 --- a/app/controllers/my_module_repositories_controller.rb +++ b/app/controllers/my_module_repositories_controller.rb @@ -52,7 +52,11 @@ class MyModuleRepositoriesController < ApplicationController respond_to do |format| format.json do - render json: { flash: flash, rows_count: @my_module.repository_rows_count(@repository) }, status: status + render json: { + flash: flash, + rows_count: @my_module.repository_rows_count(@repository), + repository_id: @repository.repository_snapshots.find_by(selected: true)&.id || @repository.id + }, status: status end end end