mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-28 02:27:57 +08:00
Merge pull request #2700 from aignatov-bio/ai-sci-4801-inventory-list-sorting-date-issue
Fix date columns sorting in repositories list [SCI-4801]
This commit is contained in:
commit
a994c75885
3 changed files with 28 additions and 31 deletions
|
@ -31,8 +31,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function initRepositoriesDataTable(tableContainer, archived = false) {
|
function initRepositoriesDataTable(tableContainer, archived = false) {
|
||||||
var tableTemplate = archived ? $('#archivedRepositoriesListTable').html() : $('#activeRepositoriesListTable').html();
|
var tableTemplate = $('#RepositoriesListTable').html();
|
||||||
$.get($(tableTemplate).data('source'), function(data) {
|
$.get($(tableTemplate).data('source'), {archived: archived}, function(data) {
|
||||||
if (REPOSITORIES_TABLE) REPOSITORIES_TABLE.destroy();
|
if (REPOSITORIES_TABLE) REPOSITORIES_TABLE.destroy();
|
||||||
CHECKBOX_SELECTOR = null;
|
CHECKBOX_SELECTOR = null;
|
||||||
$('.content-body').html(tableTemplate);
|
$('.content-body').html(tableTemplate);
|
||||||
|
@ -65,6 +65,22 @@
|
||||||
render: function(value, type, row) {
|
render: function(value, type, row) {
|
||||||
return `<a href="${row.repositoryUrl}">${value}</a>`;
|
return `<a href="${row.repositoryUrl}">${value}</a>`;
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
targets: 5,
|
||||||
|
render: {
|
||||||
|
_: 'display',
|
||||||
|
sort: 'sort'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
targets: 7,
|
||||||
|
visible: archived,
|
||||||
|
render: {
|
||||||
|
_: 'display',
|
||||||
|
sort: 'sort'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
targets: 8,
|
||||||
|
visible: archived
|
||||||
}],
|
}],
|
||||||
fnInitComplete: function(e) {
|
fnInitComplete: function(e) {
|
||||||
var dataTableWrapper = $(e.nTableWrapper);
|
var dataTableWrapper = $(e.nTableWrapper);
|
||||||
|
|
|
@ -13,9 +13,15 @@ module RepositoriesDatatableHelper
|
||||||
'2': repository.repository_rows.size,
|
'2': repository.repository_rows.size,
|
||||||
'3': shared_label(repository, team),
|
'3': shared_label(repository, team),
|
||||||
'4': escape_input(repository.team.name),
|
'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),
|
'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),
|
'8': escape_input(repository.archived_by&.full_name),
|
||||||
'repositoryUrl': repository_path(repository),
|
'repositoryUrl': repository_path(repository),
|
||||||
'DT_RowAttr': {
|
'DT_RowAttr': {
|
||||||
|
|
|
@ -24,35 +24,10 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<!-- Active table template -->
|
<!-- table template -->
|
||||||
<template id="activeRepositoriesListTable">
|
<template id="RepositoriesListTable">
|
||||||
<table id="repositoriesList" class="table"
|
<table id="repositoriesList" class="table"
|
||||||
data-source="<%= team_repositories_path(current_team, format: :json) %>">
|
data-source="<%= team_repositories_path(current_team, format: :json) %>">
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<div class="sci-checkbox-container">
|
|
||||||
<input value="1" type="checkbox" class="sci-checkbox select-all-checkbox">
|
|
||||||
<span class="sci-checkbox-label"></span>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<th><%= t('libraries.index.table.name') %></th>
|
|
||||||
<th><%= t('libraries.index.table.number_of_items') %></th>
|
|
||||||
<th><%= t('libraries.index.table.shared') %></th>
|
|
||||||
<th><%= t('libraries.index.table.ownership') %></th>
|
|
||||||
<th><%= t('libraries.index.table.added_on') %></th>
|
|
||||||
<th><%= t('libraries.index.table.added_by') %></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Archived table template -->
|
|
||||||
<template id="archivedRepositoriesListTable">
|
|
||||||
<table id="repositoriesList" class="table"
|
|
||||||
data-source="<%= team_repositories_path(current_team, archived: true, format: :json) %>"
|
|
||||||
>
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
|
|
Loading…
Reference in a new issue