ThinkFeelDoDashboard
This is a rails engine that allows for the CRUDing and Enrolling of participants, the CRUDing of users and their roles, groups, assigning coaches to participants and assigning participants to groups, and assiging moderators to groups (and thus indirectly arms).
Mockups
Membership & Enrollment Mockups
Download
git clone https://github.com/NU-CBITS/think_feel_do_dashboard.git [name of folder]
Assumptions
This engine expects there to be multiple models:
- Participant: a Devise-like API available and an authenticatable Participant class stored in a participants table;
- Arms: an Arm class stored in the arms table and has a title:string and belongs to a project. Arms are also determined to be social or not via is_social:boolean
- Group: a Group class stored in the groups table and has a title:string and is dependent on belonging to an arm.
- Membership: a Membership class that stores a group_id:integer and participant_id:integer in the memberships table. Each membership as a start_date:date and end_date:date that determines if the participant [membership] is active
- User: a Devise-like API available and an authenticatable User class stored in a users table but referred to as coaches;
- CoachAssignment: a CoachAssignment class that stores the participant:integer and user_id:integer in the coach_assignments table;
- Reports and class that depend on reports. The Reports module references ContentModules and ThinkDoFeelEngine. Accessing the index page of reprots
/think_feel_do_dashboard/reports
will not break, but downloading CSVs will break unless the host application has ContentModules and the ThinkDoFeelEngine.
Installation
Update your Gemfile
:
gem 'think_feel_do_dashboard', git: 'git://github.com/NU-CBITS/think_feel_do_dashboard.git'
Update gems:
bundle install
Add the routes by configuring your routes.rb
file:
Rails.application.routes.draw do
...
mount ThinkFeelDoDashboard::Engine => "think_feel_do_dashboard"
...
end
Note: You will have access to additional routes.
- home:
/think_feel_do_dashboard
- arms:
/think_feel_do_dashboard/arms
- groups:
/think_feel_do_dashboard/groups
- participants:
/think_feel_do_dashboard/participants
- memberships:
/think_feel_do_dashboard/participants/1/groups
- coach_assignments:
/think_feel_do_dashboard/participants/1/coaches
- reports:
/think_feel_do_dashboard/reports
Add the appropriate password concern to the app/models/user.rb
file:
class User < ActiveRecord::Base
include ThinkFeelDoDashboard::Concerns::Password
...
end
You may have to create a user.rb file containing a User model and extend it
from another engine's User model app/models/user.rb
. For instance,
require File.expand_path("../../app/models/user",
AnotherEngine::Engine.called_from)
# Extend User model.
class User
include ThinkFeelDoDashboard::Concerns::Password
end
Add the appropriate password and validation concerns to the app/models/participant.rb
file:
class Participant < ActiveRecord::Base
include ThinkFeelDoDashboard::Concerns::Participant
include ThinkFeelDoDashboard::Concerns::Password
...
end
You may have to create a participant.rb file containing a Participant model and extend it
from another engine's Participant model app/models/participant.rb
. For instance,
require File.expand_path("../../app/models/participant",
AnotherEngine::Engine.called_from)
# Extend Participant model.
class Participant
include ThinkFeelDoDashboard::Concerns::Participant
include ThinkFeelDoDashboard::Concerns::Password
end
Add the appropriate group concern to the app/models/group.rb
file:
class Group < ActiveRecord::Base
include ThinkFeelDoDashboard::Concerns::Group
...
end
You may have to create a group.rb file containing a Group model and extend it
from another engine's Group model app/models/group.rb
. For instance,
require File.expand_path("../../app/models/group",
AnotherEngine::Engine.called_from)
# Extend Group model.
class Group
include ThinkFeelDoDashboard::Concerns::Group
end
Add the appropriate membership concern to the app/models/membership.rb
file:
class Membership < ActiveRecord::Base
include ThinkFeelDoDashboard::Concerns::Membership
...
end
You may have to create a membership.rb file containing a Membership model and extend it
from another engine's Membership model app/models/membership.rb
. For instance,
require File.expand_path("../../app/models/membership",
AnotherEngine::Engine.called_from)
# Extend Membership model.
class Membership
include ThinkFeelDoDashboard::Concerns::Membership
end
Install the engine's migrations into the host application and migrate:
bundle exec rake think_feel_do_dashboard:install:migrations
bundle exec rake db:migrate
You will have to include any .css or .js files in the host app's to be precompiled app/config/initializers/assets.rb
. For example,
...
Rails.application.config.assets.precompile += %w(think_feel_do_dashboard.css think_feel_do_dashboard.js)
...
Be sure to restart your server after you mkae the modifications.
Or you can run the migration locally for your spec/dummy:
bin/rake db:migrate
Dependencies
ruby: 2.1.2
rails: ~> 4.1.7
Configuration
Application Name: ThinkFeelDoDashboard
Github Repo: https://github.com/NU-CBITS/think_feel_do_dashboard
Production Url: N/A
Staging Url: N/A
Confluence: N/A
Database initialization/creation
Make sure you are in the top level folder; i.e., think_feel_do_dashboard. Then run:
bundle exec rake app:db:drop app:db:create app:db:migrate
Seeding Database with engine specific fixtures
app:seed:with_think_feel_do_dashboard_fixtures
Running Specs
After you migrate the database, you may have to update the engine's testing environment:
bundle exec rake app:db:drop app:db:create app:db:migrate RAILS_ENV=test
Compelete setup (drops and creates the database, runs migrations, and seeds the database with fixtures):
bundle exec rake setup
Because we have combined brakeman, rubocop, and rspec, you can just run the rake command to run everything:
bundle exec rake
Publishing to RubyGems
Build the think_feel_do_dashboard
gem
gem build think_feel_do_dashboard.gemspec
Publish to rubygems.org
gem push think_feel_do_dashboard-x.x.x.gem
View the published think_feel_do_dashboard
gem here
Services
N/A
Deployment Instructions to Host
See the "Installation" instructions above.