mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-27 10:08:11 +08:00
Add smart annotations to repository text value
This commit is contained in:
parent
751d34a078
commit
d5675c0c33
2 changed files with 12 additions and 5 deletions
|
@ -6,7 +6,7 @@ module RepositoryDatatableHelper
|
||||||
def prepare_row_columns(repository_rows,
|
def prepare_row_columns(repository_rows,
|
||||||
repository,
|
repository,
|
||||||
columns_mappings,
|
columns_mappings,
|
||||||
_team,
|
team,
|
||||||
assigned_rows)
|
assigned_rows)
|
||||||
parsed_records = []
|
parsed_records = []
|
||||||
includes_json = { repository_cells: Extends::REPOSITORY_SEARCH_INCLUDES }
|
includes_json = { repository_cells: Extends::REPOSITORY_SEARCH_INCLUDES }
|
||||||
|
@ -36,7 +36,7 @@ module RepositoryDatatableHelper
|
||||||
# Add custom columns
|
# Add custom columns
|
||||||
record.repository_cells.each do |cell|
|
record.repository_cells.each do |cell|
|
||||||
row[columns_mappings[cell.repository_column.id]] =
|
row[columns_mappings[cell.repository_column.id]] =
|
||||||
display_cell_value(cell)
|
display_cell_value(cell, team)
|
||||||
end
|
end
|
||||||
parsed_records << row
|
parsed_records << row
|
||||||
end
|
end
|
||||||
|
@ -66,8 +66,8 @@ module RepositoryDatatableHelper
|
||||||
Constants::REPOSITORY_TABLE_DEFAULT_STATE['columns'].to_json
|
Constants::REPOSITORY_TABLE_DEFAULT_STATE['columns'].to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_cell_value(cell)
|
def display_cell_value(cell, team)
|
||||||
"RepositoryDatatable::#{cell.repository_column.data_type}Serializer"
|
"RepositoryDatatable::#{cell.repository_column.data_type}Serializer"
|
||||||
.constantize.new(cell.value).serializable_hash
|
.constantize.new(cell.value, scope: { team: team, user: current_user }).serializable_hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,8 +2,15 @@
|
||||||
|
|
||||||
module RepositoryDatatable
|
module RepositoryDatatable
|
||||||
class RepositoryTextValueSerializer < RepositoryBaseValueSerializer
|
class RepositoryTextValueSerializer < RepositoryBaseValueSerializer
|
||||||
|
include InputSanitizeHelper
|
||||||
|
include ActionView::Helpers::TextHelper
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
def value
|
def value
|
||||||
object.data
|
@user = scope[:user]
|
||||||
|
custom_auto_link(object.data,
|
||||||
|
simple_format: true,
|
||||||
|
team: scope[:team])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue