diff --git a/app/assets/javascripts/my_modules/repositories.js b/app/assets/javascripts/my_modules/repositories.js index ca43fbf2b..b508a596a 100644 --- a/app/assets/javascripts/my_modules/repositories.js +++ b/app/assets/javascripts/my_modules/repositories.js @@ -103,7 +103,7 @@ var MyModuleRepositories = (function() { ajax: { url: $(tableContainer).data('source'), data: function(d) { - d.order[0].column = 3; + d.order[0].column = tableContainer.data('name-column-id'); d.assigned = 'assigned'; d.view_mode = true; d.simple_view = true; @@ -122,9 +122,7 @@ var MyModuleRepositories = (function() { var repositoryContainer = $(this).closest('.assigned-repository-container'); repositoryContainer.find('.table.dataTable').removeClass('hidden'); repositoryContainer.find('.version-label').html(tableContainer.data('version-label')); - setTimeout(function() { - SIMPLE_TABLE.columns.adjust(); - }, 500); + SIMPLE_TABLE.columns.adjust(); } }); } @@ -280,11 +278,12 @@ var MyModuleRepositories = (function() { } function initSimpleTable() { - $('#assigned-items-container').on('show.bs.collapse', '.assigned-repository-container', function() { + $('#assigned-items-container').on('shown.bs.collapse', '.assigned-repository-container', function() { var repositoryContainer = $(this); var repositoryTemplate = $($('#myModuleRepositorySimpleTemplate').html()); repositoryTemplate.attr('data-source', $(this).data('repository-url')); repositoryTemplate.attr('data-version-label', $(this).data('footer-label')); + repositoryTemplate.attr('data-name-column-id', $(this).data('name-column-id')); repositoryContainer.html(repositoryTemplate); renderSimpleTable(repositoryTemplate); }); diff --git a/app/helpers/my_modules_helper.rb b/app/helpers/my_modules_helper.rb index b6c79b559..f467093de 100644 --- a/app/helpers/my_modules_helper.rb +++ b/app/helpers/my_modules_helper.rb @@ -96,4 +96,8 @@ module MyModulesHelper t('my_modules.repository.snapshots.simple_view.live_bottom_label') end + + def assigned_repository_simple_view_name_column_id(repository) + repository.is_a?(RepositorySnapshot) ? 2 : 3 + end end diff --git a/app/views/my_modules/repositories/_repositories_list.html.erb b/app/views/my_modules/repositories/_repositories_list.html.erb index 033c1c0c1..7da11b4de 100644 --- a/app/views/my_modules/repositories/_repositories_list.html.erb +++ b/app/views/my_modules/repositories/_repositories_list.html.erb @@ -21,6 +21,7 @@ id="assigned-repository-items-container-<%= repository.id %>" data-repository-url="<%= assigned_repository_simple_view_index_path(@my_module, repository) %>" data-footer-label="<%= assigned_repository_simple_view_footer_label(repository) %>" + data-name-column-id="<%= assigned_repository_simple_view_name_column_id(repository) %>" >