Refactor the new/edit submission forms

This commit is contained in:
Michael Ball 2021-03-23 22:43:11 -07:00
parent c55eff4eec
commit ed20ff3b51
5 changed files with 101 additions and 115 deletions

View file

@ -60,6 +60,19 @@ module EventsHelper
"#{event.average_rating}/#{max_rating}, #{pluralize(event.voters.length, 'vote')}"
end
def event_type_options(event_types)
event_types.map do |type|
[
"#{type.title} - #{show_time(type.length)}",
type.id,
data: {
min_words: type.minimum_abstract_length,
max_words: type.maximum_abstract_length,
help: type.submission_instructions
}
]
end
end
def event_type_dropdown(event, event_types, conference_id)
selection = event.event_type.try(:title) || 'Event Type'
options = event_types.collect do |event_type|