Fix snapshot name column id

This commit is contained in:
aignatov-bio 2020-05-22 15:10:21 +02:00
parent 0aa1c32813
commit cbc578f84b
3 changed files with 9 additions and 5 deletions

View file

@ -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);
}
});
}
@ -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);
});

View file

@ -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

View file

@ -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) %>"
>
</div>
</div>