diff --git a/app/assets/javascripts/repositories/index.js b/app/assets/javascripts/repositories/index.js index 49b3856af..bcc1b48e4 100644 --- a/app/assets/javascripts/repositories/index.js +++ b/app/assets/javascripts/repositories/index.js @@ -31,8 +31,8 @@ } function initRepositoriesDataTable(tableContainer, archived = false) { - var tableTemplate = archived ? $('#archivedRepositoriesListTable').html() : $('#activeRepositoriesListTable').html(); - $.get($(tableTemplate).data('source'), function(data) { + var tableTemplate = $('#RepositoriesListTable').html(); + $.get($(tableTemplate).data('source'), {archived: archived}, function(data) { if (REPOSITORIES_TABLE) REPOSITORIES_TABLE.destroy(); CHECKBOX_SELECTOR = null; $('.content-body').html(tableTemplate); @@ -65,6 +65,22 @@ render: function(value, type, row) { return `${value}`; } + }, { + targets: 5, + render: { + _: 'display', + sort: 'sort' + } + }, { + targets: 7, + visible: archived, + render: { + _: 'display', + sort: 'sort' + } + }, { + targets: 8, + visible: archived }], fnInitComplete: function(e) { var dataTableWrapper = $(e.nTableWrapper); diff --git a/app/helpers/repositories_datatable_helper.rb b/app/helpers/repositories_datatable_helper.rb index e1f4131d8..a5b513196 100644 --- a/app/helpers/repositories_datatable_helper.rb +++ b/app/helpers/repositories_datatable_helper.rb @@ -13,9 +13,15 @@ module RepositoriesDatatableHelper '2': repository.repository_rows.size, '3': shared_label(repository, team), '4': escape_input(repository.team.name), - '5': I18n.l(repository.created_at, format: :full), + '5': { + display: I18n.l(repository.created_at, format: :full), + sort: repository.created_at.to_i + }, '6': escape_input(repository.created_by.full_name), - '7': (I18n.l(repository.archived_on, format: :full) if repository.archived_on), + '7': { + display: (I18n.l(repository.archived_on, format: :full) if repository.archived_on), + sort: repository.archived_on&.to_i + }, '8': escape_input(repository.archived_by&.full_name), 'repositoryUrl': repository_path(repository), 'DT_RowAttr': { diff --git a/app/views/repositories/index.html.erb b/app/views/repositories/index.html.erb index aecd7597e..d0a9c8955 100644 --- a/app/views/repositories/index.html.erb +++ b/app/views/repositories/index.html.erb @@ -24,35 +24,10 @@ <% end %> - -