scinote-web/app/helpers/repositories_datatable_helper.rb
2020-06-09 13:16:50 +02:00

25 lines
906 B
Ruby

# frozen_string_literal: true
module RepositoriesDatatableHelper
include InputSanitizeHelper
def prepare_repositories_datatable(repositories, team, _config)
result = []
repositories = repositories.includes(:repository_rows, :team, :created_by, :archived_by)
repositories.each do |repository|
result.push(
'DT_RowId': repository.id,
'1': escape_input(repository.name),
'2': repository.repository_rows.size,
'3': repository.shared_with?(team),
'4': escape_input(repository.team.name),
'5': I18n.l(repository.created_at, format: :full),
'6': escape_input(repository.created_by.full_name),
'7': (I18n.l(repository.archived_on, format: :full) if repository.archived_on),
'8': escape_input(repository.archived_by&.full_name),
'repositoryUrl': repository_path(repository)
)
end
result
end
end