New registration process

This commit is contained in:
Godwin
2017-05-30 19:24:44 -07:00
parent 4115c8996f
commit c871b1ab3d
270 changed files with 94667 additions and 137 deletions
+2 -2
View File
@@ -379,7 +379,7 @@ module FormHelper
return html.html_safe
end
def radiobuttons(name, boxes, value, label_key, options = {})
def radiobuttons(name, boxes, value, label_key = '', options = {})
checkboxes(name, boxes, [value], label_key, options.merge({radiobuttons: true}))
end
@@ -404,7 +404,7 @@ module FormHelper
return new_id
end
def checkboxes(name, boxes, values, label_key, options = {})
def checkboxes(name, boxes, values, label_key = '', options = {})
html = ''
boxes.map! { |box| box.is_a?(String) ? box.to_sym : box }
values.map! { |value| value.is_a?(String) ? value.to_sym : value } if values.is_a?(Array)
+2 -2
View File
@@ -32,7 +32,7 @@ module I18nHelper
end
def date(date, format = :long)
I18n.l(date.is_a?(String) ? Date.parse(date) : date, :format => format)
I18n.l(date.is_a?(String) ? Date.parse(date) : date, format: format)
end
def time(time, format = :short)
@@ -54,7 +54,7 @@ module I18nHelper
end
d1 = I18n.l(date1.to_date, format: "span_#{key}_date_1".to_sym)
d2 = I18n.l(date2.to_date, format: "span_#{key}_date_2".to_sym)
_('date.date_span', vars: {:date_1 => d1, :date_2 => d2})
_('date.date_span', vars: { date_1: d1, date_2: d2 })
end
def time_length(length)
+19 -5
View File
@@ -78,12 +78,16 @@ module RegistrationHelper
end.html_safe
end
def registration_step_header_title(step = @step, vars = nil)
def registration_step_header_title_string(step = @step, vars = nil)
if step.is_a?(Hash)
vars = step
step = @step
end
content_tag(:h2, (_"articles.conference_registration.headings.#{@step}", :t, 2, vars: vars || {})).html_safe
_("articles.conference_registration.headings.#{step}", :t, 2, vars: vars || {})
end
def registration_step_header_title(step = @step, vars = nil)
content_tag(:h2, registration_step_header_title_string(step, vars)).html_safe
end
def registration_step_header_description(step = @step, vars = nil)
@@ -91,22 +95,32 @@ module RegistrationHelper
vars = step
step = @step
end
content_tag(:p, (_"articles.conference_registration.paragraphs.#{@step}", :p, 2, vars: vars || {})).html_safe
content_tag(:p, (_"articles.conference_registration.paragraphs.#{step}", :p, 2, vars: vars || {})).html_safe
end
def save_registration_step(conference = @this_conference, step = @step, &block)
def save_registration_step(conference = @this_conference, step = @step, registration = nil, &block)
registration ||= ConferenceRegistration.find_by(user_id: current_user.id, conference_id: conference.id)
buttons = [:back]
case step.to_sym
when :policy
buttons = [:agree]
when :name, :languages, :org_location, :org_create_name, :org_create_address, :org_create_email, :org_create_mailing_address, :housing_companion_email, :housing_companion_invite, :housing_allergies, :housing_other
when :name, :languages, :org_location, :org_create_name, :org_create_address, :org_create_email, :org_create_mailing_address,
:housing_companion_email, :housing_companion_invite, :housing_allergies, :housing_other, :org_non_member_interest,
:hosting_address, :hosting_phone, :hosting_space_beds, :hosting_space_floor, :hosting_info, :hosting_other
buttons = [:next, :back]
when :org_location_confirm
buttons = [:yes, :back]
when :confirm_payment
buttons = [:confirm, :cancel]
when :review
buttons = nil
end
if buttons.present? && registration.present? && registration.registration_complete?
buttons << :review
end
content = block.present? ? capture(&block) : ''
actions = ''
if buttons.present?