2023-09-18 22:24:07 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
json.id @repository_row.id
|
2023-10-12 20:43:17 +08:00
|
|
|
|
|
|
|
json.repository do
|
|
|
|
json.id @repository.id
|
|
|
|
json.name @repository.name
|
|
|
|
end
|
|
|
|
|
2023-09-27 15:55:53 +08:00
|
|
|
json.permissions do
|
|
|
|
json.can_export_repository_stock can_export_repository_stock?(@repository_row.repository)
|
|
|
|
end
|
2023-10-12 21:46:13 +08:00
|
|
|
|
|
|
|
json.actions do
|
|
|
|
if @my_module.present?
|
|
|
|
json.assign_repository_row do
|
|
|
|
json.assign_url my_module_repositories_path(@my_module.id)
|
|
|
|
json.disabled @my_module_assign_error.present?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-09-18 22:24:07 +08:00
|
|
|
json.default_columns do
|
|
|
|
json.name @repository_row.name
|
|
|
|
json.code @repository_row.code
|
2023-10-12 21:26:41 +08:00
|
|
|
json.added_on I18n.l(@repository_row.created_at, format: :full)
|
2023-09-18 22:24:07 +08:00
|
|
|
json.added_by @repository_row.created_by&.full_name
|
|
|
|
json.archived @repository_row.archived?
|
2023-10-16 16:51:08 +08:00
|
|
|
if @repository_row.archived?
|
|
|
|
json.archived_on I18n.l(@repository_row.archived_on, format: :full)
|
|
|
|
json.archived_by @repository_row.archived_by
|
|
|
|
end
|
2023-09-18 22:24:07 +08:00
|
|
|
end
|
2023-10-13 15:51:50 +08:00
|
|
|
|
2023-09-18 22:24:07 +08:00
|
|
|
json.custom_columns do
|
2023-10-13 15:51:50 +08:00
|
|
|
json.array! @repository_row.repository.repository_columns.each do |repository_column|
|
|
|
|
repository_cell = @repository_row.repository_cells.find_by(repository_column: repository_column)
|
|
|
|
if repository_cell
|
|
|
|
json.merge! **serialize_repository_cell_value(repository_cell, @repository.team, @repository, reminders_enabled: @reminders_present).merge(
|
|
|
|
**repository_cell.repository_column.as_json(only: %i(id name data_type))
|
|
|
|
)
|
|
|
|
else
|
|
|
|
json.merge! repository_column.as_json(only: %i(id name data_type))
|
|
|
|
end
|
2023-09-18 22:24:07 +08:00
|
|
|
end
|
|
|
|
end
|
2023-09-19 21:37:01 +08:00
|
|
|
|
|
|
|
json.assigned_modules do
|
2023-09-25 14:29:54 +08:00
|
|
|
json.total_assigned_size @assigned_modules.size
|
2023-09-19 21:37:01 +08:00
|
|
|
json.viewable_modules do
|
|
|
|
json.array! @viewable_modules do |my_module|
|
2023-09-27 15:36:23 +08:00
|
|
|
json.merge! serialize_assigned_my_module_value(my_module)
|
2023-09-19 21:37:01 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|