Restyled registration add popover
This commit is contained in:
parent
120554d4e7
commit
d70795e72c
@ -393,7 +393,7 @@ body.expanded-element {
|
|||||||
background-color: rgba($black, 0.5);
|
background-color: rgba($black, 0.5);
|
||||||
|
|
||||||
&.open {
|
&.open {
|
||||||
display: block;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-edit-overlay {
|
.modal-edit-overlay {
|
||||||
@ -407,23 +407,39 @@ body.expanded-element {
|
|||||||
|
|
||||||
table {
|
table {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
background-color: $white;
|
||||||
|
|
||||||
|
td.empty {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
border-bottom-color: #F8F8F8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.125em;
|
||||||
|
color: $white;
|
||||||
|
border-color: lighten($colour-1, 12.5%);
|
||||||
|
background-color: $colour-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody th {
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-edit-content {
|
.modal-edit-content {
|
||||||
position: absolute;
|
position: relative;
|
||||||
top: 0;
|
min-width: 50em;
|
||||||
right: 0;
|
max-width: 75em;
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
max-width: 40em;
|
|
||||||
margin: auto;
|
margin: auto;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
z-index: 1002;
|
z-index: 1002;
|
||||||
background-color: #F8F8F8;
|
background-color: #F8F8F8;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
.actions {
|
||||||
background-color: $white;
|
margin: 1em 1em 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,6 +481,7 @@ class ConferencesController < ApplicationController
|
|||||||
:email,
|
:email,
|
||||||
:status,
|
:status,
|
||||||
:is_attending,
|
:is_attending,
|
||||||
|
:is_subscribed,
|
||||||
:registration_fees_paid,
|
:registration_fees_paid,
|
||||||
:date,
|
:date,
|
||||||
:city,
|
:city,
|
||||||
@ -502,7 +503,8 @@ class ConferencesController < ApplicationController
|
|||||||
:last_day,
|
:last_day,
|
||||||
:address,
|
:address,
|
||||||
:phone
|
:phone
|
||||||
] + ConferenceRegistration.all_spaces + [
|
] + ConferenceRegistration.all_spaces +
|
||||||
|
ConferenceRegistration.all_considerations + [
|
||||||
:notes
|
:notes
|
||||||
],
|
],
|
||||||
column_types: {
|
column_types: {
|
||||||
@ -524,7 +526,8 @@ class ConferencesController < ApplicationController
|
|||||||
email: 'forms.labels.generic.email',
|
email: 'forms.labels.generic.email',
|
||||||
status: 'forms.labels.generic.registration_status',
|
status: 'forms.labels.generic.registration_status',
|
||||||
is_attending: 'articles.conference_registration.terms.is_attending',
|
is_attending: 'articles.conference_registration.terms.is_attending',
|
||||||
city: 'forms.labels.generic.location',
|
is_subscribed: 'articles.user_settings.headings.email_subscribe',
|
||||||
|
city: 'forms.labels.generic.event_location',
|
||||||
date: 'articles.conference_registration.terms.Date',
|
date: 'articles.conference_registration.terms.Date',
|
||||||
preferred_language: 'articles.conference_registration.terms.Preferred_Languages',
|
preferred_language: 'articles.conference_registration.terms.Preferred_Languages',
|
||||||
arrival: 'forms.labels.generic.arrival',
|
arrival: 'forms.labels.generic.arrival',
|
||||||
@ -536,13 +539,16 @@ class ConferencesController < ApplicationController
|
|||||||
companion_email: 'articles.conference_registration.terms.companion_email',
|
companion_email: 'articles.conference_registration.terms.companion_email',
|
||||||
allergies: 'forms.labels.generic.allergies',
|
allergies: 'forms.labels.generic.allergies',
|
||||||
registration_fees_paid: 'articles.conference_registration.headings.fees_paid',
|
registration_fees_paid: 'articles.conference_registration.headings.fees_paid',
|
||||||
other: 'articles.conference_registration.headings.other',
|
other: 'forms.labels.generic.other_notes',
|
||||||
can_provide_housing: 'articles.conference_registration.can_provide_housing',
|
can_provide_housing: 'articles.conference_registration.can_provide_housing',
|
||||||
first_day: 'forms.labels.generic.first_day',
|
first_day: 'forms.labels.generic.first_day',
|
||||||
last_day: 'forms.labels.generic.last_day',
|
last_day: 'forms.labels.generic.last_day',
|
||||||
notes: 'forms.labels.generic.notes',
|
notes: 'forms.labels.generic.notes',
|
||||||
phone: 'forms.labels.generic.phone',
|
phone: 'forms.labels.generic.phone',
|
||||||
address: 'forms.labels.generic.address'
|
address: 'forms.labels.generic.address',
|
||||||
|
contact_info: 'articles.conference_registration.headings.contact_info',
|
||||||
|
questions: 'articles.conference_registration.headings.questions',
|
||||||
|
hosting: 'articles.conference_registration.headings.hosting'
|
||||||
},
|
},
|
||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
@ -553,6 +559,9 @@ class ConferencesController < ApplicationController
|
|||||||
@excel_data[:column_types][s] = :number
|
@excel_data[:column_types][s] = :number
|
||||||
@excel_data[:keys][s] = "forms.labels.generic.#{s.to_s}"
|
@excel_data[:keys][s] = "forms.labels.generic.#{s.to_s}"
|
||||||
end
|
end
|
||||||
|
ConferenceRegistration.all_considerations.each do |c|
|
||||||
|
@excel_data[:keys][c] = "articles.conference_registration.host.considerations.#{c.to_s}"
|
||||||
|
end
|
||||||
@registrations.each do | r |
|
@registrations.each do | r |
|
||||||
user = r.user_id ? User.where(id: r.user_id).first : nil
|
user = r.user_id ? User.where(id: r.user_id).first : nil
|
||||||
if user.present?
|
if user.present?
|
||||||
@ -572,10 +581,10 @@ class ConferencesController < ApplicationController
|
|||||||
email: user.email || '',
|
email: user.email || '',
|
||||||
status: (view_context._"articles.conference_registration.terms.registration_status.#{(steps.include? 'questions') ? 'registered' : ((steps.include? 'contact_info') ? 'preregistered' : 'unregistered')}"),
|
status: (view_context._"articles.conference_registration.terms.registration_status.#{(steps.include? 'questions') ? 'registered' : ((steps.include? 'contact_info') ? 'preregistered' : 'unregistered')}"),
|
||||||
is_attending: (view_context._"articles.conference_registration.questions.bike.#{r.is_attending == 'n' ? 'no' : 'yes'}"),
|
is_attending: (view_context._"articles.conference_registration.questions.bike.#{r.is_attending == 'n' ? 'no' : 'yes'}"),
|
||||||
|
is_subscribed: user.is_subscribed == false ? (view_context._'articles.conference_registration.questions.bike.no') : '',
|
||||||
date: r.created_at ? r.created_at.strftime("%F %T") : '',
|
date: r.created_at ? r.created_at.strftime("%F %T") : '',
|
||||||
city: r.city || '',
|
city: r.city || '',
|
||||||
preferred_language: user.locale.present? ? (view_context.language_name user.locale) : '',
|
preferred_language: user.locale.present? ? (view_context.language_name user.locale) : '',
|
||||||
#languages: ((r.languages || []).map { |x| view_context.language_name x }).join(', ').to_s,
|
|
||||||
arrival: r.arrival ? r.arrival.strftime("%F %T") : '',
|
arrival: r.arrival ? r.arrival.strftime("%F %T") : '',
|
||||||
departure: r.departure ? r.departure.strftime("%F %T") : '',
|
departure: r.departure ? r.departure.strftime("%F %T") : '',
|
||||||
housing: r.housing.present? ? (view_context._"articles.conference_registration.questions.housing.#{r.housing}") : '',
|
housing: r.housing.present? ? (view_context._"articles.conference_registration.questions.housing.#{r.housing}") : '',
|
||||||
@ -600,6 +609,7 @@ class ConferencesController < ApplicationController
|
|||||||
departure: r.departure.present? ? r.departure.to_date : nil,
|
departure: r.departure.present? ? r.departure.to_date : nil,
|
||||||
preferred_language: user.locale,
|
preferred_language: user.locale,
|
||||||
is_attending: r.is_attending != 'n',
|
is_attending: r.is_attending != 'n',
|
||||||
|
is_subscribed: user.is_subscribed,
|
||||||
can_provide_housing: r.can_provide_housing,
|
can_provide_housing: r.can_provide_housing,
|
||||||
first_day: availability[0].present? ? availability[0].to_date : nil,
|
first_day: availability[0].present? ? availability[0].to_date : nil,
|
||||||
last_day: availability[1].present? ? availability[1].to_date : nil
|
last_day: availability[1].present? ? availability[1].to_date : nil
|
||||||
@ -621,6 +631,11 @@ class ConferencesController < ApplicationController
|
|||||||
space = (housing_data['space'] || {})[s.to_s]
|
space = (housing_data['space'] || {})[s.to_s]
|
||||||
data[s] = space.present? ? space.to_i : nil
|
data[s] = space.present? ? space.to_i : nil
|
||||||
end
|
end
|
||||||
|
ConferenceRegistration.all_considerations.each do |c|
|
||||||
|
consideration = (housing_data['considerations'] || []).include?(c.to_s)
|
||||||
|
data[c] = (consideration ? (view_context._'articles.conference_registration.questions.bike.yes') : '')
|
||||||
|
data[:raw_values][c] = consideration
|
||||||
|
end
|
||||||
@excel_data[:data] << data
|
@excel_data[:data] << data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -647,6 +662,7 @@ class ConferencesController < ApplicationController
|
|||||||
(view_context.language_name l), l
|
(view_context.language_name l), l
|
||||||
] },
|
] },
|
||||||
is_attending: [yes_no.first],
|
is_attending: [yes_no.first],
|
||||||
|
is_subscribed: [yes_no.last],
|
||||||
can_provide_housing: yes_no,
|
can_provide_housing: yes_no,
|
||||||
first_day: view_context.conference_days_options_list(:before),
|
first_day: view_context.conference_days_options_list(:before),
|
||||||
last_day: view_context.conference_days_options_list(:after)
|
last_day: view_context.conference_days_options_list(:after)
|
||||||
@ -656,6 +672,11 @@ class ConferencesController < ApplicationController
|
|||||||
[(view_context._"articles.conference_registration.questions.bike.yes"), true]
|
[(view_context._"articles.conference_registration.questions.bike.yes"), true]
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
ConferenceRegistration.all_considerations.each do | c |
|
||||||
|
@column_options[c.to_sym] = [
|
||||||
|
[(view_context._"articles.conference_registration.questions.bike.yes"), true]
|
||||||
|
]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -821,6 +842,9 @@ class ConferencesController < ApplicationController
|
|||||||
when :preferred_language
|
when :preferred_language
|
||||||
registration.user.locale = value
|
registration.user.locale = value
|
||||||
user_changed = true
|
user_changed = true
|
||||||
|
when :is_subscribed
|
||||||
|
registration.user.is_subscribed = (value != "false")
|
||||||
|
user_changed = true
|
||||||
when :is_attending
|
when :is_attending
|
||||||
registration.is_attending = value.present? ? 'y' : 'n'
|
registration.is_attending = value.present? ? 'y' : 'n'
|
||||||
when :address, :phone, :first_day, :last_day, :notes
|
when :address, :phone, :first_day, :last_day, :notes
|
||||||
@ -838,6 +862,14 @@ class ConferencesController < ApplicationController
|
|||||||
end
|
end
|
||||||
user_changed = true
|
user_changed = true
|
||||||
end
|
end
|
||||||
|
elsif ConferenceRegistration.all_considerations.include? key.to_sym
|
||||||
|
registration.housing_data ||= {}
|
||||||
|
registration.housing_data['considerations'] ||= {}
|
||||||
|
if value.present?
|
||||||
|
registration.housing_data['considerations'] |= [key]
|
||||||
|
else
|
||||||
|
registration.housing_data['considerations'] -= [key]
|
||||||
|
end
|
||||||
elsif ConferenceRegistration.all_spaces.include? key.to_sym
|
elsif ConferenceRegistration.all_spaces.include? key.to_sym
|
||||||
registration.housing_data ||= {}
|
registration.housing_data ||= {}
|
||||||
registration.housing_data['space'] ||= {}
|
registration.housing_data['space'] ||= {}
|
||||||
|
@ -1542,20 +1542,67 @@ module ApplicationHelper
|
|||||||
attributes = { class: options[:class], id: options[:id] }
|
attributes = { class: options[:class], id: options[:id] }
|
||||||
attributes[:data] = { 'update-url' => options[:editable] } if options[:editable].present?
|
attributes[:data] = { 'update-url' => options[:editable] } if options[:editable].present?
|
||||||
|
|
||||||
content_tag(:table, attributes) do
|
if options[:column_names].is_a? Hash
|
||||||
(content_tag(:tbody) do
|
return content_tag(:table, attributes) do
|
||||||
rows = ''
|
max_columns = 0
|
||||||
excel_data[:columns].each do |column|
|
column_names = {}
|
||||||
if (excel_data[:column_types] || {})[column] != :table && ((options[:column_names] || []).include? column)
|
(content_tag(:thead) do
|
||||||
rows += content_tag(:tr, { class: 'always-edit', data: { key: '' } }) do
|
headers = ''
|
||||||
attributes = { class: [excel_data[:column_types][column]], data: { 'column-id' => column } }
|
options[:column_names].each do | header_name, columns |
|
||||||
columns = content_tag(:th, excel_data[:keys][column].present? ? _(excel_data[:keys][column]) : '') +
|
column_names[header_name] ||= []
|
||||||
edit_column(nil, column, nil, attributes, excel_data, options)
|
headers += content_tag(:th, excel_data[:keys][header_name].present? ? _(excel_data[:keys][header_name]) : '', colspan: 2)
|
||||||
|
row_count = columns.size
|
||||||
|
columns.each do | column |
|
||||||
|
column_names[header_name] << column
|
||||||
|
if (options[:row_spans] || {})[column].present?
|
||||||
|
row_count += (options[:row_spans][column] - 1)
|
||||||
|
for i in 1...options[:row_spans][column]
|
||||||
|
column_names[header_name] << false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
max_columns = row_count if row_count > max_columns
|
||||||
|
end
|
||||||
|
content_tag(:tr, headers.html_safe)
|
||||||
|
end) + (content_tag(:tbody) do
|
||||||
|
rows = ''
|
||||||
|
|
||||||
|
for i in 0...max_columns
|
||||||
|
columns_html = ''
|
||||||
|
column_names.each do | header_name, columns |
|
||||||
|
column = columns[i]
|
||||||
|
if column.present?
|
||||||
|
attributes = { class: [excel_data[:column_types][column]], data: { 'column-id' => column } }
|
||||||
|
if (options[:row_spans] || {})[column].present?
|
||||||
|
attributes[:rowspan] = options[:row_spans][column]
|
||||||
|
end
|
||||||
|
columns_html += content_tag(:th, excel_data[:keys][column].present? ? _(excel_data[:keys][column]) : '', rowspan: attributes[:rowspan]) +
|
||||||
|
edit_column(nil, column, nil, attributes, excel_data, options)
|
||||||
|
elsif column != false
|
||||||
|
columns_html += content_tag(:td, ' ', colspan: 2, class: :empty)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rows += content_tag(:tr, columns_html.html_safe, { class: 'always-edit', data: { key: '' } })
|
||||||
|
end
|
||||||
|
rows.html_safe
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return content_tag(:table, attributes) do
|
||||||
|
(content_tag(:tbody) do
|
||||||
|
rows = ''
|
||||||
|
excel_data[:columns].each do |column|
|
||||||
|
if (excel_data[:column_types] || {})[column] != :table && ((options[:column_names] || []).include? column)
|
||||||
|
rows += content_tag(:tr, { class: 'always-edit', data: { key: '' } }) do
|
||||||
|
attributes = { class: [excel_data[:column_types][column]], data: { 'column-id' => column } }
|
||||||
|
columns = content_tag(:th, excel_data[:keys][column].present? ? _(excel_data[:keys][column]) : '') +
|
||||||
|
edit_column(nil, column, nil, attributes, excel_data, options)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
rows.html_safe
|
||||||
rows.html_safe
|
end)
|
||||||
end)
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1777,12 +1824,49 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def registrations_edit_table_options
|
def registrations_edit_table_options
|
||||||
options = registrations_table_options
|
{
|
||||||
options[:id] = 'create-table'
|
id: 'create-table',
|
||||||
options[:class] << 'always-editing'
|
class: ['registrations', 'admin-edit', 'always-editing'],
|
||||||
options[:column_names] += [:name, :email]
|
primary_key: :id,
|
||||||
options[:required_columns] = [:name, :email]
|
column_names: {
|
||||||
return options
|
contact_info: [
|
||||||
|
:name,
|
||||||
|
:email,
|
||||||
|
:is_subscribed,
|
||||||
|
:city,
|
||||||
|
:preferred_language
|
||||||
|
] + User.AVAILABLE_LANGUAGES.map { |l| "language_#{l}".to_sym },
|
||||||
|
questions: [
|
||||||
|
:registration_fees_paid,
|
||||||
|
:is_attending,
|
||||||
|
:arrival,
|
||||||
|
:departure,
|
||||||
|
:housing,
|
||||||
|
:bike,
|
||||||
|
:food,
|
||||||
|
:companion_email,
|
||||||
|
:allergies,
|
||||||
|
:other
|
||||||
|
],
|
||||||
|
hosting: [
|
||||||
|
:can_provide_housing,
|
||||||
|
:address,
|
||||||
|
:phone,
|
||||||
|
:first_day,
|
||||||
|
:last_day
|
||||||
|
] + ConferenceRegistration.all_spaces +
|
||||||
|
ConferenceRegistration.all_considerations + [
|
||||||
|
:notes
|
||||||
|
]
|
||||||
|
},
|
||||||
|
row_spans: {
|
||||||
|
allergies: 3,
|
||||||
|
other: 2
|
||||||
|
},
|
||||||
|
required_columns: [:name, :email],
|
||||||
|
editable: administration_update_path(@this_conference.slug, :stats),
|
||||||
|
column_options: @column_options
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrations_table_options
|
def registrations_table_options
|
||||||
@ -1793,6 +1877,7 @@ module ApplicationHelper
|
|||||||
column_names: [
|
column_names: [
|
||||||
:registration_fees_paid,
|
:registration_fees_paid,
|
||||||
:is_attending,
|
:is_attending,
|
||||||
|
:is_subscribed,
|
||||||
:city,
|
:city,
|
||||||
:preferred_language,
|
:preferred_language,
|
||||||
:arrival,
|
:arrival,
|
||||||
@ -1811,7 +1896,8 @@ module ApplicationHelper
|
|||||||
:notes
|
:notes
|
||||||
] +
|
] +
|
||||||
User.AVAILABLE_LANGUAGES.map { |l| "language_#{l}".to_sym } +
|
User.AVAILABLE_LANGUAGES.map { |l| "language_#{l}".to_sym } +
|
||||||
ConferenceRegistration.all_spaces,
|
ConferenceRegistration.all_spaces +
|
||||||
|
ConferenceRegistration.all_considerations,
|
||||||
editable: administration_update_path(@this_conference.slug, :stats),
|
editable: administration_update_path(@this_conference.slug, :stats),
|
||||||
column_options: @column_options
|
column_options: @column_options
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,6 @@
|
|||||||
.modal-edit-overlay{data: { 'closes-modal': 'new-registration' }}
|
.modal-edit-overlay{data: { 'closes-modal': 'new-registration' }}
|
||||||
.modal-edit-content
|
.modal-edit-content
|
||||||
=html_edit_table @excel_data, registrations_edit_table_options
|
=html_edit_table @excel_data, registrations_edit_table_options
|
||||||
.actions
|
.actions.right
|
||||||
%a.button.subdued{data: { 'closes-modal': 'new-registration' }}='Cancel'
|
%a.button.subdued{data: { 'closes-modal': 'new-registration' }}='Cancel'
|
||||||
= button_tag :save, value: :save, class: :modify
|
= button_tag :save, value: :save, class: :modify
|
||||||
|
@ -1244,6 +1244,7 @@ en:
|
|||||||
body: Body
|
body: Body
|
||||||
day: Day
|
day: Day
|
||||||
event_location: Location
|
event_location: Location
|
||||||
|
other_notes: Other
|
||||||
time: Time
|
time: Time
|
||||||
time_span: Length
|
time_span: Length
|
||||||
reasons:
|
reasons:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user