MrCommon

Common utilities extracted from starter-reg-site for use elsewhere

Features

  • Dashboard at the mount point that relies on the host app for authentication
  • MrCommon::Registration - default registration model and controller with csv export exposed via the dashboard
  • MrCommon::Reminder - model for generating downloadable ical reminders
  • MrCommon::Country - convenient wrapper around the Carmen gem
  • MrCommon::Pattern - a utility class for sharing common regex patterns
  • MrCommon::Concerns::CSVExportable - include to add .as_csv to any ActiveRecord model

Installation

Add to Gemfile

# Gemfile
gem 'mr_common', '~> 1'

Add to routes.rb

# config/routes.rb
mount MrCommon::Engine, at: '/common'
# If you plan to use the default registration model, 
# set the host app's root route to the default registration 
# form, and override the the templates. (See MrCommon::Reminder for more instructions )
# root to: "mr_common/registrations/public#new"

Configure initializer

# config/initializers/mr_common.rb
MrCommon.base_controller_name = "::ApplicationController"
MrCommon.user_class_name = "::User"
MrCommon.authentication_method_name = :authenticate_user!
MrCommon.current_user_method_name = :current_user
MrCommon.current_user_authorization_method_name = :mr_common_admin?
MrCommon.logout_path_helper = :destroy_user_session_path
MrCommon.logout_path_method = :delete
MrCommon. = :new_user_session_path
MrCommon.registration_success_notice = "Registration completed successfully."
MrCommon.registration_failure_alert = "Registration could not be completed."
MrCommon.host_app_layout = "application"
MrCommon.registration_confirmation_subject = "Your registration confirmation."
MrCommon.registration_reminder_slug = "reminder"

Development

  1. gem install foreman mailcatcher
  2. Clone
  3. Bundle Install
  4. Don't yarn. Engines have to use old school sprockets manifests
  5. run bin/rails run to start the app + mailcatcher.

License

The gem is available as open source under the terms of the MIT License.