app/views/admin/activities/_activity.html.arb
# frozen_string_literal: true
collection = activity.results.includes(athlete: :club).order(:position)
panel 'Детали забега' do
attributes_table_for activity do
row 'Забег', &:event_name
row :date
row(:description) { |a| sanitized_text a.description }
row :correct?
row :published
row('Протокол на сайте') { |a| link_to activity_url(a), a } if activity.published
end
end
panel 'Протокол' do
table_for collection, row_class: ->(r) { 'athlete-error' unless r.correct? } do
column :position
column('QR-ID') { |r| athlete_code_id r.athlete }
column :athlete
column(:total_time) { |r| human_result_time r.total_time }
column(:gender) do |r|
if (athlete = r.athlete)
athlete.gender || render(partial: 'gender_links', locals: { result: r, activity: activity })
end
end
column(:club) { |r| r.athlete&.club&.name }
end
end
panel 'Волонтёры' do
table_for activity.volunteers_roster.includes(:athlete) do
column(:role) { |v| human_volunteer_role v.role }
column('QR-ID') { |v| athlete_code_id v.athlete }
column(:name) { |v| link_to v.name, admin_athlete_path(v.athlete) }
column :comment
end
end
panel 'Правки забега' do
render partial: 'admin/audits_table', locals: { object: activity }
end
render partial: 'protocol_validation' if collection.exists?