think_feel_do_engine 3.10.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +54 -0
- data/Rakefile +49 -0
- data/app/assets/images/changing_actions.gif +0 -0
- data/app/assets/images/evaluating_thoughts.gif +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/think_feel_do_engine/athletic_man.png +0 -0
- data/app/assets/images/think_feel_do_engine/favicon.ico +0 -0
- data/app/assets/images/think_feel_do_engine/head_with_gears.jpg +0 -0
- data/app/assets/images/think_feel_do_engine/professional_woman.png +0 -0
- data/app/assets/images/think_feel_do_engine/woman_with_wrench.png +0 -0
- data/app/assets/javascripts/think_feel_do_engine.js +32 -0
- data/app/assets/javascripts/think_feel_do_engine/activities/activity_tracker.js +386 -0
- data/app/assets/javascripts/think_feel_do_engine/activities/dailyBreakdown.js +407 -0
- data/app/assets/javascripts/think_feel_do_engine/activities/forms.js +81 -0
- data/app/assets/javascripts/think_feel_do_engine/activities/your_activities.js +28 -0
- data/app/assets/javascripts/think_feel_do_engine/assessments.js +14 -0
- data/app/assets/javascripts/think_feel_do_engine/coach/messages/new.js +13 -0
- data/app/assets/javascripts/think_feel_do_engine/coach/patient_dashboards/index.js +16 -0
- data/app/assets/javascripts/think_feel_do_engine/dateWrapper.js +7 -0
- data/app/assets/javascripts/think_feel_do_engine/devise/passwords/edit.js.erb +24 -0
- data/app/assets/javascripts/think_feel_do_engine/event_capture/init.js +68 -0
- data/app/assets/javascripts/think_feel_do_engine/feel/emotion_mood_viz.js +31 -0
- data/app/assets/javascripts/think_feel_do_engine/feel/emotions.js +450 -0
- data/app/assets/javascripts/think_feel_do_engine/feel/timeago.js +214 -0
- data/app/assets/javascripts/think_feel_do_engine/forms/multi_page.js.erb +22 -0
- data/app/assets/javascripts/think_feel_do_engine/forms/multi_page_thought.js.erb +41 -0
- data/app/assets/javascripts/think_feel_do_engine/forms/suggested_prompt.js +22 -0
- data/app/assets/javascripts/think_feel_do_engine/markdown_editor.js +13 -0
- data/app/assets/javascripts/think_feel_do_engine/media_access_events.js +35 -0
- data/app/assets/javascripts/think_feel_do_engine/messages.js +8 -0
- data/app/assets/javascripts/think_feel_do_engine/participants.js +12 -0
- data/app/assets/javascripts/think_feel_do_engine/responsive-table.js +75 -0
- data/app/assets/javascripts/think_feel_do_engine/scrollindicator.js +92 -0
- data/app/assets/javascripts/think_feel_do_engine/shared/detect_timeout.js +42 -0
- data/app/assets/javascripts/think_feel_do_engine/slideshows.js +14 -0
- data/app/assets/javascripts/think_feel_do_engine/stepped_care.js +53 -0
- data/app/assets/javascripts/think_feel_do_engine/task_status.js +19 -0
- data/app/assets/javascripts/think_feel_do_engine/thought_patterns/index.js.erb +17 -0
- data/app/assets/javascripts/think_feel_do_engine/thoughts/edit_bulk.js +12 -0
- data/app/assets/javascripts/think_feel_do_engine/thoughts/scThoughtTrackerMenuViz.js +346 -0
- data/app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js +53 -0
- data/app/assets/javascripts/think_feel_do_engine/users.js +10 -0
- data/app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js +60 -0
- data/app/assets/stylesheets/think_feel_do_engine.css +12 -0
- data/app/assets/stylesheets/think_feel_do_engine/activities.css.scss +15 -0
- data/app/assets/stylesheets/think_feel_do_engine/base.css.scss +691 -0
- data/app/assets/stylesheets/think_feel_do_engine/dataTables-overrides.css.scss +27 -0
- data/app/assets/stylesheets/think_feel_do_engine/mobile.css.scss +3 -0
- data/app/assets/stylesheets/think_feel_do_engine/print.css.scss +1 -0
- data/app/controllers/think_feel_do_engine/application_controller.rb +77 -0
- data/app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb +115 -0
- data/app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb +117 -0
- data/app/controllers/think_feel_do_engine/bit_maker/slides_controller.rb +168 -0
- data/app/controllers/think_feel_do_engine/bit_maker/slideshow_anchors_controller.rb +61 -0
- data/app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb +93 -0
- data/app/controllers/think_feel_do_engine/coach/group_dashboard_controller.rb +18 -0
- data/app/controllers/think_feel_do_engine/coach/memberships_controller.rb +38 -0
- data/app/controllers/think_feel_do_engine/coach/messages_controller.rb +91 -0
- data/app/controllers/think_feel_do_engine/coach/participant_activities_visualizations_controller.rb +24 -0
- data/app/controllers/think_feel_do_engine/coach/participant_thoughts_visualizations_controller.rb +15 -0
- data/app/controllers/think_feel_do_engine/coach/patient_dashboards_controller.rb +70 -0
- data/app/controllers/think_feel_do_engine/coach/phq_assessments_controller.rb +94 -0
- data/app/controllers/think_feel_do_engine/coach/received_messages_controller.rb +45 -0
- data/app/controllers/think_feel_do_engine/coach/sent_messages_controller.rb +26 -0
- data/app/controllers/think_feel_do_engine/coach/site_messages_controller.rb +49 -0
- data/app/controllers/think_feel_do_engine/coach_dashboard_controller.rb +11 -0
- data/app/controllers/think_feel_do_engine/concerns/browser_detective.rb +26 -0
- data/app/controllers/think_feel_do_engine/concerns/navigator_enabled.rb +17 -0
- data/app/controllers/think_feel_do_engine/keep_alive_controller.rb +27 -0
- data/app/controllers/think_feel_do_engine/lesson_slides_controller.rb +98 -0
- data/app/controllers/think_feel_do_engine/lessons_controller.rb +128 -0
- data/app/controllers/think_feel_do_engine/manage/groups_controller.rb +29 -0
- data/app/controllers/think_feel_do_engine/manage/tasks_controller.rb +68 -0
- data/app/controllers/think_feel_do_engine/memberships_controller.rb +55 -0
- data/app/controllers/think_feel_do_engine/navigator_controller.rb +109 -0
- data/app/controllers/think_feel_do_engine/participant_data_controller.rb +83 -0
- data/app/controllers/think_feel_do_engine/participants/activities_controller.rb +62 -0
- data/app/controllers/think_feel_do_engine/participants/assessments_controller.rb +84 -0
- data/app/controllers/think_feel_do_engine/participants/lessons_controller.rb +28 -0
- data/app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb +42 -0
- data/app/controllers/think_feel_do_engine/participants/passwords_controller.rb +33 -0
- data/app/controllers/think_feel_do_engine/participants/public_slides_controller.rb +11 -0
- data/app/controllers/think_feel_do_engine/participants/sessions_controller.rb +16 -0
- data/app/controllers/think_feel_do_engine/participants/task_status_controller.rb +29 -0
- data/app/controllers/think_feel_do_engine/participants/thoughts_controller.rb +28 -0
- data/app/controllers/think_feel_do_engine/password_entropy_bits_controller.rb +12 -0
- data/app/controllers/think_feel_do_engine/privacy_policies_controller.rb +15 -0
- data/app/controllers/think_feel_do_engine/quick_sign_ins_controller.rb +18 -0
- data/app/controllers/think_feel_do_engine/users/passwords_controller.rb +16 -0
- data/app/controllers/think_feel_do_engine/users/registrations_controller.rb +16 -0
- data/app/controllers/think_feel_do_engine/users/sessions_controller.rb +36 -0
- data/app/helpers/think_feel_do_engine/activities_helper.rb +53 -0
- data/app/helpers/think_feel_do_engine/application_helper.rb +24 -0
- data/app/helpers/think_feel_do_engine/brand_helper.rb +36 -0
- data/app/helpers/think_feel_do_engine/coach/activity_color_code_helper.rb +52 -0
- data/app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb +93 -0
- data/app/helpers/think_feel_do_engine/coach/group_dashboard_helper.rb +156 -0
- data/app/helpers/think_feel_do_engine/coach/messages_helper.rb +35 -0
- data/app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb +23 -0
- data/app/helpers/think_feel_do_engine/coach/patient_dashboard_helper.rb +58 -0
- data/app/helpers/think_feel_do_engine/emotions_helper.rb +15 -0
- data/app/helpers/think_feel_do_engine/phq_assessment_helper.rb +14 -0
- data/app/helpers/think_feel_do_engine/presenters_helper.rb +8 -0
- data/app/helpers/think_feel_do_engine/slides_helper.rb +43 -0
- data/app/helpers/think_feel_do_engine/tasks_helper.rb +110 -0
- data/app/mailers/think_feel_do_engine/lesson_notification_mailer.rb +15 -0
- data/app/mailers/think_feel_do_engine/message_notifications.rb +21 -0
- data/app/mailers/think_feel_do_engine/site_message_mailer.rb +11 -0
- data/app/models/ability.rb +91 -0
- data/app/models/activity.rb +362 -0
- data/app/models/activity_type.rb +8 -0
- data/app/models/arm.rb +47 -0
- data/app/models/arm_validator.rb +11 -0
- data/app/models/available_content_module.rb +95 -0
- data/app/models/awake_period.rb +40 -0
- data/app/models/bit_core/slide_observer.rb +9 -0
- data/app/models/coach_assignment.rb +9 -0
- data/app/models/content_modules.rb +27 -0
- data/app/models/content_modules/lesson_module.rb +88 -0
- data/app/models/content_provider_decorator.rb +115 -0
- data/app/models/content_provider_policy.rb +6 -0
- data/app/models/content_providers/accomplished_activity_index_provider.rb +21 -0
- data/app/models/content_providers/activity_index_provider.rb +25 -0
- data/app/models/content_providers/augmented_thoughts_table_provider.rb +18 -0
- data/app/models/content_providers/awake_period_form.rb +67 -0
- data/app/models/content_providers/create_activity.rb +42 -0
- data/app/models/content_providers/edit_past_feel_provider.rb +8 -0
- data/app/models/content_providers/evaluate_thoughts_provider.rb +15 -0
- data/app/models/content_providers/fun_activity_checklist.rb +43 -0
- data/app/models/content_providers/harmful_thoughts_edit_form_provider.rb +31 -0
- data/app/models/content_providers/helpful_thoughts_index_provider.rb +31 -0
- data/app/models/content_providers/important_activity_checklist.rb +44 -0
- data/app/models/content_providers/index_past_feel_provider.rb +24 -0
- data/app/models/content_providers/input_new_activity_form.rb +28 -0
- data/app/models/content_providers/learn_lessons_index_provider.rb +55 -0
- data/app/models/content_providers/messages_index_provider.rb +64 -0
- data/app/models/content_providers/module_index_provider.rb +41 -0
- data/app/models/content_providers/new_complete_thought_form_provider.rb +26 -0
- data/app/models/content_providers/new_current_emotion_provider.rb +30 -0
- data/app/models/content_providers/new_current_feel_provider.rb +26 -0
- data/app/models/content_providers/new_harmful_thought_form_provider.rb +27 -0
- data/app/models/content_providers/new_message_form_provider.rb +61 -0
- data/app/models/content_providers/new_past_feel_provider.rb +26 -0
- data/app/models/content_providers/new_thought_form_provider.rb +26 -0
- data/app/models/content_providers/new_thoughts_form_provider.rb +26 -0
- data/app/models/content_providers/past_activity_form.rb +55 -0
- data/app/models/content_providers/past_activity_review_form.rb +36 -0
- data/app/models/content_providers/past_due_activities_viz.rb +40 -0
- data/app/models/content_providers/pleasurable_activity_index_provider.rb +20 -0
- data/app/models/content_providers/previous_planned_activities_provider.rb +35 -0
- data/app/models/content_providers/random_slide_provider.rb +14 -0
- data/app/models/content_providers/show_message_provider.rb +78 -0
- data/app/models/content_providers/thought_patterns_index_provider.rb +21 -0
- data/app/models/content_providers/thoughts_distortion_viz_provider.rb +22 -0
- data/app/models/content_providers/thoughts_table_provider.rb +17 -0
- data/app/models/content_providers/unhelpful_thoughts_list_provider.rb +67 -0
- data/app/models/content_providers/unhelpful_thoughts_reflection_provider.rb +26 -0
- data/app/models/content_providers/unplanned_activity_form.rb +35 -0
- data/app/models/content_providers/your_activities_provider.rb +94 -0
- data/app/models/delivered_message.rb +59 -0
- data/app/models/emotion.rb +30 -0
- data/app/models/emotional_rating.rb +45 -0
- data/app/models/engagement.rb +7 -0
- data/app/models/group.rb +144 -0
- data/app/models/media_access_event.rb +24 -0
- data/app/models/membership.rb +199 -0
- data/app/models/message.rb +58 -0
- data/app/models/message_sms_notification.rb +45 -0
- data/app/models/mood.rb +31 -0
- data/app/models/participant.rb +355 -0
- data/app/models/participant_login_event.rb +6 -0
- data/app/models/participant_token.rb +32 -0
- data/app/models/phq_assessment.rb +55 -0
- data/app/models/phq_stepping.rb +325 -0
- data/app/models/phq_stepping_assessment.rb +96 -0
- data/app/models/planned_activity.rb +5 -0
- data/app/models/roles/clinician.rb +4 -0
- data/app/models/roles/content_author.rb +4 -0
- data/app/models/roles/researcher.rb +4 -0
- data/app/models/site_message.rb +6 -0
- data/app/models/slideshow_anchor.rb +16 -0
- data/app/models/task.rb +102 -0
- data/app/models/task_status.rb +94 -0
- data/app/models/think_feel_do_engine/addressable.rb +28 -0
- data/app/models/think_feel_do_engine/concerns/validate_password.rb +65 -0
- data/app/models/think_feel_do_engine/password_validator.rb +55 -0
- data/app/models/think_feel_do_engine/reports/emotional_rating.rb +23 -0
- data/app/models/think_feel_do_engine/reports/event.rb +26 -0
- data/app/models/think_feel_do_engine/reports/lesson_module.rb +47 -0
- data/app/models/think_feel_do_engine/reports/lesson_slide_view.rb +94 -0
- data/app/models/think_feel_do_engine/reports/lesson_viewing.rb +64 -0
- data/app/models/think_feel_do_engine/reports/login.rb +22 -0
- data/app/models/think_feel_do_engine/reports/messaging.rb +109 -0
- data/app/models/think_feel_do_engine/reports/module_page_view.rb +57 -0
- data/app/models/think_feel_do_engine/reports/module_session.rb +130 -0
- data/app/models/think_feel_do_engine/reports/patient_activity.rb +22 -0
- data/app/models/think_feel_do_engine/reports/patient_thought.rb +22 -0
- data/app/models/think_feel_do_engine/reports/phq_assessment.rb +32 -0
- data/app/models/think_feel_do_engine/reports/reporter.rb +45 -0
- data/app/models/think_feel_do_engine/reports/site_session.rb +63 -0
- data/app/models/think_feel_do_engine/reports/task_completion.rb +30 -0
- data/app/models/think_feel_do_engine/reports/tool_access.rb +51 -0
- data/app/models/think_feel_do_engine/reports/tool_module.rb +29 -0
- data/app/models/think_feel_do_engine/reports/user_agent.rb +33 -0
- data/app/models/think_feel_do_engine/reports/video_session.rb +65 -0
- data/app/models/think_feel_do_engine/reports/wai_assessment.rb +35 -0
- data/app/models/thought.rb +80 -0
- data/app/models/thought_pattern.rb +6 -0
- data/app/models/tool_nav_item.rb +65 -0
- data/app/models/tools/home.rb +5 -0
- data/app/models/tools/learn.rb +5 -0
- data/app/models/tools/messages.rb +5 -0
- data/app/models/tools/think.rb +5 -0
- data/app/models/unplanned_activities.rb +47 -0
- data/app/models/user.rb +55 -0
- data/app/models/user_role.rb +18 -0
- data/app/models/values/accomplishment.rb +23 -0
- data/app/models/values/emotional_rating.rb +23 -0
- data/app/models/values/mood.rb +22 -0
- data/app/models/values/pleasure.rb +23 -0
- data/app/models/wai_assessment.rb +30 -0
- data/app/presenters/think_feel_do_engine/harmful_thought_viz_presenter.rb +30 -0
- data/app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb +41 -0
- data/app/presenters/think_feel_do_engine/media_access_event_presenter.rb +54 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/passwords/edit.html.erb +35 -0
- data/app/views/devise/passwords/new.html.erb +17 -0
- data/app/views/devise/sessions/new.html.erb +50 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/layouts/phq_assessment_mailer.html.erb +87 -0
- data/app/views/slides/show.html.erb +2 -0
- data/app/views/think_feel_do_engine/activities/_activity.html.erb +18 -0
- data/app/views/think_feel_do_engine/activities/_activity_coach_view.html.erb +6 -0
- data/app/views/think_feel_do_engine/activities/_activity_coach_view_future.html.erb +13 -0
- data/app/views/think_feel_do_engine/activities/_activity_coach_view_past.html.erb +21 -0
- data/app/views/think_feel_do_engine/activities/_activity_form_fields.html.erb +21 -0
- data/app/views/think_feel_do_engine/activities/_build_activity.html.erb +107 -0
- data/app/views/think_feel_do_engine/activities/_daily_summary.html.erb +121 -0
- data/app/views/think_feel_do_engine/activities/_intensity_selector.html.erb +25 -0
- data/app/views/think_feel_do_engine/activities/_mutable_activity.html.erb +14 -0
- data/app/views/think_feel_do_engine/activities/_past_due_activities_index_viz.html.erb +25 -0
- data/app/views/think_feel_do_engine/activities/_past_due_rows.erb +7 -0
- data/app/views/think_feel_do_engine/activities/_past_due_table.erb +39 -0
- data/app/views/think_feel_do_engine/activities/_previously_planned.html.erb +9 -0
- data/app/views/think_feel_do_engine/activities/accomplished_index.html.erb +84 -0
- data/app/views/think_feel_do_engine/activities/create_activity.html.erb +5 -0
- data/app/views/think_feel_do_engine/activities/fun_activity_checklist.html.erb +5 -0
- data/app/views/think_feel_do_engine/activities/important_activity_checklist.html.erb +5 -0
- data/app/views/think_feel_do_engine/activities/index.html.erb +81 -0
- data/app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb +64 -0
- data/app/views/think_feel_do_engine/activities/past_activity_form.html.erb +75 -0
- data/app/views/think_feel_do_engine/activities/past_activity_review.html.erb +104 -0
- data/app/views/think_feel_do_engine/activities/pleasurable_index.html.erb +84 -0
- data/app/views/think_feel_do_engine/activities/previously_planned_fullpage.html.erb +12 -0
- data/app/views/think_feel_do_engine/activities/unplanned_activity_form.html.erb +21 -0
- data/app/views/think_feel_do_engine/activities/visualization.html.erb +120 -0
- data/app/views/think_feel_do_engine/assigned_tasks/show.html.erb +1 -0
- data/app/views/think_feel_do_engine/awake_periods/incomplete.html.erb +13 -0
- data/app/views/think_feel_do_engine/awake_periods/new.html.erb +34 -0
- data/app/views/think_feel_do_engine/bit_maker/content_modules/_form.html.erb +24 -0
- data/app/views/think_feel_do_engine/bit_maker/content_modules/edit.html.erb +9 -0
- data/app/views/think_feel_do_engine/bit_maker/content_modules/index.html.erb +38 -0
- data/app/views/think_feel_do_engine/bit_maker/content_modules/new.html.erb +9 -0
- data/app/views/think_feel_do_engine/bit_maker/content_modules/show.html.erb +27 -0
- data/app/views/think_feel_do_engine/bit_maker/content_providers/_form.html.erb +48 -0
- data/app/views/think_feel_do_engine/bit_maker/content_providers/edit.html.erb +12 -0
- data/app/views/think_feel_do_engine/bit_maker/content_providers/index.html.erb +36 -0
- data/app/views/think_feel_do_engine/bit_maker/content_providers/new.html.erb +12 -0
- data/app/views/think_feel_do_engine/bit_maker/content_providers/show.html.erb +42 -0
- data/app/views/think_feel_do_engine/bit_maker/slides/_fields.html.erb +212 -0
- data/app/views/think_feel_do_engine/bit_maker/slides/_slide.html.erb +23 -0
- data/app/views/think_feel_do_engine/bit_maker/slides/edit.html.erb +9 -0
- data/app/views/think_feel_do_engine/bit_maker/slides/index.html.erb +6 -0
- data/app/views/think_feel_do_engine/bit_maker/slides/new.html.erb +6 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshow_anchors/create.js.erb +2 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshow_anchors/destroy.js.erb +2 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshows/_fields.html +4 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshows/_slide_panel.html.erb +12 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshows/_toc_panel.html.erb +5 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshows/edit.html.erb +7 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshows/index.html.erb +42 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshows/new.html.erb +6 -0
- data/app/views/think_feel_do_engine/bit_maker/slideshows/show.html.erb +31 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_activities_future.html.erb +69 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_activities_past.html.erb +75 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_comments.html.erb +63 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_goals.html.erb +71 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_learning_lesson_row.html.erb +5 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_lesson_completion_breakdown.html.erb +33 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_lessons.html.erb +21 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_likes.html.erb +63 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_logins.html.erb +24 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_on_my_mind_statements.html.erb +66 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_summary.html.erb +30 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_summary_social.html.erb +24 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/_thoughts.html.erb +67 -0
- data/app/views/think_feel_do_engine/coach/group_dashboard/index.html.erb +50 -0
- data/app/views/think_feel_do_engine/coach/messages/index.html.erb +50 -0
- data/app/views/think_feel_do_engine/coach/messages/new.html.erb +32 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_active_patient.html.erb +104 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_details.html.erb +54 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_header.html.erb +5 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_inactive_patient.html.erb +34 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_mood_emotion_viz.html.erb +6 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_not_stepped_table.html.erb +36 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_phq_summary.html.erb +61 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_stepped_table.html.erb +35 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_table_of_contents.html.erb +20 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_test_summary.html.erb +39 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/_vizs.html.erb +73 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/index.html.erb +20 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/show.html.erb +23 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_audio_access_table.html.erb +49 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_feelings_table.html.erb +48 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_future_activities_table.html.erb +66 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_lessons_table.html.erb +56 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_logins_table.html.erb +47 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_messages_table.html.erb +46 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_mood_table.html.erb +46 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_past_activities_table.html.erb +70 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_patient_info.html.erb +39 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_patient_login_stats.html.erb +51 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_phq9_data.html.erb +47 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_summary_totals.html.erb +49 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_tasks_table.html.erb +47 -0
- data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_thoughts_table.html.erb +49 -0
- data/app/views/think_feel_do_engine/coach/phq_assessments/_form.html.erb +42 -0
- data/app/views/think_feel_do_engine/coach/phq_assessments/edit.html.erb +3 -0
- data/app/views/think_feel_do_engine/coach/phq_assessments/index.html.erb +43 -0
- data/app/views/think_feel_do_engine/coach/phq_assessments/new.html.erb +3 -0
- data/app/views/think_feel_do_engine/coach/received_messages/_received_message.html.erb +5 -0
- data/app/views/think_feel_do_engine/coach/site_messages/_form.html.erb +38 -0
- data/app/views/think_feel_do_engine/coach/site_messages/index.html.erb +30 -0
- data/app/views/think_feel_do_engine/coach/site_messages/new.html.erb +3 -0
- data/app/views/think_feel_do_engine/coach/site_messages/show.html.erb +16 -0
- data/app/views/think_feel_do_engine/emotions/_emotion_coach_view.html.erb +8 -0
- data/app/views/think_feel_do_engine/emotions/_form.html.erb +28 -0
- data/app/views/think_feel_do_engine/emotions/index.html.erb +75 -0
- data/app/views/think_feel_do_engine/emotions/new_current.html.erb +30 -0
- data/app/views/think_feel_do_engine/learn/_completion_data.html.erb +28 -0
- data/app/views/think_feel_do_engine/learn/lessons_index.html.erb +72 -0
- data/app/views/think_feel_do_engine/lesson_notification_mailer/lesson_notification_email.html.erb +82 -0
- data/app/views/think_feel_do_engine/lesson_notification_mailer/lesson_notification_email.text.erb +10 -0
- data/app/views/think_feel_do_engine/lesson_slides/_audio.html.erb +1 -0
- data/app/views/think_feel_do_engine/lesson_slides/_video.html.erb +4 -0
- data/app/views/think_feel_do_engine/lesson_slides/edit.html.erb +7 -0
- data/app/views/think_feel_do_engine/lesson_slides/new.html.erb +6 -0
- data/app/views/think_feel_do_engine/lesson_slides/show.html.erb +21 -0
- data/app/views/think_feel_do_engine/lessons/_form.html.erb +8 -0
- data/app/views/think_feel_do_engine/lessons/_lesson.html.erb +6 -0
- data/app/views/think_feel_do_engine/lessons/all_content.html.erb +12 -0
- data/app/views/think_feel_do_engine/lessons/edit.html.erb +8 -0
- data/app/views/think_feel_do_engine/lessons/index.html.erb +36 -0
- data/app/views/think_feel_do_engine/lessons/new.html.erb +8 -0
- data/app/views/think_feel_do_engine/lessons/show.html.erb +30 -0
- data/app/views/think_feel_do_engine/login_events/_login_event.html.erb +6 -0
- data/app/views/think_feel_do_engine/manage/groups/_assigned_task_cell.html.erb +16 -0
- data/app/views/think_feel_do_engine/manage/groups/edit_tasks.html.erb +83 -0
- data/app/views/think_feel_do_engine/manage/groups/index.html.erb +19 -0
- data/app/views/think_feel_do_engine/manage/tasks/index.html.erb +24 -0
- data/app/views/think_feel_do_engine/media_access_events/_access_data.html.erb +24 -0
- data/app/views/think_feel_do_engine/memberships/update.js.erb +4 -0
- data/app/views/think_feel_do_engine/message_notifications/new_for_coach.html.erb +93 -0
- data/app/views/think_feel_do_engine/message_notifications/new_for_coach.text.erb +3 -0
- data/app/views/think_feel_do_engine/message_notifications/new_for_participant.html.erb +93 -0
- data/app/views/think_feel_do_engine/message_notifications/new_for_participant.text.erb +3 -0
- data/app/views/think_feel_do_engine/messages/_message.html.erb +7 -0
- data/app/views/think_feel_do_engine/messages/_message_info.html.erb +9 -0
- data/app/views/think_feel_do_engine/messages/index.html.erb +54 -0
- data/app/views/think_feel_do_engine/messages/new.html.erb +34 -0
- data/app/views/think_feel_do_engine/messages/not_found.html.erb +3 -0
- data/app/views/think_feel_do_engine/messages/show.html.erb +27 -0
- data/app/views/think_feel_do_engine/moods/_mood.html.erb +7 -0
- data/app/views/think_feel_do_engine/moods/new_current.html.erb +18 -0
- data/app/views/think_feel_do_engine/moods/new_past_mood.html.erb +28 -0
- data/app/views/think_feel_do_engine/navigator/_before_content.html.erb +5 -0
- data/app/views/think_feel_do_engine/navigator/show_content.html.erb +14 -0
- data/app/views/think_feel_do_engine/participant_data/create.js.erb +1 -0
- data/app/views/think_feel_do_engine/participant_data/update.js.erb +1 -0
- data/app/views/think_feel_do_engine/participants/activities/create.js.erb +5 -0
- data/app/views/think_feel_do_engine/participants/assessments/new_phq_assessment.html.erb +77 -0
- data/app/views/think_feel_do_engine/participants/assessments/new_wai_assessment.html.erb +51 -0
- data/app/views/think_feel_do_engine/participants/assessments/success.html +1 -0
- data/app/views/think_feel_do_engine/participants/content_modules/index.html.erb +36 -0
- data/app/views/think_feel_do_engine/participants/lessons/_printable.html.erb +15 -0
- data/app/views/think_feel_do_engine/participants/lessons/show.html.erb +1 -0
- data/app/views/think_feel_do_engine/participants/messages/_inbox_header.html.erb +1 -0
- data/app/views/think_feel_do_engine/participants/public_slides/show.html.erb +8 -0
- data/app/views/think_feel_do_engine/participants/received_messages/_received_message.html.erb +1 -0
- data/app/views/think_feel_do_engine/participants/thoughts/create.js.erb +24 -0
- data/app/views/think_feel_do_engine/phq_assessments/_phq_assessment.html.erb +15 -0
- data/app/views/think_feel_do_engine/privacy_policies/show.html.erb +17 -0
- data/app/views/think_feel_do_engine/shared/_alerts.html.erb +17 -0
- data/app/views/think_feel_do_engine/shared/_authentication.html.erb +5 -0
- data/app/views/think_feel_do_engine/shared/_email_head.html.erb +771 -0
- data/app/views/think_feel_do_engine/shared/_footer.html.erb +21 -0
- data/app/views/think_feel_do_engine/shared/_head.html.erb +14 -0
- data/app/views/think_feel_do_engine/shared/_home.html.erb +4 -0
- data/app/views/think_feel_do_engine/shared/_jplayer.html.erb +48 -0
- data/app/views/think_feel_do_engine/shared/_rating_selector.html.erb +16 -0
- data/app/views/think_feel_do_engine/shared/participant/_hamburger_nav_items.html.erb +19 -0
- data/app/views/think_feel_do_engine/shared/participant/_nav_items.html.erb +49 -0
- data/app/views/think_feel_do_engine/shared/participant/_navbar.html.erb +38 -0
- data/app/views/think_feel_do_engine/shared/user/_navbar.html.erb +25 -0
- data/app/views/think_feel_do_engine/site_message_mailer/general.html.erb +8 -0
- data/app/views/think_feel_do_engine/site_message_mailer/general.text.erb +3 -0
- data/app/views/think_feel_do_engine/slides/_audio.html.erb +4 -0
- data/app/views/think_feel_do_engine/slides/_slide.html.erb +18 -0
- data/app/views/think_feel_do_engine/slides/_table_of_contents.html.erb +24 -0
- data/app/views/think_feel_do_engine/slides/_video.html.erb +34 -0
- data/app/views/think_feel_do_engine/slides/homepage.html.erb +29 -0
- data/app/views/think_feel_do_engine/slides/show.html.erb +11 -0
- data/app/views/think_feel_do_engine/slides/sort.js.erb +1 -0
- data/app/views/think_feel_do_engine/slides/sort_with_reload.js.erb +1 -0
- data/app/views/think_feel_do_engine/task_statuses/_task_status.html.erb +8 -0
- data/app/views/think_feel_do_engine/thought_patterns/evaluating.html.erb +2 -0
- data/app/views/think_feel_do_engine/thought_patterns/index.html.erb +8 -0
- data/app/views/think_feel_do_engine/thoughts/_form.html.erb +11 -0
- data/app/views/think_feel_do_engine/thoughts/_harmful_thought.html.erb +4 -0
- data/app/views/think_feel_do_engine/thoughts/_mutable_thought.html.erb +23 -0
- data/app/views/think_feel_do_engine/thoughts/_thought.html.erb +10 -0
- data/app/views/think_feel_do_engine/thoughts/_thought_effects.html.erb +1 -0
- data/app/views/think_feel_do_engine/thoughts/_thought_patterns.html.erb +7 -0
- data/app/views/think_feel_do_engine/thoughts/distortion_viz.html.erb +28 -0
- data/app/views/think_feel_do_engine/thoughts/edit_bulk.html.erb +43 -0
- data/app/views/think_feel_do_engine/thoughts/index.html.erb +24 -0
- data/app/views/think_feel_do_engine/thoughts/new.html.erb +5 -0
- data/app/views/think_feel_do_engine/thoughts/new_bulk.html.erb +36 -0
- data/app/views/think_feel_do_engine/thoughts/new_complete.html.erb +28 -0
- data/app/views/think_feel_do_engine/thoughts/new_harmful.html.erb +14 -0
- data/app/views/think_feel_do_engine/thoughts/thoughts_table.html.erb +60 -0
- data/app/views/think_feel_do_engine/thoughts/unhelpful_thoughts_form.html.erb +103 -0
- data/config/brakeman.ignore +206 -0
- data/config/brakeman.yml +5 -0
- data/config/initializers/datetime_formats.rb +32 -0
- data/config/initializers/devise.rb +272 -0
- data/config/initializers/event_capture.rb +43 -0
- data/config/initializers/think_feel_do_engine.rb +4 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/locales/en.yml +4 -0
- data/config/locales/rails_admin.en.yml +5 -0
- data/config/routes.rb +107 -0
- data/db/migrate/20140221174027_devise_create_users.rb +41 -0
- data/db/migrate/20140221182135_devise_create_participants.rb +28 -0
- data/db/migrate/20140221184614_create_groups.rb +29 -0
- data/db/migrate/20140221190256_create_memberships.rb +39 -0
- data/db/migrate/20140221201915_create_user_roles.rb +23 -0
- data/db/migrate/20140221204356_create_activity_types.rb +27 -0
- data/db/migrate/20140221211420_create_activities.rb +46 -0
- data/db/migrate/20140221214020_create_awake_periods.rb +29 -0
- data/db/migrate/20140223151355_create_slideshows.rb +12 -0
- data/db/migrate/20140223151505_create_slides.rb +33 -0
- data/db/migrate/20140224024338_create_content_modules.rb +12 -0
- data/db/migrate/20140224031252_create_content_providers.rb +34 -0
- data/db/migrate/20140224194936_require_titles_on_slides.rb +8 -0
- data/db/migrate/20140226174312_add_is_title_visible_to_slides.rb +8 -0
- data/db/migrate/20140226234059_drop_time_requirement_on_activities.rb +9 -0
- data/db/migrate/20140228042747_add_type_to_slides.rb +9 -0
- data/db/migrate/20140304020641_create_participant_statuses.rb +16 -0
- data/db/migrate/20140305134049_create_thoughts.rb +40 -0
- data/db/migrate/20140305204811_drop_extracted_bit_player_tables.rb +9 -0
- data/db/migrate/20140305220121_create_bit_player_content_modules.bit_player.rb +12 -0
- data/db/migrate/20140305220122_create_bit_player_content_providers.bit_player.rb +34 -0
- data/db/migrate/20140305233152_create_bit_player_participant_statuses.bit_player.rb +16 -0
- data/db/migrate/20140305235536_create_bit_player_slideshows.bit_player.rb +10 -0
- data/db/migrate/20140306000610_create_bit_player_slides.bit_player.rb +47 -0
- data/db/migrate/20140306161346_create_messages.rb +13 -0
- data/db/migrate/20140306161532_create_delivered_messages.rb +29 -0
- data/db/migrate/20140306175954_create_coach_assignments.rb +12 -0
- data/db/migrate/20140311172344_create_mood.rb +9 -0
- data/db/migrate/20140311182036_create_emotions.rb +10 -0
- data/db/migrate/20140311194313_add_column_activation_level_and_intensity_to_emotion.rb +9 -0
- data/db/migrate/20140313025147_create_thought_patterns.rb +10 -0
- data/db/migrate/20140313192408_add_pattern_id_to_thoughts.rb +22 -0
- data/db/migrate/20140313205806_add_name_to_emotions.rb +6 -0
- data/db/migrate/20140314203044_change_column_name_activation_level_to_valence.rb +8 -0
- data/db/migrate/20140318163703_create_group_slideshow_joins.rb +12 -0
- data/db/migrate/20140320183600_add_start_date_to_memberships.rb +5 -0
- data/db/migrate/20140326144359_create_phq_assessments.rb +39 -0
- data/db/migrate/20140326205140_create_participant_tokens.rb +32 -0
- data/db/migrate/20140331165739_add_end_date_to_memberships.rb +5 -0
- data/db/migrate/20140402151311_create_tasks.rb +11 -0
- data/db/migrate/20140402170153_add_creator_id_to_tasks.rb +5 -0
- data/db/migrate/20140407134214_create_task_statuses.rb +11 -0
- data/db/migrate/20140407150122_add_release_day_to_task_remove_is_completed_at_from_task.rb +6 -0
- data/db/migrate/20140407202026_create_bit_player_tools.bit_player.rb +14 -0
- data/db/migrate/20140407202027_change_module_context_to_tool.bit_player.rb +31 -0
- data/db/migrate/20140411184738_add_recurring_to_tasks.rb +5 -0
- data/db/migrate/20140411195557_add_question_and_explanation_to_thought_pattern.rb +6 -0
- data/db/migrate/20140411195804_add_challenging_thought_and_as_if_to_thought.rb +6 -0
- data/db/migrate/20140415165729_add_start_day_to_task_statuses.rb +5 -0
- data/db/migrate/20140418190852_remove_fk_groups_users_constraint.rb +21 -0
- data/db/migrate/20140421192355_change_start_date_on_membership_from_date_time_to_date.rb +9 -0
- data/db/migrate/20140501170217_add_is_admin_to_users.rb +5 -0
- data/db/migrate/20140501190812_add_participant_login_event.rb +9 -0
- data/db/migrate/20140502222145_add_is_admin_to_all_current_users.rb +15 -0
- data/db/migrate/20140505145843_add_study_id_to_participants.rb +5 -0
- data/db/migrate/20140523154605_delete_group_slideshow_join.rb +16 -0
- data/db/migrate/20140609181801_create_engagements.rb +10 -0
- data/db/migrate/20140620171824_create_bit_core_tools.bit_core.rb +29 -0
- data/db/migrate/20140620171825_create_bit_core_content_modules.bit_core.rb +41 -0
- data/db/migrate/20140620171826_create_bit_core_content_providers.bit_core.rb +43 -0
- data/db/migrate/20140620171827_create_bit_core_slideshows.bit_core.rb +10 -0
- data/db/migrate/20140620171828_create_bit_core_slides.bit_core.rb +44 -0
- data/db/migrate/20140620181933_add_options_to_slides.bit_core.rb +6 -0
- data/db/migrate/20140621023345_convert_slides_slideshows_to_bit_core.bit_player.rb +39 -0
- data/db/migrate/20140621024853_update_tasks_with_bit_core.rb +7 -0
- data/db/migrate/20140621024854_add_config_fields_to_providers.bit_core.rb +10 -0
- data/db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb +53 -0
- data/db/migrate/20140623182430_remove_valence_from_emotions.rb +5 -0
- data/db/migrate/20140624163655_rename_column_participant_id_on_emotions_to_creator_id.rb +5 -0
- data/db/migrate/20140624165438_create_emotional_ratings.rb +10 -0
- data/db/migrate/20140624165626_remove_rating_from_emotion_remove_intensity_from_emotion.rb +6 -0
- data/db/migrate/20140625133411_add_type_to_content_modules.bit_core.rb +6 -0
- data/db/migrate/20140625140629_convert_lesson_modules.rb +12 -0
- data/db/migrate/20140625140630_add_recommendations_to_thought_patterns.rb +5 -0
- data/db/migrate/20140702192100_create_content_provider_policies.rb +10 -0
- data/db/migrate/20140703203931_add_termination_day_to_tasks.rb +5 -0
- data/db/migrate/20140710122908_create_slideshow_anchors.rb +10 -0
- data/db/migrate/20140715170155_add_inactive_log_out_to_participant_login_event.rb +5 -0
- data/db/migrate/20140721190945_normalize_emotions.rb +18 -0
- data/db/migrate/20140722163946_add_thought_patterns.rb +83 -0
- data/db/migrate/20140722172101_add_missing_fk_constraints.rb +187 -0
- data/db/migrate/20140722195542_add_emotion_ids_to_orphaned_emotional_ratings.rb +12 -0
- data/db/migrate/20140725164219_add_is_monitored_to_activity.rb +5 -0
- data/db/migrate/20140725185012_add_participant_onload_log_out_to_login_event.rb +5 -0
- data/db/migrate/20140729151610_add_signed_out_at_to_participant_login_events.rb +5 -0
- data/db/migrate/20140729171907_remove_participant_on_load_log_out_from_login_event.rb +5 -0
- data/db/migrate/20140730202349_update_thought_patterns.rb +94 -0
- data/db/migrate/20140815190945_add_phq_edit_columns.rb +13 -0
- data/db/migrate/20140818202120_add_has_didactic_content_to_tasks.rb +5 -0
- data/db/migrate/20140821184357_add_is_scheduled_to_activities.rb +5 -0
- data/db/migrate/20140902204337_create_event_capture_events.event_capture.rb +14 -0
- data/db/migrate/20140903134021_add_participant_id_to_events.rb +23 -0
- data/db/migrate/20141027181511_add_phone_number_to_participant.rb +5 -0
- data/db/migrate/20141027181539_add_contact_status_to_participant.rb +5 -0
- data/db/migrate/20141110190545_create_site_messages.rb +29 -0
- data/db/migrate/20141121152018_create_arms.rb +8 -0
- data/db/migrate/20141121201238_add_arm_id_to_groups.rb +5 -0
- data/db/migrate/20141125194600_add_null_false_to_arms.rb +6 -0
- data/db/migrate/20141125202627_add_null_false_to_columns_and_associate_arm_group_join_arm_ids_to_groups.rb +5 -0
- data/db/migrate/20141201154255_add_arm_id_to_bit_core_tools.rb +9 -0
- data/db/migrate/20141201165610_change_column_bit_core_tools_arm_id_to_null.rb +5 -0
- data/db/migrate/20141202133320_remove_position_unique_constraint_from_tool.rb +21 -0
- data/db/migrate/20141202173321_add_arm_id_to_bit_core_slideshows.rb +5 -0
- data/db/migrate/20141202173458_change_column_bit_core_slideshows_to_null_false.rb +38 -0
- data/db/migrate/20141211140747_add_is_admin_.textClipping +0 -0
- data/db/migrate/20141211140747_add_is_admin_to_participants.rb +5 -0
- data/db/migrate/20141214203919_add_has_woz_to_arm.rb +5 -0
- data/db/migrate/20141222222717_change_default_contact_preference.rb +5 -0
- data/db/migrate/20150107183443_add_is_positive_to_emotion.rb +6 -0
- data/db/migrate/20150107192208_remove_is_positive_from_emotion.rb +5 -0
- data/db/migrate/20150107192402_add_is_positive_to_emotional_rating.rb +5 -0
- data/db/migrate/20150127204928_add_is_complete_to_membership.rb +5 -0
- data/db/migrate/20150127204950_add_is_stepped_to_membership.rb +5 -0
- data/db/migrate/20150128151059_change_is_stepped_membership_to_not_allow_null.rb +5 -0
- data/db/migrate/20150128151231_change_is_complete_membership_to_not_allow_null.rb +5 -0
- data/db/migrate/20150128151515_data_migration_add_values_for_is_stepped_and_is_complete.rb +11 -0
- data/db/migrate/20150128192928_destroy_invalid_task_statuses.rb +14 -0
- data/db/migrate/20150129160122_add_description_to_tools.rb +5 -0
- data/db/migrate/20150130160818_add_type_to_tools.bit_core.rb +6 -0
- data/db/migrate/20150130161629_convert_messages_tool_type.rb +7 -0
- data/db/migrate/20150130173324_convert_home_tool_type.rb +7 -0
- data/db/migrate/20150130185412_convert_learn_tool_type.rb +7 -0
- data/db/migrate/20150131200718_add_is_viz_to_content_modules.bit_core.rb +6 -0
- data/db/migrate/20150131201021_add_is_viz_flag_to_modules.rb +9 -0
- data/db/migrate/20150202203359_update_tool_type_columns.rb +23 -0
- data/db/migrate/20150202215540_fix_module_viz_columns.rb +9 -0
- data/db/migrate/20150202232642_prevent_null_membership_dates.rb +6 -0
- data/db/migrate/20150206221439_create_wai_assessments.rb +52 -0
- data/db/migrate/20150209195004_create_think_feel_do_engine_media_access_events.rb +12 -0
- data/db/migrate/20150209212556_add_stepped_on_column_to_memberships.rb +10 -0
- data/db/migrate/20150209213422_remove_is_stepped_column_from_memberships.rb +5 -0
- data/db/migrate/20150210142824_destroy_invalid_messages.rb +5 -0
- data/db/migrate/20150210153608_add_slide_reference_to_media_access_events.rb +8 -0
- data/db/migrate/20150210161100_add_missing_constraints.rb +43 -0
- data/db/migrate/20150210163220_add_fk_constraints_to_media_access_events.rb +21 -0
- data/db/migrate/20150210164226_add_slide_fk_contstraint_to_media_access_events.rb +21 -0
- data/db/migrate/20150210165021_add_tool_constraint.bit_core.rb +26 -0
- data/db/migrate/20150218184531_add_has_table_of_contents_to_slideshows.rb +9 -0
- data/db/migrate/20150225221700_add_is_reviewed_to_activities.rb +5 -0
- data/db/migrate/20150226210641_remove_is_monitored_from_activities.rb +5 -0
- data/db/migrate/20150227221640_remove_is_complete_from_activities.rb +5 -0
- data/db/migrate/20150302155709_remove_is_scheduled_from_activities.rb +5 -0
- data/db/migrate/20150307182155_create_available_content_modules_view.rb +46 -0
- data/db/migrate/20150310171015_update_available_content_modules_view.rb +48 -0
- data/db/migrate/20150410174157_add_can_message_after_membership_complete_to_arms.rb +5 -0
- data/db/migrate/20150410175659_populate_arm_message_flag.rb +7 -0
- data/db/migrate/20150810204045_nullify_empty_thoughts_columns.rb +15 -0
- data/db/migrate/20150903210028_add_relase_day_not_null_constraint_to_trask.rb +5 -0
- data/db/migrate/20151104152804_update_think_tool_type_to_tools_think.rb +9 -0
- data/lib/tasks/lesson_notifications.rake +66 -0
- data/lib/tasks/seed.rake +30 -0
- data/lib/tasks/think_feel_do_engine_tasks.rake +4 -0
- data/lib/think_feel_do_engine.rb +16 -0
- data/lib/think_feel_do_engine/engine.rb +16 -0
- data/lib/think_feel_do_engine/version.rb +4 -0
- data/vendor/assets/images/jplayer.blue.monday.jpg +0 -0
- data/vendor/assets/images/jplayer.blue.monday.seeking.gif +0 -0
- data/vendor/assets/images/jplayer.blue.monday.video.play.png +0 -0
- data/vendor/assets/javascripts/bootstrap-markdown.js +1347 -0
- data/vendor/assets/javascripts/bootstrap-timepicker.js +1097 -0
- data/vendor/assets/javascripts/d3.min.js +5 -0
- data/vendor/assets/javascripts/froogaloop.min.js +4 -0
- data/vendor/assets/javascripts/jplayer.2.9.2.min.js +1 -0
- data/vendor/assets/javascripts/moment.min.js +6 -0
- data/vendor/assets/javascripts/snap.js +568 -0
- data/vendor/assets/stylesheets/bootstrap-timepicker.min.css +10 -0
- data/vendor/assets/stylesheets/jplayer.blue.monday.css.scss +630 -0
- data/vendor/assets/stylesheets/snap.css.scss +80 -0
- metadata +949 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
sc.attachCollapsableIcons = function(idPrex, openPanelsOnPageLoadArray) {
|
4
|
+
$('[href^=' + idPrex + ']').each(function(index, value, list) {
|
5
|
+
sc.collapsableIcon(value.hash);
|
6
|
+
});
|
7
|
+
(openPanelsOnPageLoadArray || []).forEach(function(value) {
|
8
|
+
var id = '#activity-' + value;
|
9
|
+
|
10
|
+
$(id).addClass('in');
|
11
|
+
sc.openOnDefault(id);
|
12
|
+
});
|
13
|
+
};
|
14
|
+
|
15
|
+
sc.collapsableIcon = function(anchorTag) {
|
16
|
+
var POUND_SIGN = '#';
|
17
|
+
|
18
|
+
$(anchorTag).on('show.bs.collapse', function(event) {
|
19
|
+
sc.openOnDefault(POUND_SIGN + event.currentTarget.id);
|
20
|
+
});
|
21
|
+
$(anchorTag).on('hide.bs.collapse', function(event) {
|
22
|
+
$('[href^=' + POUND_SIGN + event.currentTarget.id + ']').find('.fa-caret-down').addClass('fa-caret-right').removeClass('fa-caret-down');
|
23
|
+
});
|
24
|
+
};
|
25
|
+
|
26
|
+
sc.openOnDefault = function(id) {
|
27
|
+
$('[href^=' + id + ']').find('.fa-caret-right').addClass('fa-caret-down').removeClass('fa-caret-right');
|
28
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
attach_assessment_event = function() {
|
2
|
+
$("#new_assessment").submit(function (event) {
|
3
|
+
var missing_answer = false;
|
4
|
+
$("li.radio-question-group").each(function (index) {
|
5
|
+
var current_question = parseInt(index) + 1;
|
6
|
+
if (!$("input:radio[name='assessment[q" + current_question + "]']:checked").val()) {
|
7
|
+
missing_answer = true;
|
8
|
+
}
|
9
|
+
});
|
10
|
+
if (missing_answer && !confirm("You have not responded to all of the questions. Would you like to submit with missing responses? If yes, please hit OK, if you would like to answer the questions, please hit cancel.")) {
|
11
|
+
event.preventDefault();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
(function() {
|
2
|
+
// add the Markdown for a link to the selection
|
3
|
+
$(document).on("change", "#coach-message-link-selection", function(event) {
|
4
|
+
var intialContent, path, title;
|
5
|
+
|
6
|
+
title = $(event.target.selectedOptions).text();
|
7
|
+
path = $(event.target.selectedOptions).val();
|
8
|
+
if (path !== "") {
|
9
|
+
intialContent = $("#message_body").val();
|
10
|
+
return $("#message_body").val(intialContent + " [" + title + "](" + path + ")");
|
11
|
+
}
|
12
|
+
});
|
13
|
+
})();
|
@@ -0,0 +1,16 @@
|
|
1
|
+
(function() {
|
2
|
+
$(document).on('page:change patient:rendered', function() {
|
3
|
+
$('#patients .datepicker').each(function() {
|
4
|
+
$(this).datepicker({
|
5
|
+
dateFormat: 'M d, yy',
|
6
|
+
altField: $(this).prev(),
|
7
|
+
altFormat: 'yy-mm-dd',
|
8
|
+
showButtonPanel: true
|
9
|
+
});
|
10
|
+
|
11
|
+
$(this).on('change', function() {
|
12
|
+
$(this).closest('form').submit();
|
13
|
+
});
|
14
|
+
});
|
15
|
+
});
|
16
|
+
})();
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<% url = ThinkFeelDoEngine::Engine.routes.url_helpers %>
|
2
|
+
|
3
|
+
$(document).on('page:change', function() {
|
4
|
+
var password_path = location.pathname.replace('/edit', '');
|
5
|
+
|
6
|
+
$("#new_participant[action='" + password_path + "'] #participant_password, #edit_participant[action='" + password_path + "'] #participant_password, #new_user[action='" + password_path + "'] #user_password, #edit_user[action='" + password_path + "'] #user_password").on("keyup", function(event) {
|
7
|
+
$.getJSON("<%= url.password_entropy_bits_path %>", {
|
8
|
+
password: $(this).val(),
|
9
|
+
reset_password_token: _getPasswordToken()
|
10
|
+
}, function(data) {
|
11
|
+
if (data.bits < 10) {
|
12
|
+
$("#password-strength").html("<span class='text-danger'>Weak</span>");
|
13
|
+
} else if (data.bits < 18) {
|
14
|
+
$("#password-strength").html("<span class='text-primary'>Medium</span>");
|
15
|
+
} else {
|
16
|
+
$("#password-strength").html("<span class='text-success'>Strong <i class='fa fa-check'></i></span>");
|
17
|
+
}
|
18
|
+
});
|
19
|
+
});
|
20
|
+
|
21
|
+
function _getPasswordToken() {
|
22
|
+
return location.search.split("?reset_password_token=")[1];
|
23
|
+
}
|
24
|
+
});
|
@@ -0,0 +1,68 @@
|
|
1
|
+
;(function() {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var eventClient;
|
5
|
+
|
6
|
+
$(document).on("page:change", function() {
|
7
|
+
if ($("body").data("trackEvents")) {
|
8
|
+
logRenderEvent();
|
9
|
+
|
10
|
+
// add listeners to clickable elements
|
11
|
+
$(document).on("click", "a, button, input, textarea, option, .btn", logClickEvent);
|
12
|
+
}
|
13
|
+
});
|
14
|
+
|
15
|
+
// set the endpoint
|
16
|
+
eventClient = new EventCaptureClient("/event_capture/events");
|
17
|
+
|
18
|
+
function logRenderEvent() {
|
19
|
+
var payload;
|
20
|
+
|
21
|
+
payload = {
|
22
|
+
currentUrl: window.location.href,
|
23
|
+
headers: grabHeaders(),
|
24
|
+
ua: window.navigator.userAgent
|
25
|
+
};
|
26
|
+
eventClient.log({ kind: "render", payload: payload });
|
27
|
+
}
|
28
|
+
|
29
|
+
function logClickEvent(event) {
|
30
|
+
var targetElement, payload;
|
31
|
+
|
32
|
+
targetElement = $(event.target);
|
33
|
+
|
34
|
+
if (targetElement.data("clickTimestamp") === event.timeStamp) {
|
35
|
+
// this click has already been logged
|
36
|
+
return;
|
37
|
+
} else {
|
38
|
+
// log this click
|
39
|
+
targetElement.data("clickTimestamp", event.timeStamp);
|
40
|
+
}
|
41
|
+
|
42
|
+
payload = {
|
43
|
+
currentUrl: window.location.href,
|
44
|
+
buttonHtml: outerHtml(targetElement),
|
45
|
+
parentHtml: outerHtml(targetElement.parent()),
|
46
|
+
headers: grabHeaders()
|
47
|
+
};
|
48
|
+
eventClient.log({ kind: "click", payload: payload });
|
49
|
+
}
|
50
|
+
|
51
|
+
function grabHeaders() {
|
52
|
+
var headers = $("h1, h2").text().split(/\s\s+/);
|
53
|
+
var cleaned = [];
|
54
|
+
|
55
|
+
for (var i = 0; i < headers.length; i++) {
|
56
|
+
if (headers[i] !== "") {
|
57
|
+
cleaned.push(headers[i]);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
return cleaned;
|
62
|
+
}
|
63
|
+
|
64
|
+
function outerHtml(el) {
|
65
|
+
// because .outerHTML() may not be implemented in all target browsers
|
66
|
+
return el.clone().wrap("<p>").parent().html();
|
67
|
+
}
|
68
|
+
})();
|
@@ -0,0 +1,31 @@
|
|
1
|
+
(function() {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
window.sc = window.sc || {};
|
5
|
+
|
6
|
+
sc.filterEmotionMoodViz = function (graphParameters) {
|
7
|
+
$('label.interval').on('click', function(event) {
|
8
|
+
var input;
|
9
|
+
|
10
|
+
input = $(event.currentTarget).find('input[type="radio"]');
|
11
|
+
graphParameters.interval = input.val();
|
12
|
+
graphParameters.offset = 1;
|
13
|
+
sc.offsetInterval(graphParameters);
|
14
|
+
sc.drawGraphs();
|
15
|
+
});
|
16
|
+
|
17
|
+
$('.offset').on('click', function(event) {
|
18
|
+
event.preventDefault();
|
19
|
+
|
20
|
+
if ($(this).attr('id') === 'next' && graphParameters.offset === 1) {
|
21
|
+
return null;
|
22
|
+
} else if ($(this).attr('id') === 'previous' && graphParameters.offset === maxOffset(activationDate, graphParameters.interval)) {
|
23
|
+
return null;
|
24
|
+
} else {
|
25
|
+
graphParameters.offset += parseInt($(this).data('value'), 10);
|
26
|
+
sc.offsetInterval(graphParameters);
|
27
|
+
sc.drawGraphs();
|
28
|
+
}
|
29
|
+
});
|
30
|
+
};
|
31
|
+
})();
|
@@ -0,0 +1,450 @@
|
|
1
|
+
$(document).on("page:change", function() {
|
2
|
+
var forms;
|
3
|
+
$("form.edit-emotion-form .checkbox input").on("change", function(event) {
|
4
|
+
var form, target;
|
5
|
+
target = $(event.currentTarget);
|
6
|
+
form = $(target).closest("form.edit-emotion-form");
|
7
|
+
return form.find(".intensity-scale").toggle();
|
8
|
+
});
|
9
|
+
return $("#update-emotions").on("click", function(event) {
|
10
|
+
var $target, numberOfForms;
|
11
|
+
event.preventDefault();
|
12
|
+
forms = $("form input:checked").closest("form");
|
13
|
+
numberOfForms = forms.length;
|
14
|
+
$target = $(event.currentTarget);
|
15
|
+
$.each(forms, function(index, form) {
|
16
|
+
var data;
|
17
|
+
data = $(form).serialize();
|
18
|
+
return $.ajax({
|
19
|
+
type: $(form).attr("method"),
|
20
|
+
url: $(form).attr("action"),
|
21
|
+
data: data,
|
22
|
+
dataType: "script",
|
23
|
+
success: function(response) {
|
24
|
+
numberOfForms = numberOfForms - 1;
|
25
|
+
if (numberOfForms === 0) {
|
26
|
+
return window.location.href = $target.attr("href");
|
27
|
+
}
|
28
|
+
}
|
29
|
+
});
|
30
|
+
});
|
31
|
+
return false;
|
32
|
+
});
|
33
|
+
});
|
34
|
+
|
35
|
+
sc.dynamicallyToggleEmotionInputField = function() {
|
36
|
+
return $(".emotion-name-group.form-group select").on("change", function(event) {
|
37
|
+
var $target;
|
38
|
+
$target = $(event.currentTarget);
|
39
|
+
if ($target.find("option:selected").val() === "") {
|
40
|
+
return $target.closest(".new_emotional_rating").find(".written-option").show();
|
41
|
+
} else {
|
42
|
+
var writtenOption;
|
43
|
+
$writtenOption = $target.closest(".new_emotional_rating").find(".written-option");
|
44
|
+
$writtenOption.hide();
|
45
|
+
return $writtenOption.find("input").val("");
|
46
|
+
}
|
47
|
+
});
|
48
|
+
};
|
49
|
+
|
50
|
+
sc.rateEmotions = function(formContainers, path, partial) {
|
51
|
+
sc.dynamicallyToggleEmotionInputField();
|
52
|
+
$("#add-forms").on("click", function() {
|
53
|
+
var count;
|
54
|
+
count = $(formContainers).length;
|
55
|
+
$("#forms-container").append("<div id='subcontainer-" + count + "'>" + partial + "</div>");
|
56
|
+
sc.dynamicallyToggleEmotionInputField();
|
57
|
+
return false;
|
58
|
+
});
|
59
|
+
$("#submit-forms").on("click", function(event) {
|
60
|
+
event.preventDefault();
|
61
|
+
_.each($(formContainers), function(form, index, list) {
|
62
|
+
var $form;
|
63
|
+
$form = $(form);
|
64
|
+
return $.ajax({
|
65
|
+
async: false,
|
66
|
+
data: $form.serialize(),
|
67
|
+
dataType: "script",
|
68
|
+
type: "POST",
|
69
|
+
url: $form.attr("action"),
|
70
|
+
success: function() {
|
71
|
+
if ((index + 1) === list.length) {
|
72
|
+
window.location.href = path;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
});
|
76
|
+
});
|
77
|
+
return false;
|
78
|
+
});
|
79
|
+
};
|
80
|
+
|
81
|
+
function columnChart(startDate, endDate, lowBound, highBound, title, yLabel) {
|
82
|
+
var margin = {top: 30, right: 10, bottom: 50, left: 50},
|
83
|
+
width = 420,
|
84
|
+
height = 420,
|
85
|
+
xRoundBands = 0.2,
|
86
|
+
xValue = function(d) { return moment(new Date(d.day)).startOf('day')._d; },
|
87
|
+
yValue = function(d) { return d.is_positive === false ? -d.intensity : d.intensity },
|
88
|
+
xScale = d3.scale.ordinal(),
|
89
|
+
yScale = d3.scale.linear(),
|
90
|
+
yAxis = d3.svg.axis().scale(yScale).orient("left"),
|
91
|
+
xAxis = d3.svg.axis().scale(xScale),
|
92
|
+
date_format = d3.time.format("%m/%d/%Y"),
|
93
|
+
titleHeight = 25,
|
94
|
+
averageLineThickness = 2;
|
95
|
+
|
96
|
+
function chart(selection) {
|
97
|
+
selection.each(function(data) {
|
98
|
+
// Convert data to standard representation greedily;
|
99
|
+
// this is needed for nondeterministic accessors.
|
100
|
+
data = data.map(function(d, i) {
|
101
|
+
if(moment(new Date(d.day)).startOf('day') >= startDate._d && moment(new Date(d.day)).startOf('day') <= endDate._d) {
|
102
|
+
return [xValue.call(data, d, i), yValue.call(data, d, i), d.is_positive, d.drill_down, d.data_type];
|
103
|
+
}
|
104
|
+
});
|
105
|
+
data = data.filter(function(n){ return n !== undefined; });
|
106
|
+
// Update the x-scale.
|
107
|
+
var domain = data.map(function(d) { return moment(new Date(d[0]))._d } );
|
108
|
+
var dayRange = d3.time.days(startDate._d, endDate._d).length
|
109
|
+
var x_domain = [endDate.startOf('day')._d];
|
110
|
+
|
111
|
+
for(var i = 0; i < dayRange; i++) {
|
112
|
+
var day = x_domain[i]
|
113
|
+
x_domain.push(moment(new Date(day)).subtract(1, 'days').startOf('day')._d);
|
114
|
+
}
|
115
|
+
|
116
|
+
xScale
|
117
|
+
.domain(x_domain)
|
118
|
+
.rangeRoundBands([width - margin.left - margin.right, 0], xRoundBands);
|
119
|
+
|
120
|
+
yScale
|
121
|
+
.domain([lowBound, highBound])
|
122
|
+
.range([height - margin.top - margin.bottom, 0])
|
123
|
+
.nice();
|
124
|
+
|
125
|
+
var date_format = d3.time.format("%m/%d");
|
126
|
+
xAxis
|
127
|
+
.ticks(d3.time.days(x_domain[0], x_domain[x_domain.length -1]).length)
|
128
|
+
.tickFormat(function (d){
|
129
|
+
var currentDate = moment(new Date(d))
|
130
|
+
var startDate = moment(new Date(x_domain[0]))
|
131
|
+
var endDate = moment(new Date(x_domain[x_domain.length - 1]))
|
132
|
+
if (startDate.diff(endDate, 'days') <= 6) {
|
133
|
+
return date_format(d)
|
134
|
+
}
|
135
|
+
else if (startDate.diff(currentDate, 'days') == 0 || startDate.diff(currentDate, 'days') % 6 == 0 ){
|
136
|
+
return date_format(d)
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
return ''
|
140
|
+
}
|
141
|
+
})
|
142
|
+
.tickSize(8);
|
143
|
+
|
144
|
+
// Select the svg element, if it exists.
|
145
|
+
var svg = d3.select(this).selectAll("svg").data([data]);
|
146
|
+
|
147
|
+
// Otherwise, create the skeletal chart.
|
148
|
+
var gEnter = svg.enter().append("svg").append("g");
|
149
|
+
gEnter.append("g").attr("class", "average-lines");
|
150
|
+
gEnter.append("g").attr("class", "bars");
|
151
|
+
gEnter.append("g").attr("class", "y axis");
|
152
|
+
gEnter.append("g").attr("class", "x axis");
|
153
|
+
gEnter.append("g").attr("class", "x axis zero");
|
154
|
+
|
155
|
+
// Update the outer dimensions.
|
156
|
+
svg .attr("width", width)
|
157
|
+
.attr("height", height)
|
158
|
+
.append("text")
|
159
|
+
.attr("class", "title")
|
160
|
+
.attr("x", width/2+23)
|
161
|
+
.attr("y", titleHeight/2)
|
162
|
+
.attr("font-size", "1.2em")
|
163
|
+
.attr("text-anchor","middle")
|
164
|
+
.attr("font-weight","bold")
|
165
|
+
.text(title)
|
166
|
+
.attr("fill", "purple");
|
167
|
+
|
168
|
+
// x axis label
|
169
|
+
svg.append("text")
|
170
|
+
.attr("class", "x axis-label")
|
171
|
+
.attr("text-anchor", "end")
|
172
|
+
.attr("x", width/2 +43)
|
173
|
+
.attr("y", height -5)
|
174
|
+
.attr("font-size", "1.8em")
|
175
|
+
.text("Date");
|
176
|
+
|
177
|
+
// y axis label
|
178
|
+
if(yLabel === "mood") {
|
179
|
+
svg.append("text")
|
180
|
+
.attr("class", "y axis-label")
|
181
|
+
.attr("text-anchor", "end")
|
182
|
+
.attr("x", -220)
|
183
|
+
.attr("y", 0)
|
184
|
+
.attr("dy", "1.4em")
|
185
|
+
.attr("transform", "rotate(-90)")
|
186
|
+
.attr("font-size", "1.2em")
|
187
|
+
.text("Bad");
|
188
|
+
svg.append("text")
|
189
|
+
.attr("class", "y axis-label")
|
190
|
+
.attr("text-anchor", "end")
|
191
|
+
.attr("x", -115)
|
192
|
+
.attr("y", 0)
|
193
|
+
.attr("dy", "1.4em")
|
194
|
+
.attr("transform", "rotate(-90)")
|
195
|
+
.attr("font-size", "1.2em")
|
196
|
+
.text("Neither");
|
197
|
+
svg.append("text")
|
198
|
+
.attr("class", "y axis-label")
|
199
|
+
.attr("text-anchor", "end")
|
200
|
+
.attr("x", -30)
|
201
|
+
.attr("y", 0)
|
202
|
+
.attr("dy", "1.4em")
|
203
|
+
.attr("transform", "rotate(-90)")
|
204
|
+
.attr("font-size", "1.2em")
|
205
|
+
.text("Good");
|
206
|
+
}
|
207
|
+
else {
|
208
|
+
svg.append("text")
|
209
|
+
.attr("class", "y axis-label")
|
210
|
+
.attr("text-anchor", "end")
|
211
|
+
.attr("x", -90)
|
212
|
+
.attr("y", 0)
|
213
|
+
.attr("dy", "1em")
|
214
|
+
.attr("transform", "rotate(-90)")
|
215
|
+
.attr("font-size", "1.8em")
|
216
|
+
.text(yLabel);
|
217
|
+
|
218
|
+
}
|
219
|
+
|
220
|
+
|
221
|
+
// draw average line
|
222
|
+
var positiveValues = [], negativeValues = [];
|
223
|
+
for (var i = 0; i < data.length; i++) {
|
224
|
+
if (data[i][2] === false) {
|
225
|
+
negativeValues.push(data[i][1]);
|
226
|
+
} else {
|
227
|
+
positiveValues.push(data[i][1]);
|
228
|
+
}
|
229
|
+
}
|
230
|
+
if (positiveValues.length > 1) {
|
231
|
+
svg.select(".average-lines").append("rect")
|
232
|
+
.attr("class", "positive-average-line")
|
233
|
+
.attr("width", width)
|
234
|
+
.attr("height", averageLineThickness)
|
235
|
+
.attr("x", xScale(0))
|
236
|
+
.attr("y", yScale(d3.mean(positiveValues)) - averageLineThickness / 2)
|
237
|
+
.attr("fill", "green");
|
238
|
+
}
|
239
|
+
if (negativeValues.length > 1) {
|
240
|
+
svg.select(".average-lines").append("rect")
|
241
|
+
.attr("class", "negative-average-line")
|
242
|
+
.attr("width", width)
|
243
|
+
.attr("height", averageLineThickness)
|
244
|
+
.attr("x", xScale(0))
|
245
|
+
.attr("y", yScale(d3.mean(negativeValues)) - averageLineThickness / 2)
|
246
|
+
.attr("fill", "green");
|
247
|
+
}
|
248
|
+
|
249
|
+
// Update the inner dimensions.
|
250
|
+
var g = svg.select("g")
|
251
|
+
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
252
|
+
|
253
|
+
// Update the bars.
|
254
|
+
var bar = svg.select(".bars").selectAll(".bar").data(data);
|
255
|
+
bar.enter().append("rect");
|
256
|
+
bar.exit().remove();
|
257
|
+
bar .attr("class", function(d, i) { return d[1] < 0 ? "bar negative" : "bar positive"; })
|
258
|
+
.attr("x", function (d) { return X(d); })
|
259
|
+
.attr("y", function (d, i) { return d[1] < 0 ? Y0() : Y(d); })
|
260
|
+
.attr("width", xScale.rangeBand())
|
261
|
+
.attr("height", function(d, i) { return Math.abs( Y(d) - Y0() ); })
|
262
|
+
.on("click", function (d,i){
|
263
|
+
if(d[3] !== false) {
|
264
|
+
dailyDrillModal(d);
|
265
|
+
}
|
266
|
+
})
|
267
|
+
|
268
|
+
// x axis at the bottom of the chart
|
269
|
+
g.select(".x.axis")
|
270
|
+
.attr("transform", "translate(0," + (height - margin.top - margin.bottom) + ")")
|
271
|
+
.call(xAxis.orient("bottom"))
|
272
|
+
|
273
|
+
// Update the y-axis.
|
274
|
+
g.select(".y.axis")
|
275
|
+
.call(yAxis);
|
276
|
+
|
277
|
+
d3.selectAll("g.x.axis g.tick line")
|
278
|
+
.attr("y2", function(d){
|
279
|
+
var currentDate = moment(new Date(d))
|
280
|
+
var startDate = moment(new Date(x_domain[0]))
|
281
|
+
var endDate = moment(new Date(x_domain[x_domain.length - 1]))
|
282
|
+
if (startDate.diff(currentDate, 'days') == 0 || startDate.diff(currentDate, 'days') % 6 == 0 ){
|
283
|
+
return 8
|
284
|
+
}
|
285
|
+
else {
|
286
|
+
return 4
|
287
|
+
}
|
288
|
+
});
|
289
|
+
// zero line
|
290
|
+
g.select(".x.axis.zero")
|
291
|
+
.attr("transform", "translate(0," + Y0() + ")")
|
292
|
+
.call(xAxis.tickFormat("").tickSize(0));
|
293
|
+
|
294
|
+
|
295
|
+
});
|
296
|
+
}
|
297
|
+
|
298
|
+
|
299
|
+
// The x-accessor for the path generator; xScale ∘ xValue.
|
300
|
+
function X(d) {
|
301
|
+
return xScale(d[0]);
|
302
|
+
}
|
303
|
+
|
304
|
+
function X0() {
|
305
|
+
return xScale(0);
|
306
|
+
}
|
307
|
+
|
308
|
+
function Y0() {
|
309
|
+
return yScale(0);
|
310
|
+
}
|
311
|
+
|
312
|
+
// The x-accessor for the path generator; yScale ∘ yValue.
|
313
|
+
function Y(d) {
|
314
|
+
return yScale(d[1]);
|
315
|
+
}
|
316
|
+
|
317
|
+
chart.appendText = function(container, helpText, count) {
|
318
|
+
return container
|
319
|
+
.append("text")
|
320
|
+
.attr("y", count * 20 + 15)
|
321
|
+
.text(helpText);
|
322
|
+
};
|
323
|
+
|
324
|
+
chart.drawLegend = function(legendContainer, legendItems, helpTextArray) {
|
325
|
+
var count, svgContainer;
|
326
|
+
|
327
|
+
count = 0;
|
328
|
+
svgContainer = d3.select(legendContainer).append("svg");
|
329
|
+
|
330
|
+
_.each(legendItems, function(item, index) {
|
331
|
+
chart.legendKeyColor(svgContainer, item, count);
|
332
|
+
chart.legendKeyText(svgContainer, item, count);
|
333
|
+
return count++;
|
334
|
+
});
|
335
|
+
|
336
|
+
chart.addSpacing(svgContainer, count++)
|
337
|
+
|
338
|
+
_.each(helpTextArray, function(text, index, list) {
|
339
|
+
chart.appendText(svgContainer, text, count);
|
340
|
+
return count++;
|
341
|
+
});
|
342
|
+
return chart;
|
343
|
+
};
|
344
|
+
|
345
|
+
chart.legendKeyColor = function(container, item, index) {
|
346
|
+
return container
|
347
|
+
.append("rect")
|
348
|
+
.attr("y", index * 20)
|
349
|
+
.attr("width", 15)
|
350
|
+
.attr("height", 15)
|
351
|
+
.attr("fill", item[1]);
|
352
|
+
};
|
353
|
+
|
354
|
+
chart.legendKeyText = function(container, item, index) {
|
355
|
+
return container
|
356
|
+
.append("text")
|
357
|
+
.attr("x", 20)
|
358
|
+
.attr("y", index * 20 + 15)
|
359
|
+
.attr("fill", item[1])
|
360
|
+
.text(item[0]);
|
361
|
+
};
|
362
|
+
|
363
|
+
chart.addSpacing = function(container, count) {
|
364
|
+
container
|
365
|
+
.append("rect")
|
366
|
+
.attr("y", count * 20)
|
367
|
+
};
|
368
|
+
|
369
|
+
chart.margin = function(_) {
|
370
|
+
if (!arguments.length) return margin;
|
371
|
+
margin = _;
|
372
|
+
return chart;
|
373
|
+
};
|
374
|
+
|
375
|
+
chart.width = function(_) {
|
376
|
+
if (!arguments.length) return width;
|
377
|
+
width = _;
|
378
|
+
return chart;
|
379
|
+
};
|
380
|
+
|
381
|
+
chart.height = function(_) {
|
382
|
+
if (!arguments.length) return height;
|
383
|
+
height = _;
|
384
|
+
return chart;
|
385
|
+
};
|
386
|
+
|
387
|
+
chart.x = function(_) {
|
388
|
+
if (!arguments.length) return xValue;
|
389
|
+
xValue = _;
|
390
|
+
return chart;
|
391
|
+
};
|
392
|
+
|
393
|
+
chart.y = function(_) {
|
394
|
+
if (!arguments.length) return yValue;
|
395
|
+
yValue = _;
|
396
|
+
return chart;
|
397
|
+
};
|
398
|
+
|
399
|
+
return chart;
|
400
|
+
}
|
401
|
+
|
402
|
+
function dailyDrillModal (data) {
|
403
|
+
var guid = Math.floor((1 + Math.random()) * 0x10000)
|
404
|
+
.toString(16)
|
405
|
+
.substring(1);
|
406
|
+
var charge = data[4] === "Emotion" ? (data[2] ? "Positive" : "Negative") : "";
|
407
|
+
html = "";
|
408
|
+
html += "<div class='modal fade' id='smallModal-"+guid+"' tabindex='-1' role='dialog' aria-labelledby='smallModal' aria-hidden='true'><div class='modal-dialog modal-sm'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>"
|
409
|
+
html += "<h4 class='modal-title' id='myModalLabel'><strong>"+charge+" "+data[4]+"</strong><br>"+ moment(new Date(data[0])).format('L') + "</h4></div><div class='modal-body'>"
|
410
|
+
$.each(data[3], function(i, d){
|
411
|
+
var emotion = d[2] == undefined ? '' : d[2]
|
412
|
+
html += "<p>"+moment(new Date(d[1])).format('h:mm a')+": "+d[0]+" "+emotion+"</p>"
|
413
|
+
});
|
414
|
+
html += "</div><div class='modal-footer'><button type='button' class='btn btn-default' data-dismiss='modal'>Close</button></div></div></div></div>"
|
415
|
+
$('body').append(html);
|
416
|
+
$('#smallModal-'+guid).modal();
|
417
|
+
}
|
418
|
+
|
419
|
+
function activation (date) {
|
420
|
+
return moment(new Date(date));
|
421
|
+
}
|
422
|
+
|
423
|
+
function Graph (moodData, emotionsData, phqData, container) {
|
424
|
+
this.moodData = moodData;
|
425
|
+
this.emotionsData = emotionsData;
|
426
|
+
this.phqData = phqData;
|
427
|
+
this.graphWidth = container.width() *.97;
|
428
|
+
this.startDate = moment().subtract(6, 'days').startOf('day');
|
429
|
+
this.endDate = moment().startOf('day');
|
430
|
+
this.interval = 7;
|
431
|
+
this.offset = 1;
|
432
|
+
}
|
433
|
+
|
434
|
+
sc.offsetInterval = function (graphParameters) {
|
435
|
+
var startOffset = (graphParameters.interval * graphParameters.offset) - 1;
|
436
|
+
var endOffset = graphParameters.offset === 1 ? 0 : graphParameters.interval * (graphParameters.offset-1)
|
437
|
+
graphParameters.startDate = moment().subtract(startOffset, 'days').startOf('day');
|
438
|
+
graphParameters.endDate = moment().subtract(endOffset, 'days').startOf('day');
|
439
|
+
}
|
440
|
+
|
441
|
+
function appendDateRange (graphParameters) {
|
442
|
+
var FORMAT = 'MMM DD YYYY'
|
443
|
+
$('div#date-range strong')
|
444
|
+
.empty()
|
445
|
+
.append(graphParameters.startDate.format(FORMAT) + ' - ' + graphParameters.endDate.format(FORMAT));
|
446
|
+
}
|
447
|
+
|
448
|
+
function maxOffset (activationDate, interval) {
|
449
|
+
return Math.ceil(moment().diff(activationDate, 'days')/interval)
|
450
|
+
}
|