dm_event 4.2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +23 -0
- data/README.md +33 -0
- data/Rakefile +36 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/at/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/be/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/ch/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/de/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/es/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/fr/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/it/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/nl/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/pl/icon-64x44.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/100x38.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/200x75.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/250x94.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/28x7.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/320x120.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/42x11.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/75x28.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-32x22.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-32x24.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-48x32.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-48x34.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-64x42.png +0 -0
- data/app/assets/images/dm_event/payment_logos/sofort/uk/icon-64x44.png +0 -0
- data/app/assets/javascripts/dm_event/admin.js +94 -0
- data/app/assets/stylesheets/dm_event/admin.css +152 -0
- data/app/assets/stylesheets/dm_event/application.css +65 -0
- data/app/controllers/dm_event/admin/admin_controller.rb +13 -0
- data/app/controllers/dm_event/admin/registrations_controller.rb +411 -0
- data/app/controllers/dm_event/admin/workshop_prices_controller.rb +73 -0
- data/app/controllers/dm_event/admin/workshops_controller.rb +147 -0
- data/app/controllers/dm_event/application_controller.rb +23 -0
- data/app/controllers/dm_event/payments_controller.rb +83 -0
- data/app/controllers/dm_event/registrations_controller.rb +368 -0
- data/app/datatables/registration_datatable.rb +117 -0
- data/app/helpers/dm_event/application_helper.rb +4 -0
- data/app/helpers/dm_event/registrations_helper.rb +14 -0
- data/app/helpers/dm_event/workshops_helper.rb +41 -0
- data/app/mailers/payment_reminder_mailer.rb +25 -0
- data/app/mailers/registration_notify_mailer.rb +31 -0
- data/app/models/dm_event/concerns/ability.rb +38 -0
- data/app/models/dm_event/concerns/registration_state_email.rb +80 -0
- data/app/models/dm_event/concerns/registration_state_machine.rb +218 -0
- data/app/models/dm_event/concerns/user_profile.rb +20 -0
- data/app/models/dm_event/model_decorators.rb +6 -0
- data/app/models/dm_event/permitted_params.rb +35 -0
- data/app/models/payment.rb +48 -0
- data/app/models/registration.rb +297 -0
- data/app/models/workshop.rb +247 -0
- data/app/models/workshop_price.rb +118 -0
- data/app/presenters/event_common_presenter.rb +31 -0
- data/app/presenters/registration_presenter.rb +34 -0
- data/app/presenters/workshop_presenter.rb +22 -0
- data/app/views/dm_event/admin/registrations/_form.html.erb +297 -0
- data/app/views/dm_event/admin/registrations/action_state.js.erb +1 -0
- data/app/views/dm_event/admin/registrations/edit.html.erb +1 -0
- data/app/views/dm_event/admin/registrations/index.html.erb +0 -0
- data/app/views/dm_event/admin/workshop_prices/_form.html.erb +62 -0
- data/app/views/dm_event/admin/workshop_prices/edit.html.erb +2 -0
- data/app/views/dm_event/admin/workshop_prices/index.html.erb +31 -0
- data/app/views/dm_event/admin/workshop_prices/new.html.erb +2 -0
- data/app/views/dm_event/admin/workshops/_form.html.erb +61 -0
- data/app/views/dm_event/admin/workshops/_header_menu.html.erb +21 -0
- data/app/views/dm_event/admin/workshops/_registration_stats.html.erb +58 -0
- data/app/views/dm_event/admin/workshops/additional_configuration.html.erb +47 -0
- data/app/views/dm_event/admin/workshops/edit.html.erb +2 -0
- data/app/views/dm_event/admin/workshops/edit_system_email.html.erb +75 -0
- data/app/views/dm_event/admin/workshops/financials.html.erb +179 -0
- data/app/views/dm_event/admin/workshops/index.html.erb +100 -0
- data/app/views/dm_event/admin/workshops/lost_users.html.erb +44 -0
- data/app/views/dm_event/admin/workshops/new.html.erb +2 -0
- data/app/views/dm_event/admin/workshops/show.html.erb +47 -0
- data/app/views/dm_event/admin/workshops/user_outstanding_balances.html.erb +29 -0
- data/app/views/dm_event/liquid_tags/_funding_project_status.html.erb +27 -0
- data/app/views/dm_event/payments/_registrations_paypal_standard.html.erb +23 -0
- data/app/views/dm_event/payments/_registrations_sofort.html.erb +18 -0
- data/app/views/dm_event/registrations/_section_address.html.erb +30 -0
- data/app/views/dm_event/registrations/_section_custom_fields.html.erb +7 -0
- data/app/views/dm_event/registrations/_section_prices.html.erb +33 -0
- data/app/views/dm_event/registrations/_workshop_price.html.erb +18 -0
- data/app/views/dm_event/registrations/choose_payment.html.erb +5 -0
- data/app/views/dm_event/registrations/closed.html.erb +14 -0
- data/app/views/dm_event/registrations/new.html.erb +30 -0
- data/app/views/dm_event/registrations/success.html.erb +15 -0
- data/app/views/layouts/email_templates/dm_event_email_layout.html.erb +318 -0
- data/app/views/layouts/email_templates/dm_event_email_layout.text.erb +1 -0
- data/app/views/layouts/email_templates/dm_event_payment_reminder.html.erb +22 -0
- data/app/views/layouts/email_templates/dm_event_payment_reminder.text.erb +19 -0
- data/app/views/layouts/email_templates/dm_event_registration_notify.html.erb +21 -0
- data/app/views/layouts/email_templates/dm_event_registration_notify.text.erb +13 -0
- data/config/initializers/dm_event.rb +1 -0
- data/config/initializers/liquid_init.rb +2 -0
- data/config/locales/ems.cs.yml +51 -0
- data/config/locales/ems.de.yml +51 -0
- data/config/locales/ems.en.yml +51 -0
- data/config/locales/ems.fi.yml +51 -0
- data/config/locales/ems.ja.yml +51 -0
- data/config/routes.rb +40 -0
- data/db/migrate/20130510155617_create_events.rb +98 -0
- data/db/migrate/20130516124327_add_locale_to_registration.rb +5 -0
- data/db/migrate/20130516204454_add_user_profile_to_registration.rb +11 -0
- data/db/migrate/20130518092324_add_require_address.rb +7 -0
- data/db/migrate/20130609145812_add_workshop_published.rb +5 -0
- data/db/migrate/20130624134506_add_amount_currency.rb +16 -0
- data/db/migrate/20130703131515_add_workshop_currency.rb +5 -0
- data/db/migrate/20130913083529_add_event_funding_type.rb +6 -0
- data/db/migrate/20130914105736_add_enable_payments.rb +5 -0
- data/db/migrate/20130916160033_add_sidebar_to_workshop.rb +5 -0
- data/db/migrate/20130917161700_add_show_address.rb +5 -0
- data/db/migrate/20131116180719_add_default_funding_goal.rb +8 -0
- data/db/migrate/20131127165445_add_payment_reminder.rb +5 -0
- data/db/migrate/20140122204702_add_event_image.rb +5 -0
- data/db/migrate/20140523165342_add_workshop_summary.rb +5 -0
- data/db/migrate/20140605052208_add_uuid_to_registration.rb +10 -0
- data/db/migrate/20140707152124_add_registration_comment_count.rb +5 -0
- data/db/migrate/20140708142312_add_payment_comment.rb +20 -0
- data/db/migrate/20150709125105_add_payment_reminder_history.rb +16 -0
- data/db/migrate/20160810081542_add_bcc_contact_email.rb +5 -0
- data/db/migrate/20160821150120_index_foreign_keys_in_ems_registrations.rb +9 -0
- data/db/migrate/20160821150121_index_foreign_keys_in_ems_workshop_price_translations.rb +5 -0
- data/db/migrate/20160821150122_index_foreign_keys_in_ems_workshop_prices.rb +6 -0
- data/db/migrate/20160821150123_index_foreign_keys_in_ems_workshop_translations.rb +5 -0
- data/db/migrate/20160821150124_index_foreign_keys_in_ems_workshops.rb +6 -0
- data/lib/dm_event/engine.rb +20 -0
- data/lib/dm_event/liquid/tags/funding_project_status.rb +55 -0
- data/lib/dm_event.rb +4 -0
- data/lib/tasks/dm_event_tasks.rake +4 -0
- data/spec/controllers/registrations_controller_spec.rb +152 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/ability.rb +10 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +11 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20141114170927_add_globalize_countries.dm_core.rb +50 -0
- data/spec/dummy/db/migrate/20141114170928_devise_create_users.dm_core.rb +46 -0
- data/spec/dummy/db/migrate/20141114170929_add_user_fields.dm_core.rb +14 -0
- data/spec/dummy/db/migrate/20141114170930_rolify_create_roles.dm_core.rb +20 -0
- data/spec/dummy/db/migrate/20141114170931_add_last_access.dm_core.rb +10 -0
- data/spec/dummy/db/migrate/20141114170932_create_versions.dm_core.rb +19 -0
- data/spec/dummy/db/migrate/20141114170933_add_object_changes_column_to_versions.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170934_create_dm_core_accounts.dm_core.rb +13 -0
- data/spec/dummy/db/migrate/20141114170935_add_account_to_users.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170936_create_preferences.dm_core.rb +13 -0
- data/spec/dummy/db/migrate/20141114170937_create_comments.dm_core.rb +22 -0
- data/spec/dummy/db/migrate/20141114170938_add_activity.dm_core.rb +21 -0
- data/spec/dummy/db/migrate/20141114170939_add_type_to_comments.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170940_add_category.dm_core.rb +28 -0
- data/spec/dummy/db/migrate/20141114170941_create_email_table.dm_core.rb +26 -0
- data/spec/dummy/db/migrate/20141114170942_add_user_profile.dm_core.rb +46 -0
- data/spec/dummy/db/migrate/20141114170943_add_profile_email.dm_core.rb +14 -0
- data/spec/dummy/db/migrate/20141114170944_create_payment_history.dm_core.rb +37 -0
- data/spec/dummy/db/migrate/20141114170945_change_anchor_field.dm_core.rb +10 -0
- data/spec/dummy/db/migrate/20141114170946_create_user_site_profile.dm_core.rb +27 -0
- data/spec/dummy/db/migrate/20141114170947_add_avatar.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170948_add_notify_to_payment_history.dm_core.rb +8 -0
- data/spec/dummy/db/migrate/20141114170949_acts_as_votable_migration.dm_core.rb +28 -0
- data/spec/dummy/db/migrate/20141114170950_add_user_site_profile_uuid.dm_core.rb +19 -0
- data/spec/dummy/db/migrate/20141114170951_add_invoice_id.dm_core.rb +7 -0
- data/spec/dummy/db/migrate/20141114170952_acts_as_follower_migration.dm_core.rb +18 -0
- data/spec/dummy/db/migrate/20141114170953_rename_invoice_id.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170954_add_core_addresses.dm_core.rb +18 -0
- data/spec/dummy/db/migrate/20141114170955_papertrail_increase_column.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170956_acts_as_taggable_on_migration.dm_core.rb +32 -0
- data/spec/dummy/db/migrate/20141114170957_add_missing_unique_indices.dm_core.rb +23 -0
- data/spec/dummy/db/migrate/20141114170958_add_taggings_counter_cache_to_tags.dm_core.rb +16 -0
- data/spec/dummy/db/migrate/20141114170959_create_custom_fields.dm_core.rb +40 -0
- data/spec/dummy/db/migrate/20141114170960_add_missing_taggable_index.dm_core.rb +11 -0
- data/spec/dummy/db/migrate/20141119103740_create_cms.dm_cms.rb +92 -0
- data/spec/dummy/db/migrate/20141119103741_add_account_to_cms.dm_cms.rb +11 -0
- data/spec/dummy/db/migrate/20141119103742_create_blog.dm_cms.rb +62 -0
- data/spec/dummy/db/migrate/20141119103743_add_notification_sent.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119103744_add_blog_comment.dm_cms.rb +8 -0
- data/spec/dummy/db/migrate/20141119103745_add_blog_image.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119103746_rename_snippet_slug.dm_cms.rb +14 -0
- data/spec/dummy/db/migrate/20141119103747_add_requires_subscription_blog.dm_cms.rb +8 -0
- data/spec/dummy/db/migrate/20141119103748_add_pages_ranked_model.dm_cms.rb +23 -0
- data/spec/dummy/db/migrate/20141119103749_add_blog_owner.dm_cms.rb +7 -0
- data/spec/dummy/db/migrate/20141119103750_create_media_files.dm_cms.rb +30 -0
- data/spec/dummy/db/migrate/20141119103751_add_cmspage_summary.dm_cms.rb +7 -0
- data/spec/dummy/db/migrate/20141119103752_add_blog_image_email_header.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119103753_add_header_image.dm_cms.rb +10 -0
- data/spec/dummy/db/migrate/20160128154135_add_favored_locale.dm_core.rb +17 -0
- data/spec/dummy/db/migrate/20160128154136_update_papertrail_v4.dm_core.rb +41 -0
- data/spec/dummy/db/schema.rb +677 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/account_factory.rb +7 -0
- data/spec/factories/registration_factory.rb +13 -0
- data/spec/factories/workshop_factory.rb +25 -0
- data/spec/factories/workshop_price_factory.rb +19 -0
- data/spec/models/registration_spec.rb +83 -0
- data/spec/models/workshop_spec.rb +26 -0
- data/spec/rails_helper.rb +70 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/accounts.rb +17 -0
- data/spec/support/devise.rb +44 -0
- data/spec/support/fix_locale.rb +57 -0
- metadata +520 -0
@@ -0,0 +1,368 @@
|
|
1
|
+
ActionView::Base.send(:include, ActiveMerchant::Billing::Integrations::ActionViewHelper)
|
2
|
+
|
3
|
+
class DmEvent::RegistrationsController < DmEvent::ApplicationController
|
4
|
+
include DmEvent::PermittedParams
|
5
|
+
include ActiveMerchant::Billing::Integrations
|
6
|
+
include DmCore::UrlHelper
|
7
|
+
include DmCore::LiquidHelper
|
8
|
+
|
9
|
+
protect_from_forgery :except => [:paypal_ipn, :sofort_ipn]
|
10
|
+
|
11
|
+
helper DmEvent::WorkshopsHelper
|
12
|
+
helper DmEvent::RegistrationsHelper
|
13
|
+
layout 'layouts/event_templates/register'
|
14
|
+
|
15
|
+
before_filter :workshop_lookup, except: [:success]
|
16
|
+
|
17
|
+
#------------------------------------------------------------------------------
|
18
|
+
def new
|
19
|
+
redirect_to main_app.root_url and return if @workshop.nil?
|
20
|
+
|
21
|
+
if !@workshop.registration_closed? || is_admin?
|
22
|
+
@registration = @workshop.registrations.build
|
23
|
+
@registration.user_profile = current_user ? current_user.user_profile : UserProfile.new
|
24
|
+
|
25
|
+
if @workshop.require_address && !@registration.user_profile.address_valid?
|
26
|
+
#--- address is required and there are missing fields in the profile
|
27
|
+
@registration.user_profile.address_required = true
|
28
|
+
end
|
29
|
+
@registration.user_profile.userless_registration = true if current_user.nil? && !@workshop.require_account
|
30
|
+
|
31
|
+
set_meta description: @workshop.summary, "og:description" => sanitize_text(markdown(@workshop.summary, safe: false))
|
32
|
+
set_meta "og:image" => site_asset_media_url(@workshop.image) if @workshop.image.present?
|
33
|
+
else
|
34
|
+
render action: :closed
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
#------------------------------------------------------------------------------
|
39
|
+
def create
|
40
|
+
redirect_to(action: :new) and return if @workshop.require_account && current_user.nil?
|
41
|
+
|
42
|
+
profile_params = params[:registration].delete("user_profile_attributes") if params[:registration]
|
43
|
+
profile_params.delete(:id) if profile_params
|
44
|
+
|
45
|
+
@registration = @workshop.registrations.new(registration_params)
|
46
|
+
@registration.registered_locale = I18n.locale
|
47
|
+
@registration.user_profile = current_user ? current_user.user_profile : UserProfile.new
|
48
|
+
@registration.user_profile.assign_attributes(user_profile_direct_params(profile_params)) unless profile_params.blank?
|
49
|
+
|
50
|
+
if @registration.save
|
51
|
+
if @workshop.payments_enabled? && !@workshop.require_review? && @registration.balance_owed.positive?
|
52
|
+
redirect_to register_choose_payment_url(@registration.uuid)
|
53
|
+
else
|
54
|
+
redirect_to register_success_url(@registration.uuid)
|
55
|
+
end
|
56
|
+
else
|
57
|
+
render action: :new
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Only allow to proceed with payment if the registration is still in pending
|
62
|
+
#------------------------------------------------------------------------------
|
63
|
+
def choose_payment
|
64
|
+
@registration = Registration.find_by_uuid(params[:uuid])
|
65
|
+
@workshop = @registration.workshop if @registration
|
66
|
+
flash[:alert] = I18n.t('core.resource_invalid')
|
67
|
+
redirect_to main_app.root_url and return if @registration.nil? || !@registration.accepted?
|
68
|
+
|
69
|
+
if @workshop.require_account
|
70
|
+
raise Account::LoginRequired.new(I18n.t('core.login_required')) if current_user.nil?
|
71
|
+
if @registration.user_profile.user != current_user && !is_admin?
|
72
|
+
flash[:alert] = I18n.t('core.resource_invalid')
|
73
|
+
redirect_to main_app.root_url and return
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Success page for a registration. Look up the uuid and display success.
|
79
|
+
# Can do this many times - if the user doesn't own the registration, then kick
|
80
|
+
# them out.
|
81
|
+
#------------------------------------------------------------------------------
|
82
|
+
def success
|
83
|
+
@registration = Registration.find_by_uuid(params[:uuid])
|
84
|
+
if @registration.nil? || @registration.user_profile.user != current_user
|
85
|
+
#--- not logged in or not the users registration (for )
|
86
|
+
flash[:alert] = I18n.t('core.resource_invalid')
|
87
|
+
redirect_to main_app.root_url and return
|
88
|
+
end
|
89
|
+
@workshop = @registration.workshop if @registration
|
90
|
+
@receipt_content = @registration.email_state_notification(@registration.current_state, false) || ""
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
#------------------------------------------------------------------------------
|
96
|
+
def workshop_lookup
|
97
|
+
@workshop = Workshop.find_by_slug(params[:id])
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
=begin
|
103
|
+
helper 'dm_event/event_registrations'
|
104
|
+
helper 'dm_event/custom_fields'
|
105
|
+
|
106
|
+
before_filter :login_required, :only => [:show_registrations]
|
107
|
+
before_filter :ssl_required
|
108
|
+
|
109
|
+
layout :use_layout
|
110
|
+
|
111
|
+
# TODO GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
|
112
|
+
#verify :method => :post, :only => [ :confirm, :verify_payment ],
|
113
|
+
# :redirect_to => { :action => :index }
|
114
|
+
|
115
|
+
private
|
116
|
+
#------------------------------------------------------------------------------
|
117
|
+
def use_layout
|
118
|
+
"#{account_layouts}/#{Hanuman::Application.config.event_registration_layout}"
|
119
|
+
end
|
120
|
+
|
121
|
+
public
|
122
|
+
#-----------------------------------------------------------------------
|
123
|
+
def index
|
124
|
+
#--- clear out any session data for this registration
|
125
|
+
session[:event_registration] = nil
|
126
|
+
redirect_to '/'
|
127
|
+
end
|
128
|
+
|
129
|
+
# :id => the workshop id we're registering for
|
130
|
+
#-----------------------------------------------------------------------
|
131
|
+
def register
|
132
|
+
redirect_to :action => 'index' and return if params[:id] == nil
|
133
|
+
@workshop = EventWorkshop.find_by_id(params[:id])
|
134
|
+
redirect_to :action => 'index' and return if @workshop == nil
|
135
|
+
redirect_to :action => 'index' and return unless @workshop.valid_invitation?(params[:code])
|
136
|
+
|
137
|
+
#--- allow an admin to see registration form
|
138
|
+
if !@workshop.workshop_closed or permit?("#{SystemRoles::Moderator} on :workshop or #{SystemRoles::Admin} on Event or #{SystemRoles::Admin} on Student or #{SystemRoles::System}")
|
139
|
+
if @workshop.require_account
|
140
|
+
unless logged_in?
|
141
|
+
flash[:special_message] = nls(:event_require_account, :title => @workshop.title, :link => register_account_url)
|
142
|
+
login_required
|
143
|
+
return
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
#--- if we're an admin, then you can register another student for this event, using information from a previous registration
|
148
|
+
if !params[:r_id].blank? and permit?("#{SystemRoles::Moderator} on :workshop or #{SystemRoles::Admin} on Event or #{SystemRoles::Admin} on Student or #{SystemRoles::System}")
|
149
|
+
old_registration = EventRegistration.find(params[:r_id])
|
150
|
+
@register_user = old_registration.student.user
|
151
|
+
@event_registration = EventRegistration.new_registration_from_old(@workshop.id, old_registration)
|
152
|
+
elsif !params[:s_id].blank? and permit?("#{SystemRoles::Moderator} on :workshop or #{SystemRoles::Admin} on Event or #{SystemRoles::Admin} on Student or #{SystemRoles::System}")
|
153
|
+
@register_user = Student.find(params[:s_id]).user
|
154
|
+
@event_registration = EventRegistration.new(:event_workshop_id => @workshop.id, :country_id => @workshop.country_id)
|
155
|
+
else
|
156
|
+
@register_user = current_user
|
157
|
+
@event_registration = EventRegistration.new(:event_workshop_id => @workshop.id, :country_id => @workshop.country_id)
|
158
|
+
end
|
159
|
+
|
160
|
+
@use_login_info = @workshop.require_account || (!@register_user.nil? && !params['no_login'])
|
161
|
+
|
162
|
+
unless put_or_post?
|
163
|
+
#--- build up the custom field objects
|
164
|
+
@workshop.custom_field_defs.each do |c|
|
165
|
+
@event_registration.custom_fields.build(:custom_field_def_id => c.id)
|
166
|
+
end
|
167
|
+
else
|
168
|
+
#--- TODO security problem - shouldn't do the following assignment blindly
|
169
|
+
@event_registration.attributes = params[:event_registration] unless params[:event_registration].nil?
|
170
|
+
|
171
|
+
#--- tie registration to student if they are logged in
|
172
|
+
@event_registration.student_id = @register_user.student_id if @use_login_info
|
173
|
+
|
174
|
+
@photo = ((params[:photo].nil? || params[:photo][:image].blank?) ? nil : EventRegistrationPhoto.new(params[:photo]))
|
175
|
+
if @event_registration.valid? && (@photo.nil? || @photo.valid?)
|
176
|
+
|
177
|
+
if @event_registration.save && (@photo.nil? || @photo.save)
|
178
|
+
@event_registration.photo = @photo unless @photo.nil?
|
179
|
+
@event_registration.update_attribute(:item_code, @event_registration.event_payment.shoppingcart_code) unless (@event_registration.event_payment.nil? || @event_registration.event_payment.shoppingcart_code.blank?)
|
180
|
+
|
181
|
+
unless params[:newsletters].nil?
|
182
|
+
#--- they asked to be notified of news, sign them up for the newletter
|
183
|
+
params[:newsletters].each do |idtag|
|
184
|
+
#--- we don't really care about the return code ---
|
185
|
+
rc = Newsletter.add_subscriber( idtag, !@use_login_info ? @event_registration : @event_registration.student,
|
186
|
+
:remote_ip => request.remote_ip,
|
187
|
+
:subscriber_id => !@use_login_info ? nil : @event_registration.student.id)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
session[:event_registration] = @event_registration.id
|
191
|
+
|
192
|
+
#--- if shopping cart payment required, add redirect to the link that adds
|
193
|
+
#--- the items to the cart. Receipt is emailed after we get confirmation back
|
194
|
+
#--- from shopping cart that payment was made.
|
195
|
+
if ( !@event_registration.event_payment.nil? and
|
196
|
+
@event_registration.event_payment.payment_type == 'cc' and
|
197
|
+
!@event_registration.item_code.blank?)
|
198
|
+
redirect_to generate_shoppingcart_link(@event_registration) and return
|
199
|
+
else
|
200
|
+
redirect_to :action => 'success' and return
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
#--- use the overriden template if specified, otherwise the default register.rhtml is used
|
208
|
+
@workshop.template.blank? ? render(:action => :register) : render(:action => :register, :layout => "#{account_layouts}/#{@workshop.template}")
|
209
|
+
end
|
210
|
+
|
211
|
+
#-----------------------------------------------------------------------
|
212
|
+
def success
|
213
|
+
unless session[:event_registration] == nil
|
214
|
+
@event_registration = EventRegistration.find_by_id(session[:event_registration])
|
215
|
+
|
216
|
+
#--- clear out the session information
|
217
|
+
session[:event_registration] = nil
|
218
|
+
@content = (@event_registration.compile_receipt)[:content]
|
219
|
+
else
|
220
|
+
#--- somehow sesssion got lost - back to the beginning
|
221
|
+
redirect_to :action => 'index'
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# Clears the session of any information that might be there, and returns
|
226
|
+
# user to event information page.
|
227
|
+
#-----------------------------------------------------------------------
|
228
|
+
def user_cancel
|
229
|
+
@workshop = EventWorkshop.find_by_id(params[:workshop])
|
230
|
+
@workshop.nil? ? redirect_to('/') : redirect_to(@workshop.eventinfo_url)
|
231
|
+
end
|
232
|
+
|
233
|
+
#------------------------------------------------------------------------------
|
234
|
+
def show_registrations
|
235
|
+
@student = current_user.student
|
236
|
+
|
237
|
+
render :layout => "#{account_layouts}/members_backend"
|
238
|
+
end
|
239
|
+
|
240
|
+
#------------------------------------------------------------------------------
|
241
|
+
def select_registration
|
242
|
+
end
|
243
|
+
|
244
|
+
#------------------------------------------------------------------------------
|
245
|
+
def goto_shopping_cart
|
246
|
+
event_registration = EventRegistration.find(params[:id])
|
247
|
+
redirect_to generate_shoppingcart_link(event_registration) and return
|
248
|
+
end
|
249
|
+
|
250
|
+
#------------------------------------------------------------------------------
|
251
|
+
def update_registration
|
252
|
+
redirect_to :action => 'index' and return if params[:id] == nil
|
253
|
+
@event_registration = EventRegistration.find_by_token(params[:id])
|
254
|
+
if @event_registration.nil?
|
255
|
+
flash[:error] = 'This registration is not valid.'
|
256
|
+
redirect_to :action => :show_registrations and return
|
257
|
+
end
|
258
|
+
|
259
|
+
@workshop = @event_registration.event_workshop
|
260
|
+
unless @workshop.workshop_closed
|
261
|
+
if @workshop.require_account
|
262
|
+
flash[:warning] = 'Please login to your student account before registering' and return unless login_required
|
263
|
+
end
|
264
|
+
@use_login_info = @workshop.require_account || (user_signed_in? && !params['no_login'])
|
265
|
+
|
266
|
+
if put_or_post? && @event_registration.updates_allowed?
|
267
|
+
@event_registration.errors.add(:base, 'Please fill in the form') and return if params[:event_registration].nil?
|
268
|
+
|
269
|
+
#--- TODO security problem - shouldn't do the following assignment blindly
|
270
|
+
@event_registration.attributes = params[:event_registration]
|
271
|
+
@event_registration.user_updated_at = Time.new
|
272
|
+
@event_registration.confirmed_on = Time.new if params[:confirm]
|
273
|
+
|
274
|
+
@photo = ((params[:photo].nil? || params[:photo][:image].blank?) ? nil : EventRegistrationPhoto.new(params[:photo]))
|
275
|
+
if @event_registration.valid? && (@photo.nil? || @photo.valid?) && !@event_registration.custom_field_errors?
|
276
|
+
|
277
|
+
if @event_registration.save && (@photo.nil? || @photo.save)
|
278
|
+
@event_registration.photo = @photo unless @photo.nil?
|
279
|
+
|
280
|
+
#flash[:notice] = "Registration Updated Successfully"
|
281
|
+
redirect_to :action => :update_successful, :id => @event_registration.token and return
|
282
|
+
end
|
283
|
+
end
|
284
|
+
else
|
285
|
+
#--- build up the custom field objects
|
286
|
+
@workshop.custom_field_defs.each do |c|
|
287
|
+
@event_registration.custom_fields.build(:custom_field_def_id => c.id) unless @event_registration.custom_fields.detect { |f| f.custom_field_def_id == c.id }
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
#--- use the overriden template if specified, otherwise the default register.rhtml is used
|
293
|
+
render :layout => "#{account_layouts}/#{@workshop.template}" unless @workshop.template.blank?
|
294
|
+
end
|
295
|
+
|
296
|
+
#------------------------------------------------------------------------------
|
297
|
+
def update_successful
|
298
|
+
@event_registration = EventRegistration.find_by_token(params[:id])
|
299
|
+
if @event_registration.nil?
|
300
|
+
flash[:error] = 'This registration is not valid.'
|
301
|
+
redirect_to :action => :show_registrations and return
|
302
|
+
end
|
303
|
+
@workshop = @event_registration.event_workshop
|
304
|
+
end
|
305
|
+
|
306
|
+
#------------------------------------------------------------------------------
|
307
|
+
def registration_comments
|
308
|
+
if params[:id].nil? || (@event_registration = EventRegistration.find_by_token(params[:id])).nil?
|
309
|
+
flash[:error] = 'This registration is not valid.'
|
310
|
+
redirect_to :action => :show_registrations and return
|
311
|
+
end
|
312
|
+
|
313
|
+
@workshop = @event_registration.event_workshop
|
314
|
+
if @workshop.workshop_closed
|
315
|
+
flash[:error] = 'This workshop is closed.'
|
316
|
+
redirect_to :action => :show_registrations and return
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
#------------------------------------------------------------------------------
|
321
|
+
def add_comment
|
322
|
+
if params[:id].nil? || (@event_registration = EventRegistration.find_by_token(params[:id])).nil? || @event_registration.event_workshop.workshop_closed || current_user.nil?
|
323
|
+
flash[:error] = 'This registration is not valid.'
|
324
|
+
redirect_to :action => :show_registrations and return
|
325
|
+
end
|
326
|
+
@comment = Comment.new(:comment => params[:comment], :user_id => current_user.id)
|
327
|
+
@event_registration.add_comment(@comment)
|
328
|
+
|
329
|
+
#--- give the object a chance to do something if necessary
|
330
|
+
@event_registration.comment_notify(@comment) if @event_registration.respond_to?(:comment_notify)
|
331
|
+
redirect_to :action => :registration_comments, :id => params[:id]
|
332
|
+
end
|
333
|
+
|
334
|
+
# Show the workshops information page
|
335
|
+
#------------------------------------------------------------------------------
|
336
|
+
def information_page
|
337
|
+
redirect_to :action => 'index' and return if params[:id].nil?
|
338
|
+
@event_registration = EventRegistration.find_by_token(params[:id])
|
339
|
+
redirect_to :action => 'index' and return if @event_registration.nil?
|
340
|
+
@workshop = @event_registration.event_workshop
|
341
|
+
|
342
|
+
unless permit?("#{SystemRoles::Moderator} on :workshop or #{SystemRoles::Admin} on Event or #{SystemRoles::System}", :event => @workshop.event)
|
343
|
+
if @workshop.require_account
|
344
|
+
if !user_signed_in? or (user_signed_in? && !@workshop.registered?(current_user.student)) or @workshop.information_text.blank?
|
345
|
+
redirect_to :action => :show_registrations and return
|
346
|
+
end
|
347
|
+
else
|
348
|
+
redirect_to :action => 'index' and return if @workshop.information_text.blank?
|
349
|
+
redirect_to :action => 'index' and return if @workshop.past?
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
#--- use the overriden template if specified, otherwise the default register.rhtml is used
|
354
|
+
@workshop.template.blank? ? render(:action => :information_page) : render(:action => :information_page, :layout => "#{account_layouts}/#{@workshop.template}")
|
355
|
+
end
|
356
|
+
|
357
|
+
# Show the workshops information page
|
358
|
+
#------------------------------------------------------------------------------
|
359
|
+
def event_information_page
|
360
|
+
redirect_to :action => 'index' and return if params[:id].nil?
|
361
|
+
@workshop = EventWorkshop.find_by_id(params[:id])
|
362
|
+
redirect_to :action => 'index' and return if @workshop.nil? or @workshop.past?
|
363
|
+
|
364
|
+
#--- use the overriden template if specified, otherwise the default register.rhtml is used
|
365
|
+
@workshop.template.blank? ? render(:action => :event_information_page) : render(:action => :event_information_page, :layout => "#{account_layouts}/#{@workshop.template}")
|
366
|
+
end
|
367
|
+
|
368
|
+
=end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
class RegistrationDatatable
|
2
|
+
include ActionView::Helpers::TagHelper
|
3
|
+
include DmEvent::RegistrationsHelper
|
4
|
+
include DmUtilities::DateHelper
|
5
|
+
include DmCore::ApplicationHelper
|
6
|
+
|
7
|
+
delegate :params, :link_to, :image_tag, :number_to_currency, :time_ago_in_words, to: :@view
|
8
|
+
delegate :url_helpers, to: 'DmEvent::Engine.routes'
|
9
|
+
|
10
|
+
#------------------------------------------------------------------------------
|
11
|
+
def initialize(view)
|
12
|
+
@view = view
|
13
|
+
end
|
14
|
+
|
15
|
+
#------------------------------------------------------------------------------
|
16
|
+
def as_json(options = {})
|
17
|
+
{
|
18
|
+
sEcho: params[:sEcho].to_i,
|
19
|
+
iTotalDisplayRecords: registrations.total_entries,
|
20
|
+
iTotalRecords: @workshop.registrations.count,
|
21
|
+
aaData: data
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
#------------------------------------------------------------------------------
|
28
|
+
def data
|
29
|
+
registrations.map do |registration|
|
30
|
+
[
|
31
|
+
registration_actions(registration),
|
32
|
+
"<span style='white-space:nowrap;'>#{registration.receipt_code}</span>",
|
33
|
+
name_and_avatar(registration),
|
34
|
+
present(registration).balance_or_paid,
|
35
|
+
"<span style='white-space:nowrap;'>#{format_date(registration.created_at)}</span>",
|
36
|
+
(registration.user_profile.user ? present(registration.user_profile.user).last_access : colored_label('no user', :gray))
|
37
|
+
]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
#------------------------------------------------------------------------------
|
42
|
+
def registrations
|
43
|
+
@registrations ||= fetch_registrations
|
44
|
+
end
|
45
|
+
|
46
|
+
#------------------------------------------------------------------------------
|
47
|
+
def name_and_avatar(registration)
|
48
|
+
# image_tag(registration.user_profile.public_avatar_url(:sq35), width: 25, height: 25) + link_to(registration.full_name, url_helpers.edit_admin_registration_path(I18n.locale, registration))
|
49
|
+
link_to(registration.full_name, url_helpers.edit_admin_registration_path(I18n.locale, registration))
|
50
|
+
end
|
51
|
+
|
52
|
+
#------------------------------------------------------------------------------
|
53
|
+
def fetch_registrations
|
54
|
+
@workshop = Workshop.find_by_slug(params[:id])
|
55
|
+
registrations = @workshop.registrations.includes(:workshop_price, :user_profile => [:user => :current_site_profile]).references(:user_profiles).order("#{sort_column} #{sort_direction}")
|
56
|
+
if params[:duplicates].present?
|
57
|
+
#--- grab only registrations that have duplicates (based on the user_profile_id)
|
58
|
+
grouped = registrations.group(:user_profile_id)
|
59
|
+
dups = grouped.count.reject {|x, y| y == 1}.collect {|x, y| x}
|
60
|
+
registrations = registrations.where(user_profile_id: dups)
|
61
|
+
end
|
62
|
+
registrations = registrations.page(page).per_page(per_page)
|
63
|
+
if params[:sSearch].present?
|
64
|
+
registrations = registrations.where("LOWER(user_profiles.first_name) like :search OR LOWER(user_profiles.last_name) like :search OR LOWER(user_profiles.email) like :search OR receipt_code like :search", search: "%#{params[:sSearch]}%".downcase)
|
65
|
+
end
|
66
|
+
registrations
|
67
|
+
end
|
68
|
+
|
69
|
+
#------------------------------------------------------------------------------
|
70
|
+
def registration_actions(registration)
|
71
|
+
actions = ''
|
72
|
+
actions += '<div class="btn-group">'
|
73
|
+
actions += "<button class='btn btn-xs dropdown-toggle btn-#{registration.current_state} hovertip' data-placement='right' data-toggle='dropdown' title='#{registration.current_state.capitalize} on #{format_date(registration.process_changed_on)}'><i class='caret'></i></button>"
|
74
|
+
actions += '<ul class="dropdown-menu">'
|
75
|
+
actions += action_list(registration)
|
76
|
+
actions += '</ul>'
|
77
|
+
actions += '</div>'
|
78
|
+
end
|
79
|
+
|
80
|
+
#------------------------------------------------------------------------------
|
81
|
+
def action_list(registration)
|
82
|
+
actions = registration.aasm.permissible_events
|
83
|
+
actions.sort! {|x,y| x.to_s <=> y.to_s}
|
84
|
+
|
85
|
+
output = ''
|
86
|
+
actions.each do |action|
|
87
|
+
output << '<li>' +
|
88
|
+
link_to('<i class="icon-chevron-right"></i>'.html_safe + action.to_s.titlecase,
|
89
|
+
url_helpers.action_state_admin_registration_path(I18n.locale, registration, :state_event => action),
|
90
|
+
{:remote => true, :method => :put}) +
|
91
|
+
'</li>'
|
92
|
+
end
|
93
|
+
return output.html_safe
|
94
|
+
end
|
95
|
+
|
96
|
+
#------------------------------------------------------------------------------
|
97
|
+
def page
|
98
|
+
params[:iDisplayStart].to_i/per_page + 1
|
99
|
+
end
|
100
|
+
|
101
|
+
#------------------------------------------------------------------------------
|
102
|
+
def per_page
|
103
|
+
params[:iDisplayLength].to_i > 0 ? params[:iDisplayLength].to_i : 50
|
104
|
+
end
|
105
|
+
|
106
|
+
#------------------------------------------------------------------------------
|
107
|
+
def sort_column
|
108
|
+
columns = ["aasm_state #{sort_direction}, process_changed_on", 'receipt_code', "LOWER(user_profiles.first_name) #{sort_direction}, LOWER(user_profiles.last_name)", '', 'ems_registrations.created_at', 'user_site_profiles.last_access_at']
|
109
|
+
columns[params[:iSortCol_0].to_i]
|
110
|
+
end
|
111
|
+
|
112
|
+
#------------------------------------------------------------------------------
|
113
|
+
def sort_direction
|
114
|
+
params[:sSortDir_0] == "desc" ? "desc" : "asc"
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module DmEvent::RegistrationsHelper
|
2
|
+
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
def price_details(workshop_price)
|
5
|
+
render :partial => 'dm_event/registrations/workshop_price', :object => workshop_price
|
6
|
+
end
|
7
|
+
|
8
|
+
#------------------------------------------------------------------------------
|
9
|
+
def status_label(text, state = :plain, with_icon = true)
|
10
|
+
icons = { acceptedx: 'icon-thumbs-up' }.freeze
|
11
|
+
icon = icons[state.to_sym]
|
12
|
+
colored_label(icon_label(icon, text, :color => '#fff'), state)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module DmEvent::WorkshopsHelper
|
2
|
+
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
def render_workshop_description(workshop)
|
5
|
+
if workshop.description.nil?
|
6
|
+
description = ""
|
7
|
+
else
|
8
|
+
# --- process as markdown
|
9
|
+
x = render :inline => workshop.description
|
10
|
+
description = liquidize_markdown(x, {})
|
11
|
+
end
|
12
|
+
return description
|
13
|
+
end
|
14
|
+
|
15
|
+
#------------------------------------------------------------------------------
|
16
|
+
def render_workshop_sidebar(workshop)
|
17
|
+
return '' if workshop.sidebar.nil?
|
18
|
+
|
19
|
+
liquidize_markdown(render(:inline => workshop.sidebar), {})
|
20
|
+
end
|
21
|
+
|
22
|
+
# Convert the financial "collected" data into json for pie charts
|
23
|
+
#------------------------------------------------------------------------------
|
24
|
+
def financial_collected_json(collected)
|
25
|
+
json = []
|
26
|
+
collected.sort.each do |item|
|
27
|
+
json << { label: "#{item[0]}: #{item[1].format(:no_cents_if_whole => true, :symbol => true)}", data: item[1].to_f }
|
28
|
+
end
|
29
|
+
json.to_json
|
30
|
+
end
|
31
|
+
|
32
|
+
# Convert the financial "collected" data into json for pie charts
|
33
|
+
#------------------------------------------------------------------------------
|
34
|
+
def financial_collected_monthly_json(collected)
|
35
|
+
json = []
|
36
|
+
collected.sort.each do |item|
|
37
|
+
json << [ "#{item[0].localize("%b")}", collected[item[0]].to_f ]
|
38
|
+
end
|
39
|
+
json.to_json
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class PaymentReminderMailer < DmCore::SiteMailer
|
2
|
+
|
3
|
+
helper DmCore::LiquidHelper
|
4
|
+
helper DmCore::UrlHelper
|
5
|
+
helper DmCore::AccountHelper
|
6
|
+
|
7
|
+
layout 'email_templates/dm_event_email_layout'
|
8
|
+
|
9
|
+
#------------------------------------------------------------------------------
|
10
|
+
def payment_reminder(registration)
|
11
|
+
account = registration.account
|
12
|
+
@subject = I18n.t('ems.ticket_payment_reminder_subject', value: registration.workshop.title)
|
13
|
+
@recipients = registration.email
|
14
|
+
@registration = registration
|
15
|
+
@payment_owed = registration.payment_owed.format
|
16
|
+
@payment_link = registration.payment_url
|
17
|
+
|
18
|
+
headers = { "Reply-To" => account.preferred_smtp_from_email, "Return-Path" => account.preferred_smtp_from_email }
|
19
|
+
mail(to: @recipients, subject: @subject, theme: account.account_prefix,
|
20
|
+
bcc: account.preferred_archive_email,
|
21
|
+
template_path: 'layouts/email_templates',
|
22
|
+
template_name: 'dm_event_payment_reminder')
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class RegistrationNotifyMailer < DmCore::SiteMailer
|
2
|
+
|
3
|
+
helper DmCore::LiquidHelper
|
4
|
+
helper DmCore::UrlHelper
|
5
|
+
helper DmCore::AccountHelper
|
6
|
+
|
7
|
+
layout 'email_templates/dm_event_email_layout'
|
8
|
+
|
9
|
+
#------------------------------------------------------------------------------
|
10
|
+
def registration_notify(registration, content, substitutions)
|
11
|
+
contact_email = registration.workshop.contact_email
|
12
|
+
account = registration.account
|
13
|
+
@subject = substitutions['subject']
|
14
|
+
@recipients = registration.email
|
15
|
+
@bcc = []
|
16
|
+
@bcc << account.preferred_archive_email if account.preferred_archive_email
|
17
|
+
@bcc << contact_email if registration.workshop.bcc_contact_email
|
18
|
+
@registration = registration
|
19
|
+
@content = content
|
20
|
+
@state = substitutions['state']
|
21
|
+
|
22
|
+
headers = { "Reply-To" => (contact_email != "") ? contact_email : account.preferred_smtp_from_email,
|
23
|
+
"Return-Path" => account.preferred_smtp_from_email }
|
24
|
+
|
25
|
+
mail(to: @recipients, subject: @subject, bcc: @bcc, theme: account.account_prefix) do |format|
|
26
|
+
format.text { render "layouts/email_templates/dm_event_registration_notify.text.erb" }
|
27
|
+
format.html { render "layouts/email_templates/dm_event_registration_notify.html.erb" }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Wrap forum specific CanCan rules. Should be included in the main app's
|
2
|
+
# Ability class.
|
3
|
+
# NOTE: When checking abilities, don't check for Class level abilities,
|
4
|
+
# unless you don't care about the instance level. For example, don't
|
5
|
+
# use both styles
|
6
|
+
# can? :moderate, Forum
|
7
|
+
# can? :moderate, @forum
|
8
|
+
# In this case, if you need to check the class level, then use specific
|
9
|
+
# current_user.has_role? :moderator, Forum
|
10
|
+
#------------------------------------------------------------------------------
|
11
|
+
|
12
|
+
module DmEvent
|
13
|
+
module Concerns
|
14
|
+
module Ability
|
15
|
+
def dm_event_abilities(user)
|
16
|
+
if user
|
17
|
+
if user.has_role?(:event_manager)
|
18
|
+
can :manage_events, :all
|
19
|
+
can :access_admin, :all
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#------------------------------------------------------------------------------
|
28
|
+
# The abilities get basically compiled. So if you use
|
29
|
+
#
|
30
|
+
# can :moderate, Forum, :id => Forum.with_role(:moderator, user).map(&:id)
|
31
|
+
#
|
32
|
+
# this will execute the Forum.with_role query once during Ability.new. However
|
33
|
+
#
|
34
|
+
# can :moderate, Forum do |forum|
|
35
|
+
# user.has_role? :moderator, forum
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# this will execute the has_role? block on each call to can?
|