mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 07:26:15 +08:00
Add archived tags to assigned repository rows
This commit is contained in:
parent
9dd5996122
commit
9bac0fb867
|
@ -69,12 +69,19 @@ var MyModuleRepositories = (function() {
|
|||
}
|
||||
}, {
|
||||
targets: 3,
|
||||
className: 'item-name',
|
||||
render: function(data, type, row) {
|
||||
return "<a href='" + row.recordInfoUrl + "' class='record-info-link'>" + data + '</a>';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
columnDefs.push({
|
||||
targets: 3,
|
||||
className: 'item-name'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
columnDefs.push(
|
||||
{
|
||||
targets: '_all',
|
||||
|
@ -116,6 +123,7 @@ var MyModuleRepositories = (function() {
|
|||
},
|
||||
columnDefs: [{
|
||||
targets: 0,
|
||||
className: 'item-name',
|
||||
render: function(data, type, row) {
|
||||
return "<a href='" + row.recordInfoUrl + "'"
|
||||
+ "class='record-info-link'>" + data + '</a>';
|
||||
|
@ -126,6 +134,11 @@ var MyModuleRepositories = (function() {
|
|||
repositoryContainer.find('.table.dataTable').removeClass('hidden');
|
||||
repositoryContainer.find('.version-label').html(tableContainer.data('version-label'));
|
||||
SIMPLE_TABLE.columns.adjust();
|
||||
},
|
||||
rowCallback: function(row, data) {
|
||||
if (data.archived) {
|
||||
$(row).addClass('archived');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -205,7 +218,11 @@ var MyModuleRepositories = (function() {
|
|||
});
|
||||
},
|
||||
|
||||
rowCallback: function(row) {
|
||||
rowCallback: function(row, data) {
|
||||
if (data.archived) {
|
||||
$(row).addClass('archived');
|
||||
}
|
||||
|
||||
var checkbox = $(row).find('.repository-row-selector');
|
||||
if (SELECTED_ROWS[row.id]) {
|
||||
$(row).addClass('selected');
|
||||
|
|
|
@ -66,4 +66,15 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
tr.archived {
|
||||
td.item-name::after {
|
||||
background-color: $color-concrete;
|
||||
color: $color-silver-chalice;
|
||||
content: "Archived";
|
||||
margin-left: 20px;
|
||||
padding: .3em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ module RepositoryDatatableHelper
|
|||
'3': escape_input(record.name),
|
||||
'4': I18n.l(record.created_at, format: :full),
|
||||
'5': escape_input(record.created_by.full_name),
|
||||
'archived': record.archived,
|
||||
'recordInfoUrl': Rails.application.routes.url_helpers.repository_repository_row_path(repository, record)
|
||||
}
|
||||
|
||||
|
@ -38,6 +39,7 @@ module RepositoryDatatableHelper
|
|||
{
|
||||
'DT_RowId': record.id,
|
||||
'0': escape_input(record.name),
|
||||
'archived': record.archived,
|
||||
'recordInfoUrl': Rails.application.routes.url_helpers.repository_repository_row_path(record.repository, record)
|
||||
}
|
||||
end
|
||||
|
@ -51,6 +53,7 @@ module RepositoryDatatableHelper
|
|||
'2': escape_input(record.name),
|
||||
'3': I18n.l(record.created_at, format: :full),
|
||||
'4': escape_input(record.created_by.full_name),
|
||||
'archived': record.archived,
|
||||
'recordInfoUrl': Rails.application.routes.url_helpers.repository_repository_row_path(record.repository, record)
|
||||
}
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@ class MyModule < ApplicationRecord
|
|||
rows.find_each do |row|
|
||||
row_json = []
|
||||
row_json << (row.repository.is_a?(RepositorySnapshot) ? row.parent_id : row.id)
|
||||
row_json << row.name
|
||||
row_json << (row.archived ? "#{row.name} [Archived]" : row.name)
|
||||
row_json << I18n.l(row.created_at, format: :full)
|
||||
row_json << row.created_by.full_name
|
||||
data << row_json
|
||||
|
|
Loading…
Reference in a new issue