Add email notifications for events registrations, add switch-checkboxes, create EventsRegistrations controller, separate page for events that require registration

This commit is contained in:
Stella Rouzi 2016-06-06 12:31:57 +03:00
parent 139a8565e2
commit 77af75f319
38 changed files with 1313 additions and 403 deletions

View file

@ -14,6 +14,9 @@
%a{"aria-controls" => "notifications", "data-toggle" => "tab", :href => "#notifications", :role => "tab"} Update Notifications
%li{:role => "presentation"}
%a{"aria-controls" => "cfp", "data-toggle" => "tab", :href => "#cfp", :role => "tab"} Call for Papers
%li{:role => "presentation"}
%a{"aria-controls" => "events_registration", "data-toggle" => "tab", :href => "#events_registrations", :role => "tab"} Events Registrations
/ Tab panes
.tab-content
#onboarding.tab-pane.active{:role => "tabpanel"}
@ -83,6 +86,32 @@
"data-name"=>"email_settings_cfp_dates_updated_body"} Load Template
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_cfp_help"} Show Help
= render partial: 'help', locals: {id: 'updated_cfp_help', show_event_variables: false}
#events_registrations.tab-pane{:role => "tabpanel"}
= f.input :send_on_updated_max_attendees_automatically, hint: "This will notify event users about automatic changes on max_attendees attribute. This refers to events marked with require_registration"
= f.input :updated_max_attendees_automatically_subject
= f.input :updated_max_attendees_automatically_body, input_html: { rows: 10, cols: 20 }
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe maximum number of attendees that can attend your session {eventtitle} has been modified.\n That is usually due to scheduling your session in a room with less available seats.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
"data-name"=>"email_settings_updated_max_attendees_automatically_body"} Load Template
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_max_attendees_automatically_help"} Show Help
= render partial: 'help', locals: { id: 'updated_max_attendees_automatically_help', show_event_variables: true }
= f.input :send_on_deleted_event_registration_automatically, hint: "This will notify all user that they have been unregistered from an event. This occurs when someone else, except for the user, deletes the registration (eg. event submitter, conference organizer)"
= f.input :deleted_event_registration_automatically_subject
= f.input :deleted_event_registration_automatically_body, input_html: { rows: 10, cols: 20 }
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nWe are sorry to inform you that you have been unregistered from the session {eventtitle}.\n That might have occured due to technical difficulties or room limitations. You can check online for any future changes.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
"data-name"=>"email_settings_deleted_event_registration_automatically_body"} Load Template
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"deleted_event_registration_automatically_help"} Show Help
= render partial: 'help', locals: { id: 'deleted_event_registration_automatically_help', show_event_variables: true }
= f.input :send_on_new_event_registration, hint: "This will notify every user that registers to an event that the registration was successful"
= f.input :new_event_registration_subject
= f.input :new_event_registration_body, input_html: { rows: 10, cols: 20 }
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nYou have successfully registered to attend session {eventtitle}. This session requires all attendees to register in advance. This is usually due to limited resources needed during the session, or room limitations. If for any reason you cannot make it, please unregister yourself to free up your slot for other visitors that wish to attend.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
"data-name"=>"email_settings_new_event_registration_body"} Load Template
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"new_event_registration_help"} Show Help
= render partial: 'help', locals: { id: 'new_event_registration_help', show_event_variables: true }
.row
.col-md-12
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -97,7 +97,7 @@
on_text: 'Yes',
off_text: 'No' }
- if @event.require_registration
= registered_text(@event)
Registered: #{registered_text(@event)}
-if @program.languages.present?
%tr
@ -105,7 +105,6 @@
%b Language
%td
= @event.language
- if !@event.room.nil?
%tr
%td

View file

@ -99,7 +99,7 @@
off_text: 'No' }
- if event.require_registration
%br
= link_to registered_text(event), registrations_admin_conference_program_event_path(@conference.short_title, event), class: 'btn btn-xs btn-default'
= link_to "Registered: #{registered_text(event)}", admin_conference_program_event_events_registrations_path(@conference.short_title, event), class: 'btn btn-xs btn-default'
%td.text-center{'data-order' => "#{event.is_highlight}"}
= check_box_tag @conference.short_title, event.id, event.is_highlight,

View file

@ -0,0 +1,46 @@
.unobtrusive-flash-container
.container
.row
.col-md-10
.page-header
%h1
Registrations (#{@event.registrations.length}/#{@event.max_attendees})
.text-muted
for
= @event.title
.well
%table.table.table-hover.table-borderd.table-striped.datatable#registrations
%thead
%th
%th Registered
%th Name
%th Email
%th Created At
%th Attended
%th Attended Conference
%tbody
- @event.registrations.each.with_index(1) do |registration, index|
- event_registration = EventsRegistration.find_by(event_id: @event.id, registration_id: registration.id)
%tr
%td= index
%td
= check_box_tag "toggle-#{@conference.short_title}", registration.id, registration.events.include?(@event), method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}/registrations/toggle?events_registrations[event_id]=#{@event.id}&&events_registrations[registration_id]=#{registration.id}&&registration_id=#{registration.id}&&state=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
%td= event_registration.name
%td= event_registration.email
%td= event_registration.created_at
%td
//We don't send the ID of the events_registration in the url of the switch-checkbox because
//the ID might have changed through the above switch-checkbox (which destroys or creates an events_registration).
//In that case the ID here would be invalid, before we would reload the page (to grab the new ID)
= check_box_tag "toggle_attendance-#{@conference.short_title}", @event.id, event_registration.attended, class: 'switch-checkbox', method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}/registrations/toggle_attendance?registration_id=#{registration.id}&&event_registration[attended]=",
data: { size: 'small',
off_color: 'danger',
on_text: 'Yes',
off_text: 'No' }
%td
- if event_registration.registration.attended
%i.fa.fa-check.text-success
-else
%i.fa.fa-times.text-danger

View file

@ -0,0 +1 @@
$('.unobtrusive-flash-container').html('');

View file

@ -0,0 +1 @@
$('.unobtrusive-flash-container').html('');

View file

@ -0,0 +1,8 @@
.row
.col-md-10
%h4
%span.fa-stack
%i.fa.fa-square-o.fa-stack-2x
%i.fa.fa-edit.fa-stack-1x
There are #{@conference.program.events.require_registration.length} sessions that require you to #{link_to 'register', conference_program_events_registrations_path(@conference.short_title)}. Check them out!

View file

@ -1,20 +1,5 @@
- if @conference.questions.any?
= render partial: 'conference_registrations/questions', locals: { f: f }
- if @conference.program.events.with_registration_open.any? || @registration.events.any?
= f.inputs 'Pre-registration required for the following:' do
- @registration.events_ordered.each do |event|
%label
= hidden_field_tag "registration[event_ids][]", nil
= check_box_tag "registration[event_ids][]", event.id, event.registrations.include?(@registration)
= event.title
.text-muted
= registered_text(event)
- if event.scheduled?
(Scheduled on: #{event.start_time.to_date})
%br
= f.inputs 'Your Travel Info' do
= f.input :arrival, as: :string, label: 'Your arrival time', input_html: { value: (f.object.arrival.to_formatted_s(:db_without_seconds) unless f.object.arrival.nil?), id: 'registration-arrival-datepicker',start_date: @conference.start_date,end_date: @conference.end_date,readonly: 'readonly' }

View file

@ -1,6 +1,7 @@
.container
.row
.col-md-12
.unobtrusive-flash-container
.page-header
%h1
Registration for
@ -54,33 +55,9 @@
= qa.answer.title
- else
You haven't answered
- if @registration.events.any?
.row
.col-md-12
%h4
%span.fa-stack
%i.fa.fa-square-o.fa-stack-2x
%i.fa.fa-check.fa-stack-1x
Registered to the following event(s)
%ul
- @registration.events.each do |event|
%li
= link_to event.title, conference_program_proposal_path(@conference.short_title, event.id)
= '(' + registered_text(event) + ')'
- if @registration.conference.program.events.remaining_for_registration(@registration).any?
.row
.col-md-12
%h4
%span.fa-stack
%i.fa.fa-square-o.fa-stack-2x
%i.fa.fa-question.fa-stack-1x
Events that require registration
%ul
- @registration.conference.program.events.remaining_for_registration(@registration).each do |event|
%li
= link_to event.title, conference_program_proposal_path(@conference.short_title, event.id)
= '(' + registered_text(event) + ')'
- if @conference.program.events.require_registration.any?
.events-with-registration
= render partial: 'events_with_registration'
- if @conference.tickets.any?
.row
@ -117,6 +94,7 @@
.col-md-12
-if @registration
.btn-group-vertical.pull-right
= link_to 'Edit your Registration', edit_conference_conference_registrations_path(@conference.short_title), class: 'btn btn-success', disabled: @conference.end_date < Date.today
= link_to 'Unregister', conference_conference_registrations_path(@conference.short_title),
method: :delete, class: 'btn btn-danger btn-xs', confirm: 'Are you sure you want to unregister?', disabled: @conference.end_date < Date.today

View file

@ -0,0 +1,54 @@
.container
.row
.col-md-11.col-md-offset-1
.unobtrusive-flash-container
.page-header
%h1
Sessions that require registration
= "(#{@program.events.require_registration.length})"
.text-muted
Some of the sessions require participants to pre-register. That gives us an idea about the amount of people interested in a particular session, and helps the speaker prepare for the amount of people that will show up. The speaker can limit the maximum number of attendees at any point, so if you are really interested in a session, go ahead and register for it!
- unless @registration
%br
Attention!!
You need to #{link_to 'register', new_conference_conference_registrations_path(@conference.short_title)} to attend the conference, before you can register to individual sessions.
.well
%table.table.table-hover.table-borderd.table-striped.datatable#registrations
%thead
%th
%th Registered
%th Title
%th Total Registrations
%th Scheduled
%tbody
- @events.each.with_index(1) do |event, index|
%tr
%td= index
%td.text-center
- if @registration
= check_box_tag "toggle-#{@conference.short_title}", event.id, event.registrations.include?(@registration), method: :patch, url: "/conference/#{@conference.short_title}/program/proposal/#{event.id}/registrations/toggle?events_registrations[event_id]=#{event.id}&&events_registrations[registration_id]=#{@registration.id}&&registration_id=#{@registration.id}&&state=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
- else
No
%td
.col-md-12
= link_to event.title, conference_program_proposal_path(@conference.short_title, event)
.text-muted
.col-md-10
= "by #{event.speakers.first.name}"
.col-md-2
= image_tag event.speakers.first.gravatar_url(size: 25), class: 'img-responsive img-rounded'
%td.text-center= registered_text(event)
%td
- if event.start_time
= event.start_time.strftime('%Y-%m-%d')
%br
= event.start_time.strftime('%H:%M')
- if event.room
%br
In room
= event.room.name

View file

@ -0,0 +1,43 @@
.container
.row
.col-md-10.col-md-offset-1
.unobtrusive-flash-container
.page-header
%h1
Registrations (#{@proposal.registrations.length}/#{@proposal.max_attendees})
.text-muted
for
= @proposal.title
.well
%table.table.table-hover.table-borderd.table-striped.datatable#registrations
%thead
%th
%th Registered
%th Name
%th Email
%th Created At
%th Attended
%th Attended Conference
%tbody
- @proposal.registrations.each.with_index(1) do |registration, index|
- event_registration = EventsRegistration.find_by(event_id: @proposal.id, registration_id: registration.id)
%tr
%td= index
%td
= check_box_tag "toggle-#{@conference.short_title}", registration.id, registration.events.include?(@proposal), method: :patch, url: "/conference/#{@conference.short_title}/program/proposal/#{@proposal.id}/registrations/toggle?events_registrations[event_id]=#{@proposal.id}&&events_registrations[registration_id]=#{registration.id}&&registration_id=#{registration.id}&&state=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
%td= event_registration.name
%td= event_registration.email
%td= event_registration.created_at
%td
= check_box_tag "toggle_attendance-#{@conference.short_title}", @proposal.id, event_registration.attended, class: 'switch-checkbox', method: :patch, url: "/conference/#{@conference.short_title}/program/proposal/#{@proposal.id}/registrations/toggle_attendance?&&registration_id=#{registration.id}&&event_registration[attended]=",
data: { size: 'small',
off_color: 'danger',
on_text: 'Yes',
off_text: 'No' }
%td
- if event_registration.registration.attended
%i.fa.fa-check.text-success
-else
%i.fa.fa-times.text-danger

View file

@ -0,0 +1 @@
$('.unobtrusive-flash-container').html('');

View file

@ -0,0 +1 @@
$('.unobtrusive-flash-container').html('');

View file

@ -48,8 +48,8 @@
words.
= f.inputs 'Enable pre-registration' do
= f.input :require_registration, label: 'Require participants to register to your event'
- message = @event.room ? "Value must be between 1 and #{@event.room.size}" : 'Check room capacity after scheduling.'
= f.input :require_registration, label: 'Require participants to register to your event', input_html: { disabled: @event.registrations.any? }, hint: 'If you enable this option, you must set the max number of attendees. You cannot disable this option, if there are registations.'
- message = @event.room ? "Value must be between 1 and #{@event.room.size}" : 'Check room capacity after scheduling, organizers might automatically reduce this number based on room capacity.'
= f.input :max_attendees, hint: 'The maximum number of participants. ' + message
- if current_user.has_any_role? :admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference }

View file

@ -70,7 +70,8 @@
= "in #{event.track.name}" if event.track
- if event.require_registration
%br
= link_to registered_text(event), registrations_conference_program_proposal_path(@conference.short_title, event), class: 'btn btn-xs btn-danger'
= link_to "Registered: #{registered_text(event)}",
conference_program_proposal_events_registrations_path(@conference.short_title, event), class: 'btn btn-xs btn-info'
%td.col-md-2{style: "padding:20px 8px 20px 8px;"}
= link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event} }"

View file

@ -9,7 +9,7 @@
= @event.subtitle
.btn-group.pull-right
- if can? :update, @event
= link_to 'Registrations', registrations_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-success'
= link_to 'Registrations', conference_program_proposal_events_registrations_path(@conference.short_title, @event), class: 'btn btn-mini btn-success'
- if can? :edit, @event
= link_to "Edit", edit_conference_program_proposal_path(@conference.short_title, @event), :class => "btn btn-mini btn-primary"
- if can? :schedule, @conference
@ -83,4 +83,4 @@
.col-md-12
%dt Requires Registration:
%dd
= link_to "Yes (#{registered_text(@event)})", new_conference_conference_registrations_path(@conference.short_title), class: 'btn btn-xs btn-danger', disabled: !@event.registration_possible?
= link_to "Yes (Registered: #{registered_text(@event)})", conference_conference_registrations_path(@conference.short_title), class: 'btn btn-xs btn-info', disabled: !@event.registration_possible?