mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-10 15:14:33 +08:00
Add output tag to the full live and snapshot view on task for assigned items [SCI-11559]
This commit is contained in:
parent
a6dbe4bb78
commit
356414f794
3 changed files with 19 additions and 19 deletions
|
@ -129,9 +129,7 @@ var MyModuleRepositories = (function() {
|
|||
}, {
|
||||
targets: 3,
|
||||
className: 'item-name',
|
||||
render: function(data, type, row) {
|
||||
return "<a href='" + row.recordInfoUrl + "' class='record-info-link'>" + data + '</a>';
|
||||
}
|
||||
render: (data, type, row) => renderFullViewName(data, row)
|
||||
}, {
|
||||
targets: 4,
|
||||
class: 'relationship',
|
||||
|
@ -141,7 +139,7 @@ var MyModuleRepositories = (function() {
|
|||
columnDefs.push({
|
||||
targets: 2,
|
||||
className: 'item-name',
|
||||
render: (data, type, row) => `<a href="${row.recordInfoUrl}" class="record-info-link">${data}</a>`,
|
||||
render: (data, type, row) => renderFullViewName(data, row)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -214,6 +212,16 @@ var MyModuleRepositories = (function() {
|
|||
return columnDefs;
|
||||
}
|
||||
|
||||
function renderFullViewName(data, row) {
|
||||
let tags = '';
|
||||
|
||||
row.DT_RowAttr['data-state'].forEach((state) => {
|
||||
tags += `<span class="text-sn-grey bg-sn-light-grey text-xs px-1.5 py-1 text-nowrap">${state}</span>`;
|
||||
});
|
||||
|
||||
return `<div class='flex items-center gap-2'><a href='${row.recordInfoUrl}' class='record-info-link wrap'>${data}</a> ${tags}</div>`;
|
||||
}
|
||||
|
||||
function renderSimpleTable(tableContainer) {
|
||||
if (SIMPLE_TABLE) SIMPLE_TABLE.destroy();
|
||||
SIMPLE_TABLE = $(tableContainer).DataTable({
|
||||
|
@ -364,9 +372,6 @@ var MyModuleRepositories = (function() {
|
|||
$(row).addClass('selected');
|
||||
checkbox.attr('checked', !checkbox.attr('checked'));
|
||||
}
|
||||
},
|
||||
createdRow: function(row, data) {
|
||||
$(row).find('.item-name').attr('data-state', data.DT_RowAttr['data-state']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ module RepositoryDatatableHelper
|
|||
row = public_send(default_columns_method_name, record)
|
||||
row['code'] = record.code
|
||||
row['DT_RowId'] = record.id
|
||||
row['DT_RowAttr'] = { 'data-state': row_style(record), 'data-e2e': "e2e-TR-invInventory-bodyRow-#{record.id}" }
|
||||
row['DT_RowAttr'] = { 'data-state': row_style(record, options[:my_module]), 'data-e2e': "e2e-TR-invInventory-bodyRow-#{record.id}" }
|
||||
row['recordInfoUrl'] = Rails.application.routes.url_helpers.repository_repository_row_path(repository.id, record.id)
|
||||
row['rowRemindersUrl'] = Rails.application.routes.url_helpers
|
||||
.active_reminder_repository_cells_repository_repository_row_url(repository.id, record.id)
|
||||
|
@ -108,7 +108,7 @@ module RepositoryDatatableHelper
|
|||
repository_rows.map do |record|
|
||||
row = {
|
||||
DT_RowId: record.id,
|
||||
DT_RowAttr: { 'data-state': simple_row_style(record, my_module) },
|
||||
DT_RowAttr: { 'data-state': row_style(record, my_module) },
|
||||
'0': escape_input(record.name),
|
||||
recordInfoUrl: Rails.application.routes.url_helpers.repository_repository_row_path(record.repository, record),
|
||||
rowRemindersUrl:
|
||||
|
@ -175,12 +175,12 @@ module RepositoryDatatableHelper
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_snapshot_row_columns(repository_rows, columns_mappings, team, repository_snapshot, options = {})
|
||||
def prepare_snapshot_row_columns(repository_rows, columns_mappings, team, repository_snapshot, my_module, options = {})
|
||||
has_stock_management = repository_snapshot.has_stock_management?
|
||||
repository_rows.map do |record|
|
||||
row = {
|
||||
'DT_RowId': record.id,
|
||||
'DT_RowAttr': { 'data-state': row_style(record) },
|
||||
'DT_RowAttr': { 'data-state': row_style(record, my_module) },
|
||||
'1': record.code,
|
||||
'2': escape_input(record.name),
|
||||
'3': I18n.l(record.created_at, format: :full),
|
||||
|
@ -299,13 +299,7 @@ module RepositoryDatatableHelper
|
|||
).serializable_hash
|
||||
end
|
||||
|
||||
def row_style(row)
|
||||
return I18n.t('general.archived') if row.archived
|
||||
|
||||
''
|
||||
end
|
||||
|
||||
def simple_row_style(row, my_module)
|
||||
def row_style(row, my_module)
|
||||
style = []
|
||||
style << I18n.t('general.archived') if row.archived
|
||||
style << I18n.t('general.output') if row.output? && row.my_module.id == my_module&.id
|
||||
|
|
|
@ -5,7 +5,8 @@ json.data do
|
|||
json.array! prepare_snapshot_row_columns(@repository_rows,
|
||||
@columns_mappings,
|
||||
@repository_snapshot.team,
|
||||
@repository_snapshot)
|
||||
@repository_snapshot,
|
||||
@my_module)
|
||||
end
|
||||
json.recordsFiltered @filtered_rows_count
|
||||
json.recordsTotal @all_rows_count
|
||||
|
|
Loading…
Add table
Reference in a new issue