think_feel_do_engine 3.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (613) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +54 -0
  4. data/Rakefile +49 -0
  5. data/app/assets/images/changing_actions.gif +0 -0
  6. data/app/assets/images/evaluating_thoughts.gif +0 -0
  7. data/app/assets/images/favicon.ico +0 -0
  8. data/app/assets/images/think_feel_do_engine/athletic_man.png +0 -0
  9. data/app/assets/images/think_feel_do_engine/favicon.ico +0 -0
  10. data/app/assets/images/think_feel_do_engine/head_with_gears.jpg +0 -0
  11. data/app/assets/images/think_feel_do_engine/professional_woman.png +0 -0
  12. data/app/assets/images/think_feel_do_engine/woman_with_wrench.png +0 -0
  13. data/app/assets/javascripts/think_feel_do_engine.js +32 -0
  14. data/app/assets/javascripts/think_feel_do_engine/activities/activity_tracker.js +386 -0
  15. data/app/assets/javascripts/think_feel_do_engine/activities/dailyBreakdown.js +407 -0
  16. data/app/assets/javascripts/think_feel_do_engine/activities/forms.js +81 -0
  17. data/app/assets/javascripts/think_feel_do_engine/activities/your_activities.js +28 -0
  18. data/app/assets/javascripts/think_feel_do_engine/assessments.js +14 -0
  19. data/app/assets/javascripts/think_feel_do_engine/coach/messages/new.js +13 -0
  20. data/app/assets/javascripts/think_feel_do_engine/coach/patient_dashboards/index.js +16 -0
  21. data/app/assets/javascripts/think_feel_do_engine/dateWrapper.js +7 -0
  22. data/app/assets/javascripts/think_feel_do_engine/devise/passwords/edit.js.erb +24 -0
  23. data/app/assets/javascripts/think_feel_do_engine/event_capture/init.js +68 -0
  24. data/app/assets/javascripts/think_feel_do_engine/feel/emotion_mood_viz.js +31 -0
  25. data/app/assets/javascripts/think_feel_do_engine/feel/emotions.js +450 -0
  26. data/app/assets/javascripts/think_feel_do_engine/feel/timeago.js +214 -0
  27. data/app/assets/javascripts/think_feel_do_engine/forms/multi_page.js.erb +22 -0
  28. data/app/assets/javascripts/think_feel_do_engine/forms/multi_page_thought.js.erb +41 -0
  29. data/app/assets/javascripts/think_feel_do_engine/forms/suggested_prompt.js +22 -0
  30. data/app/assets/javascripts/think_feel_do_engine/markdown_editor.js +13 -0
  31. data/app/assets/javascripts/think_feel_do_engine/media_access_events.js +35 -0
  32. data/app/assets/javascripts/think_feel_do_engine/messages.js +8 -0
  33. data/app/assets/javascripts/think_feel_do_engine/participants.js +12 -0
  34. data/app/assets/javascripts/think_feel_do_engine/responsive-table.js +75 -0
  35. data/app/assets/javascripts/think_feel_do_engine/scrollindicator.js +92 -0
  36. data/app/assets/javascripts/think_feel_do_engine/shared/detect_timeout.js +42 -0
  37. data/app/assets/javascripts/think_feel_do_engine/slideshows.js +14 -0
  38. data/app/assets/javascripts/think_feel_do_engine/stepped_care.js +53 -0
  39. data/app/assets/javascripts/think_feel_do_engine/task_status.js +19 -0
  40. data/app/assets/javascripts/think_feel_do_engine/thought_patterns/index.js.erb +17 -0
  41. data/app/assets/javascripts/think_feel_do_engine/thoughts/edit_bulk.js +12 -0
  42. data/app/assets/javascripts/think_feel_do_engine/thoughts/scThoughtTrackerMenuViz.js +346 -0
  43. data/app/assets/javascripts/think_feel_do_engine/thoughts/thought_viz.js +53 -0
  44. data/app/assets/javascripts/think_feel_do_engine/users.js +10 -0
  45. data/app/assets/javascripts/think_feel_do_engine/validate_social_sharing.js +60 -0
  46. data/app/assets/stylesheets/think_feel_do_engine.css +12 -0
  47. data/app/assets/stylesheets/think_feel_do_engine/activities.css.scss +15 -0
  48. data/app/assets/stylesheets/think_feel_do_engine/base.css.scss +691 -0
  49. data/app/assets/stylesheets/think_feel_do_engine/dataTables-overrides.css.scss +27 -0
  50. data/app/assets/stylesheets/think_feel_do_engine/mobile.css.scss +3 -0
  51. data/app/assets/stylesheets/think_feel_do_engine/print.css.scss +1 -0
  52. data/app/controllers/think_feel_do_engine/application_controller.rb +77 -0
  53. data/app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb +115 -0
  54. data/app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb +117 -0
  55. data/app/controllers/think_feel_do_engine/bit_maker/slides_controller.rb +168 -0
  56. data/app/controllers/think_feel_do_engine/bit_maker/slideshow_anchors_controller.rb +61 -0
  57. data/app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb +93 -0
  58. data/app/controllers/think_feel_do_engine/coach/group_dashboard_controller.rb +18 -0
  59. data/app/controllers/think_feel_do_engine/coach/memberships_controller.rb +38 -0
  60. data/app/controllers/think_feel_do_engine/coach/messages_controller.rb +91 -0
  61. data/app/controllers/think_feel_do_engine/coach/participant_activities_visualizations_controller.rb +24 -0
  62. data/app/controllers/think_feel_do_engine/coach/participant_thoughts_visualizations_controller.rb +15 -0
  63. data/app/controllers/think_feel_do_engine/coach/patient_dashboards_controller.rb +70 -0
  64. data/app/controllers/think_feel_do_engine/coach/phq_assessments_controller.rb +94 -0
  65. data/app/controllers/think_feel_do_engine/coach/received_messages_controller.rb +45 -0
  66. data/app/controllers/think_feel_do_engine/coach/sent_messages_controller.rb +26 -0
  67. data/app/controllers/think_feel_do_engine/coach/site_messages_controller.rb +49 -0
  68. data/app/controllers/think_feel_do_engine/coach_dashboard_controller.rb +11 -0
  69. data/app/controllers/think_feel_do_engine/concerns/browser_detective.rb +26 -0
  70. data/app/controllers/think_feel_do_engine/concerns/navigator_enabled.rb +17 -0
  71. data/app/controllers/think_feel_do_engine/keep_alive_controller.rb +27 -0
  72. data/app/controllers/think_feel_do_engine/lesson_slides_controller.rb +98 -0
  73. data/app/controllers/think_feel_do_engine/lessons_controller.rb +128 -0
  74. data/app/controllers/think_feel_do_engine/manage/groups_controller.rb +29 -0
  75. data/app/controllers/think_feel_do_engine/manage/tasks_controller.rb +68 -0
  76. data/app/controllers/think_feel_do_engine/memberships_controller.rb +55 -0
  77. data/app/controllers/think_feel_do_engine/navigator_controller.rb +109 -0
  78. data/app/controllers/think_feel_do_engine/participant_data_controller.rb +83 -0
  79. data/app/controllers/think_feel_do_engine/participants/activities_controller.rb +62 -0
  80. data/app/controllers/think_feel_do_engine/participants/assessments_controller.rb +84 -0
  81. data/app/controllers/think_feel_do_engine/participants/lessons_controller.rb +28 -0
  82. data/app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb +42 -0
  83. data/app/controllers/think_feel_do_engine/participants/passwords_controller.rb +33 -0
  84. data/app/controllers/think_feel_do_engine/participants/public_slides_controller.rb +11 -0
  85. data/app/controllers/think_feel_do_engine/participants/sessions_controller.rb +16 -0
  86. data/app/controllers/think_feel_do_engine/participants/task_status_controller.rb +29 -0
  87. data/app/controllers/think_feel_do_engine/participants/thoughts_controller.rb +28 -0
  88. data/app/controllers/think_feel_do_engine/password_entropy_bits_controller.rb +12 -0
  89. data/app/controllers/think_feel_do_engine/privacy_policies_controller.rb +15 -0
  90. data/app/controllers/think_feel_do_engine/quick_sign_ins_controller.rb +18 -0
  91. data/app/controllers/think_feel_do_engine/users/passwords_controller.rb +16 -0
  92. data/app/controllers/think_feel_do_engine/users/registrations_controller.rb +16 -0
  93. data/app/controllers/think_feel_do_engine/users/sessions_controller.rb +36 -0
  94. data/app/helpers/think_feel_do_engine/activities_helper.rb +53 -0
  95. data/app/helpers/think_feel_do_engine/application_helper.rb +24 -0
  96. data/app/helpers/think_feel_do_engine/brand_helper.rb +36 -0
  97. data/app/helpers/think_feel_do_engine/coach/activity_color_code_helper.rb +52 -0
  98. data/app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb +93 -0
  99. data/app/helpers/think_feel_do_engine/coach/group_dashboard_helper.rb +156 -0
  100. data/app/helpers/think_feel_do_engine/coach/messages_helper.rb +35 -0
  101. data/app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb +23 -0
  102. data/app/helpers/think_feel_do_engine/coach/patient_dashboard_helper.rb +58 -0
  103. data/app/helpers/think_feel_do_engine/emotions_helper.rb +15 -0
  104. data/app/helpers/think_feel_do_engine/phq_assessment_helper.rb +14 -0
  105. data/app/helpers/think_feel_do_engine/presenters_helper.rb +8 -0
  106. data/app/helpers/think_feel_do_engine/slides_helper.rb +43 -0
  107. data/app/helpers/think_feel_do_engine/tasks_helper.rb +110 -0
  108. data/app/mailers/think_feel_do_engine/lesson_notification_mailer.rb +15 -0
  109. data/app/mailers/think_feel_do_engine/message_notifications.rb +21 -0
  110. data/app/mailers/think_feel_do_engine/site_message_mailer.rb +11 -0
  111. data/app/models/ability.rb +91 -0
  112. data/app/models/activity.rb +362 -0
  113. data/app/models/activity_type.rb +8 -0
  114. data/app/models/arm.rb +47 -0
  115. data/app/models/arm_validator.rb +11 -0
  116. data/app/models/available_content_module.rb +95 -0
  117. data/app/models/awake_period.rb +40 -0
  118. data/app/models/bit_core/slide_observer.rb +9 -0
  119. data/app/models/coach_assignment.rb +9 -0
  120. data/app/models/content_modules.rb +27 -0
  121. data/app/models/content_modules/lesson_module.rb +88 -0
  122. data/app/models/content_provider_decorator.rb +115 -0
  123. data/app/models/content_provider_policy.rb +6 -0
  124. data/app/models/content_providers/accomplished_activity_index_provider.rb +21 -0
  125. data/app/models/content_providers/activity_index_provider.rb +25 -0
  126. data/app/models/content_providers/augmented_thoughts_table_provider.rb +18 -0
  127. data/app/models/content_providers/awake_period_form.rb +67 -0
  128. data/app/models/content_providers/create_activity.rb +42 -0
  129. data/app/models/content_providers/edit_past_feel_provider.rb +8 -0
  130. data/app/models/content_providers/evaluate_thoughts_provider.rb +15 -0
  131. data/app/models/content_providers/fun_activity_checklist.rb +43 -0
  132. data/app/models/content_providers/harmful_thoughts_edit_form_provider.rb +31 -0
  133. data/app/models/content_providers/helpful_thoughts_index_provider.rb +31 -0
  134. data/app/models/content_providers/important_activity_checklist.rb +44 -0
  135. data/app/models/content_providers/index_past_feel_provider.rb +24 -0
  136. data/app/models/content_providers/input_new_activity_form.rb +28 -0
  137. data/app/models/content_providers/learn_lessons_index_provider.rb +55 -0
  138. data/app/models/content_providers/messages_index_provider.rb +64 -0
  139. data/app/models/content_providers/module_index_provider.rb +41 -0
  140. data/app/models/content_providers/new_complete_thought_form_provider.rb +26 -0
  141. data/app/models/content_providers/new_current_emotion_provider.rb +30 -0
  142. data/app/models/content_providers/new_current_feel_provider.rb +26 -0
  143. data/app/models/content_providers/new_harmful_thought_form_provider.rb +27 -0
  144. data/app/models/content_providers/new_message_form_provider.rb +61 -0
  145. data/app/models/content_providers/new_past_feel_provider.rb +26 -0
  146. data/app/models/content_providers/new_thought_form_provider.rb +26 -0
  147. data/app/models/content_providers/new_thoughts_form_provider.rb +26 -0
  148. data/app/models/content_providers/past_activity_form.rb +55 -0
  149. data/app/models/content_providers/past_activity_review_form.rb +36 -0
  150. data/app/models/content_providers/past_due_activities_viz.rb +40 -0
  151. data/app/models/content_providers/pleasurable_activity_index_provider.rb +20 -0
  152. data/app/models/content_providers/previous_planned_activities_provider.rb +35 -0
  153. data/app/models/content_providers/random_slide_provider.rb +14 -0
  154. data/app/models/content_providers/show_message_provider.rb +78 -0
  155. data/app/models/content_providers/thought_patterns_index_provider.rb +21 -0
  156. data/app/models/content_providers/thoughts_distortion_viz_provider.rb +22 -0
  157. data/app/models/content_providers/thoughts_table_provider.rb +17 -0
  158. data/app/models/content_providers/unhelpful_thoughts_list_provider.rb +67 -0
  159. data/app/models/content_providers/unhelpful_thoughts_reflection_provider.rb +26 -0
  160. data/app/models/content_providers/unplanned_activity_form.rb +35 -0
  161. data/app/models/content_providers/your_activities_provider.rb +94 -0
  162. data/app/models/delivered_message.rb +59 -0
  163. data/app/models/emotion.rb +30 -0
  164. data/app/models/emotional_rating.rb +45 -0
  165. data/app/models/engagement.rb +7 -0
  166. data/app/models/group.rb +144 -0
  167. data/app/models/media_access_event.rb +24 -0
  168. data/app/models/membership.rb +199 -0
  169. data/app/models/message.rb +58 -0
  170. data/app/models/message_sms_notification.rb +45 -0
  171. data/app/models/mood.rb +31 -0
  172. data/app/models/participant.rb +355 -0
  173. data/app/models/participant_login_event.rb +6 -0
  174. data/app/models/participant_token.rb +32 -0
  175. data/app/models/phq_assessment.rb +55 -0
  176. data/app/models/phq_stepping.rb +325 -0
  177. data/app/models/phq_stepping_assessment.rb +96 -0
  178. data/app/models/planned_activity.rb +5 -0
  179. data/app/models/roles/clinician.rb +4 -0
  180. data/app/models/roles/content_author.rb +4 -0
  181. data/app/models/roles/researcher.rb +4 -0
  182. data/app/models/site_message.rb +6 -0
  183. data/app/models/slideshow_anchor.rb +16 -0
  184. data/app/models/task.rb +102 -0
  185. data/app/models/task_status.rb +94 -0
  186. data/app/models/think_feel_do_engine/addressable.rb +28 -0
  187. data/app/models/think_feel_do_engine/concerns/validate_password.rb +65 -0
  188. data/app/models/think_feel_do_engine/password_validator.rb +55 -0
  189. data/app/models/think_feel_do_engine/reports/emotional_rating.rb +23 -0
  190. data/app/models/think_feel_do_engine/reports/event.rb +26 -0
  191. data/app/models/think_feel_do_engine/reports/lesson_module.rb +47 -0
  192. data/app/models/think_feel_do_engine/reports/lesson_slide_view.rb +94 -0
  193. data/app/models/think_feel_do_engine/reports/lesson_viewing.rb +64 -0
  194. data/app/models/think_feel_do_engine/reports/login.rb +22 -0
  195. data/app/models/think_feel_do_engine/reports/messaging.rb +109 -0
  196. data/app/models/think_feel_do_engine/reports/module_page_view.rb +57 -0
  197. data/app/models/think_feel_do_engine/reports/module_session.rb +130 -0
  198. data/app/models/think_feel_do_engine/reports/patient_activity.rb +22 -0
  199. data/app/models/think_feel_do_engine/reports/patient_thought.rb +22 -0
  200. data/app/models/think_feel_do_engine/reports/phq_assessment.rb +32 -0
  201. data/app/models/think_feel_do_engine/reports/reporter.rb +45 -0
  202. data/app/models/think_feel_do_engine/reports/site_session.rb +63 -0
  203. data/app/models/think_feel_do_engine/reports/task_completion.rb +30 -0
  204. data/app/models/think_feel_do_engine/reports/tool_access.rb +51 -0
  205. data/app/models/think_feel_do_engine/reports/tool_module.rb +29 -0
  206. data/app/models/think_feel_do_engine/reports/user_agent.rb +33 -0
  207. data/app/models/think_feel_do_engine/reports/video_session.rb +65 -0
  208. data/app/models/think_feel_do_engine/reports/wai_assessment.rb +35 -0
  209. data/app/models/thought.rb +80 -0
  210. data/app/models/thought_pattern.rb +6 -0
  211. data/app/models/tool_nav_item.rb +65 -0
  212. data/app/models/tools/home.rb +5 -0
  213. data/app/models/tools/learn.rb +5 -0
  214. data/app/models/tools/messages.rb +5 -0
  215. data/app/models/tools/think.rb +5 -0
  216. data/app/models/unplanned_activities.rb +47 -0
  217. data/app/models/user.rb +55 -0
  218. data/app/models/user_role.rb +18 -0
  219. data/app/models/values/accomplishment.rb +23 -0
  220. data/app/models/values/emotional_rating.rb +23 -0
  221. data/app/models/values/mood.rb +22 -0
  222. data/app/models/values/pleasure.rb +23 -0
  223. data/app/models/wai_assessment.rb +30 -0
  224. data/app/presenters/think_feel_do_engine/harmful_thought_viz_presenter.rb +30 -0
  225. data/app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb +41 -0
  226. data/app/presenters/think_feel_do_engine/media_access_event_presenter.rb +54 -0
  227. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  228. data/app/views/devise/passwords/edit.html.erb +35 -0
  229. data/app/views/devise/passwords/new.html.erb +17 -0
  230. data/app/views/devise/sessions/new.html.erb +50 -0
  231. data/app/views/devise/shared/_links.erb +25 -0
  232. data/app/views/layouts/phq_assessment_mailer.html.erb +87 -0
  233. data/app/views/slides/show.html.erb +2 -0
  234. data/app/views/think_feel_do_engine/activities/_activity.html.erb +18 -0
  235. data/app/views/think_feel_do_engine/activities/_activity_coach_view.html.erb +6 -0
  236. data/app/views/think_feel_do_engine/activities/_activity_coach_view_future.html.erb +13 -0
  237. data/app/views/think_feel_do_engine/activities/_activity_coach_view_past.html.erb +21 -0
  238. data/app/views/think_feel_do_engine/activities/_activity_form_fields.html.erb +21 -0
  239. data/app/views/think_feel_do_engine/activities/_build_activity.html.erb +107 -0
  240. data/app/views/think_feel_do_engine/activities/_daily_summary.html.erb +121 -0
  241. data/app/views/think_feel_do_engine/activities/_intensity_selector.html.erb +25 -0
  242. data/app/views/think_feel_do_engine/activities/_mutable_activity.html.erb +14 -0
  243. data/app/views/think_feel_do_engine/activities/_past_due_activities_index_viz.html.erb +25 -0
  244. data/app/views/think_feel_do_engine/activities/_past_due_rows.erb +7 -0
  245. data/app/views/think_feel_do_engine/activities/_past_due_table.erb +39 -0
  246. data/app/views/think_feel_do_engine/activities/_previously_planned.html.erb +9 -0
  247. data/app/views/think_feel_do_engine/activities/accomplished_index.html.erb +84 -0
  248. data/app/views/think_feel_do_engine/activities/create_activity.html.erb +5 -0
  249. data/app/views/think_feel_do_engine/activities/fun_activity_checklist.html.erb +5 -0
  250. data/app/views/think_feel_do_engine/activities/important_activity_checklist.html.erb +5 -0
  251. data/app/views/think_feel_do_engine/activities/index.html.erb +81 -0
  252. data/app/views/think_feel_do_engine/activities/input_new_activity_form.html.erb +64 -0
  253. data/app/views/think_feel_do_engine/activities/past_activity_form.html.erb +75 -0
  254. data/app/views/think_feel_do_engine/activities/past_activity_review.html.erb +104 -0
  255. data/app/views/think_feel_do_engine/activities/pleasurable_index.html.erb +84 -0
  256. data/app/views/think_feel_do_engine/activities/previously_planned_fullpage.html.erb +12 -0
  257. data/app/views/think_feel_do_engine/activities/unplanned_activity_form.html.erb +21 -0
  258. data/app/views/think_feel_do_engine/activities/visualization.html.erb +120 -0
  259. data/app/views/think_feel_do_engine/assigned_tasks/show.html.erb +1 -0
  260. data/app/views/think_feel_do_engine/awake_periods/incomplete.html.erb +13 -0
  261. data/app/views/think_feel_do_engine/awake_periods/new.html.erb +34 -0
  262. data/app/views/think_feel_do_engine/bit_maker/content_modules/_form.html.erb +24 -0
  263. data/app/views/think_feel_do_engine/bit_maker/content_modules/edit.html.erb +9 -0
  264. data/app/views/think_feel_do_engine/bit_maker/content_modules/index.html.erb +38 -0
  265. data/app/views/think_feel_do_engine/bit_maker/content_modules/new.html.erb +9 -0
  266. data/app/views/think_feel_do_engine/bit_maker/content_modules/show.html.erb +27 -0
  267. data/app/views/think_feel_do_engine/bit_maker/content_providers/_form.html.erb +48 -0
  268. data/app/views/think_feel_do_engine/bit_maker/content_providers/edit.html.erb +12 -0
  269. data/app/views/think_feel_do_engine/bit_maker/content_providers/index.html.erb +36 -0
  270. data/app/views/think_feel_do_engine/bit_maker/content_providers/new.html.erb +12 -0
  271. data/app/views/think_feel_do_engine/bit_maker/content_providers/show.html.erb +42 -0
  272. data/app/views/think_feel_do_engine/bit_maker/slides/_fields.html.erb +212 -0
  273. data/app/views/think_feel_do_engine/bit_maker/slides/_slide.html.erb +23 -0
  274. data/app/views/think_feel_do_engine/bit_maker/slides/edit.html.erb +9 -0
  275. data/app/views/think_feel_do_engine/bit_maker/slides/index.html.erb +6 -0
  276. data/app/views/think_feel_do_engine/bit_maker/slides/new.html.erb +6 -0
  277. data/app/views/think_feel_do_engine/bit_maker/slideshow_anchors/create.js.erb +2 -0
  278. data/app/views/think_feel_do_engine/bit_maker/slideshow_anchors/destroy.js.erb +2 -0
  279. data/app/views/think_feel_do_engine/bit_maker/slideshows/_fields.html +4 -0
  280. data/app/views/think_feel_do_engine/bit_maker/slideshows/_slide_panel.html.erb +12 -0
  281. data/app/views/think_feel_do_engine/bit_maker/slideshows/_toc_panel.html.erb +5 -0
  282. data/app/views/think_feel_do_engine/bit_maker/slideshows/edit.html.erb +7 -0
  283. data/app/views/think_feel_do_engine/bit_maker/slideshows/index.html.erb +42 -0
  284. data/app/views/think_feel_do_engine/bit_maker/slideshows/new.html.erb +6 -0
  285. data/app/views/think_feel_do_engine/bit_maker/slideshows/show.html.erb +31 -0
  286. data/app/views/think_feel_do_engine/coach/group_dashboard/_activities_future.html.erb +69 -0
  287. data/app/views/think_feel_do_engine/coach/group_dashboard/_activities_past.html.erb +75 -0
  288. data/app/views/think_feel_do_engine/coach/group_dashboard/_comments.html.erb +63 -0
  289. data/app/views/think_feel_do_engine/coach/group_dashboard/_goals.html.erb +71 -0
  290. data/app/views/think_feel_do_engine/coach/group_dashboard/_learning_lesson_row.html.erb +5 -0
  291. data/app/views/think_feel_do_engine/coach/group_dashboard/_lesson_completion_breakdown.html.erb +33 -0
  292. data/app/views/think_feel_do_engine/coach/group_dashboard/_lessons.html.erb +21 -0
  293. data/app/views/think_feel_do_engine/coach/group_dashboard/_likes.html.erb +63 -0
  294. data/app/views/think_feel_do_engine/coach/group_dashboard/_logins.html.erb +24 -0
  295. data/app/views/think_feel_do_engine/coach/group_dashboard/_on_my_mind_statements.html.erb +66 -0
  296. data/app/views/think_feel_do_engine/coach/group_dashboard/_summary.html.erb +30 -0
  297. data/app/views/think_feel_do_engine/coach/group_dashboard/_summary_social.html.erb +24 -0
  298. data/app/views/think_feel_do_engine/coach/group_dashboard/_thoughts.html.erb +67 -0
  299. data/app/views/think_feel_do_engine/coach/group_dashboard/index.html.erb +50 -0
  300. data/app/views/think_feel_do_engine/coach/messages/index.html.erb +50 -0
  301. data/app/views/think_feel_do_engine/coach/messages/new.html.erb +32 -0
  302. data/app/views/think_feel_do_engine/coach/patient_dashboards/_active_patient.html.erb +104 -0
  303. data/app/views/think_feel_do_engine/coach/patient_dashboards/_details.html.erb +54 -0
  304. data/app/views/think_feel_do_engine/coach/patient_dashboards/_header.html.erb +5 -0
  305. data/app/views/think_feel_do_engine/coach/patient_dashboards/_inactive_patient.html.erb +34 -0
  306. data/app/views/think_feel_do_engine/coach/patient_dashboards/_mood_emotion_viz.html.erb +6 -0
  307. data/app/views/think_feel_do_engine/coach/patient_dashboards/_not_stepped_table.html.erb +36 -0
  308. data/app/views/think_feel_do_engine/coach/patient_dashboards/_phq_summary.html.erb +61 -0
  309. data/app/views/think_feel_do_engine/coach/patient_dashboards/_stepped_table.html.erb +35 -0
  310. data/app/views/think_feel_do_engine/coach/patient_dashboards/_table_of_contents.html.erb +20 -0
  311. data/app/views/think_feel_do_engine/coach/patient_dashboards/_test_summary.html.erb +39 -0
  312. data/app/views/think_feel_do_engine/coach/patient_dashboards/_vizs.html.erb +73 -0
  313. data/app/views/think_feel_do_engine/coach/patient_dashboards/index.html.erb +20 -0
  314. data/app/views/think_feel_do_engine/coach/patient_dashboards/show.html.erb +23 -0
  315. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_audio_access_table.html.erb +49 -0
  316. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_feelings_table.html.erb +48 -0
  317. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_future_activities_table.html.erb +66 -0
  318. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_lessons_table.html.erb +56 -0
  319. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_logins_table.html.erb +47 -0
  320. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_messages_table.html.erb +46 -0
  321. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_mood_table.html.erb +46 -0
  322. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_past_activities_table.html.erb +70 -0
  323. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_patient_info.html.erb +39 -0
  324. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_patient_login_stats.html.erb +51 -0
  325. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_phq9_data.html.erb +47 -0
  326. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_summary_totals.html.erb +49 -0
  327. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_tasks_table.html.erb +47 -0
  328. data/app/views/think_feel_do_engine/coach/patient_dashboards/tables/_thoughts_table.html.erb +49 -0
  329. data/app/views/think_feel_do_engine/coach/phq_assessments/_form.html.erb +42 -0
  330. data/app/views/think_feel_do_engine/coach/phq_assessments/edit.html.erb +3 -0
  331. data/app/views/think_feel_do_engine/coach/phq_assessments/index.html.erb +43 -0
  332. data/app/views/think_feel_do_engine/coach/phq_assessments/new.html.erb +3 -0
  333. data/app/views/think_feel_do_engine/coach/received_messages/_received_message.html.erb +5 -0
  334. data/app/views/think_feel_do_engine/coach/site_messages/_form.html.erb +38 -0
  335. data/app/views/think_feel_do_engine/coach/site_messages/index.html.erb +30 -0
  336. data/app/views/think_feel_do_engine/coach/site_messages/new.html.erb +3 -0
  337. data/app/views/think_feel_do_engine/coach/site_messages/show.html.erb +16 -0
  338. data/app/views/think_feel_do_engine/emotions/_emotion_coach_view.html.erb +8 -0
  339. data/app/views/think_feel_do_engine/emotions/_form.html.erb +28 -0
  340. data/app/views/think_feel_do_engine/emotions/index.html.erb +75 -0
  341. data/app/views/think_feel_do_engine/emotions/new_current.html.erb +30 -0
  342. data/app/views/think_feel_do_engine/learn/_completion_data.html.erb +28 -0
  343. data/app/views/think_feel_do_engine/learn/lessons_index.html.erb +72 -0
  344. data/app/views/think_feel_do_engine/lesson_notification_mailer/lesson_notification_email.html.erb +82 -0
  345. data/app/views/think_feel_do_engine/lesson_notification_mailer/lesson_notification_email.text.erb +10 -0
  346. data/app/views/think_feel_do_engine/lesson_slides/_audio.html.erb +1 -0
  347. data/app/views/think_feel_do_engine/lesson_slides/_video.html.erb +4 -0
  348. data/app/views/think_feel_do_engine/lesson_slides/edit.html.erb +7 -0
  349. data/app/views/think_feel_do_engine/lesson_slides/new.html.erb +6 -0
  350. data/app/views/think_feel_do_engine/lesson_slides/show.html.erb +21 -0
  351. data/app/views/think_feel_do_engine/lessons/_form.html.erb +8 -0
  352. data/app/views/think_feel_do_engine/lessons/_lesson.html.erb +6 -0
  353. data/app/views/think_feel_do_engine/lessons/all_content.html.erb +12 -0
  354. data/app/views/think_feel_do_engine/lessons/edit.html.erb +8 -0
  355. data/app/views/think_feel_do_engine/lessons/index.html.erb +36 -0
  356. data/app/views/think_feel_do_engine/lessons/new.html.erb +8 -0
  357. data/app/views/think_feel_do_engine/lessons/show.html.erb +30 -0
  358. data/app/views/think_feel_do_engine/login_events/_login_event.html.erb +6 -0
  359. data/app/views/think_feel_do_engine/manage/groups/_assigned_task_cell.html.erb +16 -0
  360. data/app/views/think_feel_do_engine/manage/groups/edit_tasks.html.erb +83 -0
  361. data/app/views/think_feel_do_engine/manage/groups/index.html.erb +19 -0
  362. data/app/views/think_feel_do_engine/manage/tasks/index.html.erb +24 -0
  363. data/app/views/think_feel_do_engine/media_access_events/_access_data.html.erb +24 -0
  364. data/app/views/think_feel_do_engine/memberships/update.js.erb +4 -0
  365. data/app/views/think_feel_do_engine/message_notifications/new_for_coach.html.erb +93 -0
  366. data/app/views/think_feel_do_engine/message_notifications/new_for_coach.text.erb +3 -0
  367. data/app/views/think_feel_do_engine/message_notifications/new_for_participant.html.erb +93 -0
  368. data/app/views/think_feel_do_engine/message_notifications/new_for_participant.text.erb +3 -0
  369. data/app/views/think_feel_do_engine/messages/_message.html.erb +7 -0
  370. data/app/views/think_feel_do_engine/messages/_message_info.html.erb +9 -0
  371. data/app/views/think_feel_do_engine/messages/index.html.erb +54 -0
  372. data/app/views/think_feel_do_engine/messages/new.html.erb +34 -0
  373. data/app/views/think_feel_do_engine/messages/not_found.html.erb +3 -0
  374. data/app/views/think_feel_do_engine/messages/show.html.erb +27 -0
  375. data/app/views/think_feel_do_engine/moods/_mood.html.erb +7 -0
  376. data/app/views/think_feel_do_engine/moods/new_current.html.erb +18 -0
  377. data/app/views/think_feel_do_engine/moods/new_past_mood.html.erb +28 -0
  378. data/app/views/think_feel_do_engine/navigator/_before_content.html.erb +5 -0
  379. data/app/views/think_feel_do_engine/navigator/show_content.html.erb +14 -0
  380. data/app/views/think_feel_do_engine/participant_data/create.js.erb +1 -0
  381. data/app/views/think_feel_do_engine/participant_data/update.js.erb +1 -0
  382. data/app/views/think_feel_do_engine/participants/activities/create.js.erb +5 -0
  383. data/app/views/think_feel_do_engine/participants/assessments/new_phq_assessment.html.erb +77 -0
  384. data/app/views/think_feel_do_engine/participants/assessments/new_wai_assessment.html.erb +51 -0
  385. data/app/views/think_feel_do_engine/participants/assessments/success.html +1 -0
  386. data/app/views/think_feel_do_engine/participants/content_modules/index.html.erb +36 -0
  387. data/app/views/think_feel_do_engine/participants/lessons/_printable.html.erb +15 -0
  388. data/app/views/think_feel_do_engine/participants/lessons/show.html.erb +1 -0
  389. data/app/views/think_feel_do_engine/participants/messages/_inbox_header.html.erb +1 -0
  390. data/app/views/think_feel_do_engine/participants/public_slides/show.html.erb +8 -0
  391. data/app/views/think_feel_do_engine/participants/received_messages/_received_message.html.erb +1 -0
  392. data/app/views/think_feel_do_engine/participants/thoughts/create.js.erb +24 -0
  393. data/app/views/think_feel_do_engine/phq_assessments/_phq_assessment.html.erb +15 -0
  394. data/app/views/think_feel_do_engine/privacy_policies/show.html.erb +17 -0
  395. data/app/views/think_feel_do_engine/shared/_alerts.html.erb +17 -0
  396. data/app/views/think_feel_do_engine/shared/_authentication.html.erb +5 -0
  397. data/app/views/think_feel_do_engine/shared/_email_head.html.erb +771 -0
  398. data/app/views/think_feel_do_engine/shared/_footer.html.erb +21 -0
  399. data/app/views/think_feel_do_engine/shared/_head.html.erb +14 -0
  400. data/app/views/think_feel_do_engine/shared/_home.html.erb +4 -0
  401. data/app/views/think_feel_do_engine/shared/_jplayer.html.erb +48 -0
  402. data/app/views/think_feel_do_engine/shared/_rating_selector.html.erb +16 -0
  403. data/app/views/think_feel_do_engine/shared/participant/_hamburger_nav_items.html.erb +19 -0
  404. data/app/views/think_feel_do_engine/shared/participant/_nav_items.html.erb +49 -0
  405. data/app/views/think_feel_do_engine/shared/participant/_navbar.html.erb +38 -0
  406. data/app/views/think_feel_do_engine/shared/user/_navbar.html.erb +25 -0
  407. data/app/views/think_feel_do_engine/site_message_mailer/general.html.erb +8 -0
  408. data/app/views/think_feel_do_engine/site_message_mailer/general.text.erb +3 -0
  409. data/app/views/think_feel_do_engine/slides/_audio.html.erb +4 -0
  410. data/app/views/think_feel_do_engine/slides/_slide.html.erb +18 -0
  411. data/app/views/think_feel_do_engine/slides/_table_of_contents.html.erb +24 -0
  412. data/app/views/think_feel_do_engine/slides/_video.html.erb +34 -0
  413. data/app/views/think_feel_do_engine/slides/homepage.html.erb +29 -0
  414. data/app/views/think_feel_do_engine/slides/show.html.erb +11 -0
  415. data/app/views/think_feel_do_engine/slides/sort.js.erb +1 -0
  416. data/app/views/think_feel_do_engine/slides/sort_with_reload.js.erb +1 -0
  417. data/app/views/think_feel_do_engine/task_statuses/_task_status.html.erb +8 -0
  418. data/app/views/think_feel_do_engine/thought_patterns/evaluating.html.erb +2 -0
  419. data/app/views/think_feel_do_engine/thought_patterns/index.html.erb +8 -0
  420. data/app/views/think_feel_do_engine/thoughts/_form.html.erb +11 -0
  421. data/app/views/think_feel_do_engine/thoughts/_harmful_thought.html.erb +4 -0
  422. data/app/views/think_feel_do_engine/thoughts/_mutable_thought.html.erb +23 -0
  423. data/app/views/think_feel_do_engine/thoughts/_thought.html.erb +10 -0
  424. data/app/views/think_feel_do_engine/thoughts/_thought_effects.html.erb +1 -0
  425. data/app/views/think_feel_do_engine/thoughts/_thought_patterns.html.erb +7 -0
  426. data/app/views/think_feel_do_engine/thoughts/distortion_viz.html.erb +28 -0
  427. data/app/views/think_feel_do_engine/thoughts/edit_bulk.html.erb +43 -0
  428. data/app/views/think_feel_do_engine/thoughts/index.html.erb +24 -0
  429. data/app/views/think_feel_do_engine/thoughts/new.html.erb +5 -0
  430. data/app/views/think_feel_do_engine/thoughts/new_bulk.html.erb +36 -0
  431. data/app/views/think_feel_do_engine/thoughts/new_complete.html.erb +28 -0
  432. data/app/views/think_feel_do_engine/thoughts/new_harmful.html.erb +14 -0
  433. data/app/views/think_feel_do_engine/thoughts/thoughts_table.html.erb +60 -0
  434. data/app/views/think_feel_do_engine/thoughts/unhelpful_thoughts_form.html.erb +103 -0
  435. data/config/brakeman.ignore +206 -0
  436. data/config/brakeman.yml +5 -0
  437. data/config/initializers/datetime_formats.rb +32 -0
  438. data/config/initializers/devise.rb +272 -0
  439. data/config/initializers/event_capture.rb +43 -0
  440. data/config/initializers/think_feel_do_engine.rb +4 -0
  441. data/config/locales/devise.en.yml +60 -0
  442. data/config/locales/en.yml +4 -0
  443. data/config/locales/rails_admin.en.yml +5 -0
  444. data/config/routes.rb +107 -0
  445. data/db/migrate/20140221174027_devise_create_users.rb +41 -0
  446. data/db/migrate/20140221182135_devise_create_participants.rb +28 -0
  447. data/db/migrate/20140221184614_create_groups.rb +29 -0
  448. data/db/migrate/20140221190256_create_memberships.rb +39 -0
  449. data/db/migrate/20140221201915_create_user_roles.rb +23 -0
  450. data/db/migrate/20140221204356_create_activity_types.rb +27 -0
  451. data/db/migrate/20140221211420_create_activities.rb +46 -0
  452. data/db/migrate/20140221214020_create_awake_periods.rb +29 -0
  453. data/db/migrate/20140223151355_create_slideshows.rb +12 -0
  454. data/db/migrate/20140223151505_create_slides.rb +33 -0
  455. data/db/migrate/20140224024338_create_content_modules.rb +12 -0
  456. data/db/migrate/20140224031252_create_content_providers.rb +34 -0
  457. data/db/migrate/20140224194936_require_titles_on_slides.rb +8 -0
  458. data/db/migrate/20140226174312_add_is_title_visible_to_slides.rb +8 -0
  459. data/db/migrate/20140226234059_drop_time_requirement_on_activities.rb +9 -0
  460. data/db/migrate/20140228042747_add_type_to_slides.rb +9 -0
  461. data/db/migrate/20140304020641_create_participant_statuses.rb +16 -0
  462. data/db/migrate/20140305134049_create_thoughts.rb +40 -0
  463. data/db/migrate/20140305204811_drop_extracted_bit_player_tables.rb +9 -0
  464. data/db/migrate/20140305220121_create_bit_player_content_modules.bit_player.rb +12 -0
  465. data/db/migrate/20140305220122_create_bit_player_content_providers.bit_player.rb +34 -0
  466. data/db/migrate/20140305233152_create_bit_player_participant_statuses.bit_player.rb +16 -0
  467. data/db/migrate/20140305235536_create_bit_player_slideshows.bit_player.rb +10 -0
  468. data/db/migrate/20140306000610_create_bit_player_slides.bit_player.rb +47 -0
  469. data/db/migrate/20140306161346_create_messages.rb +13 -0
  470. data/db/migrate/20140306161532_create_delivered_messages.rb +29 -0
  471. data/db/migrate/20140306175954_create_coach_assignments.rb +12 -0
  472. data/db/migrate/20140311172344_create_mood.rb +9 -0
  473. data/db/migrate/20140311182036_create_emotions.rb +10 -0
  474. data/db/migrate/20140311194313_add_column_activation_level_and_intensity_to_emotion.rb +9 -0
  475. data/db/migrate/20140313025147_create_thought_patterns.rb +10 -0
  476. data/db/migrate/20140313192408_add_pattern_id_to_thoughts.rb +22 -0
  477. data/db/migrate/20140313205806_add_name_to_emotions.rb +6 -0
  478. data/db/migrate/20140314203044_change_column_name_activation_level_to_valence.rb +8 -0
  479. data/db/migrate/20140318163703_create_group_slideshow_joins.rb +12 -0
  480. data/db/migrate/20140320183600_add_start_date_to_memberships.rb +5 -0
  481. data/db/migrate/20140326144359_create_phq_assessments.rb +39 -0
  482. data/db/migrate/20140326205140_create_participant_tokens.rb +32 -0
  483. data/db/migrate/20140331165739_add_end_date_to_memberships.rb +5 -0
  484. data/db/migrate/20140402151311_create_tasks.rb +11 -0
  485. data/db/migrate/20140402170153_add_creator_id_to_tasks.rb +5 -0
  486. data/db/migrate/20140407134214_create_task_statuses.rb +11 -0
  487. data/db/migrate/20140407150122_add_release_day_to_task_remove_is_completed_at_from_task.rb +6 -0
  488. data/db/migrate/20140407202026_create_bit_player_tools.bit_player.rb +14 -0
  489. data/db/migrate/20140407202027_change_module_context_to_tool.bit_player.rb +31 -0
  490. data/db/migrate/20140411184738_add_recurring_to_tasks.rb +5 -0
  491. data/db/migrate/20140411195557_add_question_and_explanation_to_thought_pattern.rb +6 -0
  492. data/db/migrate/20140411195804_add_challenging_thought_and_as_if_to_thought.rb +6 -0
  493. data/db/migrate/20140415165729_add_start_day_to_task_statuses.rb +5 -0
  494. data/db/migrate/20140418190852_remove_fk_groups_users_constraint.rb +21 -0
  495. data/db/migrate/20140421192355_change_start_date_on_membership_from_date_time_to_date.rb +9 -0
  496. data/db/migrate/20140501170217_add_is_admin_to_users.rb +5 -0
  497. data/db/migrate/20140501190812_add_participant_login_event.rb +9 -0
  498. data/db/migrate/20140502222145_add_is_admin_to_all_current_users.rb +15 -0
  499. data/db/migrate/20140505145843_add_study_id_to_participants.rb +5 -0
  500. data/db/migrate/20140523154605_delete_group_slideshow_join.rb +16 -0
  501. data/db/migrate/20140609181801_create_engagements.rb +10 -0
  502. data/db/migrate/20140620171824_create_bit_core_tools.bit_core.rb +29 -0
  503. data/db/migrate/20140620171825_create_bit_core_content_modules.bit_core.rb +41 -0
  504. data/db/migrate/20140620171826_create_bit_core_content_providers.bit_core.rb +43 -0
  505. data/db/migrate/20140620171827_create_bit_core_slideshows.bit_core.rb +10 -0
  506. data/db/migrate/20140620171828_create_bit_core_slides.bit_core.rb +44 -0
  507. data/db/migrate/20140620181933_add_options_to_slides.bit_core.rb +6 -0
  508. data/db/migrate/20140621023345_convert_slides_slideshows_to_bit_core.bit_player.rb +39 -0
  509. data/db/migrate/20140621024853_update_tasks_with_bit_core.rb +7 -0
  510. data/db/migrate/20140621024854_add_config_fields_to_providers.bit_core.rb +10 -0
  511. data/db/migrate/20140621031203_convert_tools_modules_presenters_to_bit_core.bit_player.rb +53 -0
  512. data/db/migrate/20140623182430_remove_valence_from_emotions.rb +5 -0
  513. data/db/migrate/20140624163655_rename_column_participant_id_on_emotions_to_creator_id.rb +5 -0
  514. data/db/migrate/20140624165438_create_emotional_ratings.rb +10 -0
  515. data/db/migrate/20140624165626_remove_rating_from_emotion_remove_intensity_from_emotion.rb +6 -0
  516. data/db/migrate/20140625133411_add_type_to_content_modules.bit_core.rb +6 -0
  517. data/db/migrate/20140625140629_convert_lesson_modules.rb +12 -0
  518. data/db/migrate/20140625140630_add_recommendations_to_thought_patterns.rb +5 -0
  519. data/db/migrate/20140702192100_create_content_provider_policies.rb +10 -0
  520. data/db/migrate/20140703203931_add_termination_day_to_tasks.rb +5 -0
  521. data/db/migrate/20140710122908_create_slideshow_anchors.rb +10 -0
  522. data/db/migrate/20140715170155_add_inactive_log_out_to_participant_login_event.rb +5 -0
  523. data/db/migrate/20140721190945_normalize_emotions.rb +18 -0
  524. data/db/migrate/20140722163946_add_thought_patterns.rb +83 -0
  525. data/db/migrate/20140722172101_add_missing_fk_constraints.rb +187 -0
  526. data/db/migrate/20140722195542_add_emotion_ids_to_orphaned_emotional_ratings.rb +12 -0
  527. data/db/migrate/20140725164219_add_is_monitored_to_activity.rb +5 -0
  528. data/db/migrate/20140725185012_add_participant_onload_log_out_to_login_event.rb +5 -0
  529. data/db/migrate/20140729151610_add_signed_out_at_to_participant_login_events.rb +5 -0
  530. data/db/migrate/20140729171907_remove_participant_on_load_log_out_from_login_event.rb +5 -0
  531. data/db/migrate/20140730202349_update_thought_patterns.rb +94 -0
  532. data/db/migrate/20140815190945_add_phq_edit_columns.rb +13 -0
  533. data/db/migrate/20140818202120_add_has_didactic_content_to_tasks.rb +5 -0
  534. data/db/migrate/20140821184357_add_is_scheduled_to_activities.rb +5 -0
  535. data/db/migrate/20140902204337_create_event_capture_events.event_capture.rb +14 -0
  536. data/db/migrate/20140903134021_add_participant_id_to_events.rb +23 -0
  537. data/db/migrate/20141027181511_add_phone_number_to_participant.rb +5 -0
  538. data/db/migrate/20141027181539_add_contact_status_to_participant.rb +5 -0
  539. data/db/migrate/20141110190545_create_site_messages.rb +29 -0
  540. data/db/migrate/20141121152018_create_arms.rb +8 -0
  541. data/db/migrate/20141121201238_add_arm_id_to_groups.rb +5 -0
  542. data/db/migrate/20141125194600_add_null_false_to_arms.rb +6 -0
  543. data/db/migrate/20141125202627_add_null_false_to_columns_and_associate_arm_group_join_arm_ids_to_groups.rb +5 -0
  544. data/db/migrate/20141201154255_add_arm_id_to_bit_core_tools.rb +9 -0
  545. data/db/migrate/20141201165610_change_column_bit_core_tools_arm_id_to_null.rb +5 -0
  546. data/db/migrate/20141202133320_remove_position_unique_constraint_from_tool.rb +21 -0
  547. data/db/migrate/20141202173321_add_arm_id_to_bit_core_slideshows.rb +5 -0
  548. data/db/migrate/20141202173458_change_column_bit_core_slideshows_to_null_false.rb +38 -0
  549. data/db/migrate/20141211140747_add_is_admin_.textClipping +0 -0
  550. data/db/migrate/20141211140747_add_is_admin_to_participants.rb +5 -0
  551. data/db/migrate/20141214203919_add_has_woz_to_arm.rb +5 -0
  552. data/db/migrate/20141222222717_change_default_contact_preference.rb +5 -0
  553. data/db/migrate/20150107183443_add_is_positive_to_emotion.rb +6 -0
  554. data/db/migrate/20150107192208_remove_is_positive_from_emotion.rb +5 -0
  555. data/db/migrate/20150107192402_add_is_positive_to_emotional_rating.rb +5 -0
  556. data/db/migrate/20150127204928_add_is_complete_to_membership.rb +5 -0
  557. data/db/migrate/20150127204950_add_is_stepped_to_membership.rb +5 -0
  558. data/db/migrate/20150128151059_change_is_stepped_membership_to_not_allow_null.rb +5 -0
  559. data/db/migrate/20150128151231_change_is_complete_membership_to_not_allow_null.rb +5 -0
  560. data/db/migrate/20150128151515_data_migration_add_values_for_is_stepped_and_is_complete.rb +11 -0
  561. data/db/migrate/20150128192928_destroy_invalid_task_statuses.rb +14 -0
  562. data/db/migrate/20150129160122_add_description_to_tools.rb +5 -0
  563. data/db/migrate/20150130160818_add_type_to_tools.bit_core.rb +6 -0
  564. data/db/migrate/20150130161629_convert_messages_tool_type.rb +7 -0
  565. data/db/migrate/20150130173324_convert_home_tool_type.rb +7 -0
  566. data/db/migrate/20150130185412_convert_learn_tool_type.rb +7 -0
  567. data/db/migrate/20150131200718_add_is_viz_to_content_modules.bit_core.rb +6 -0
  568. data/db/migrate/20150131201021_add_is_viz_flag_to_modules.rb +9 -0
  569. data/db/migrate/20150202203359_update_tool_type_columns.rb +23 -0
  570. data/db/migrate/20150202215540_fix_module_viz_columns.rb +9 -0
  571. data/db/migrate/20150202232642_prevent_null_membership_dates.rb +6 -0
  572. data/db/migrate/20150206221439_create_wai_assessments.rb +52 -0
  573. data/db/migrate/20150209195004_create_think_feel_do_engine_media_access_events.rb +12 -0
  574. data/db/migrate/20150209212556_add_stepped_on_column_to_memberships.rb +10 -0
  575. data/db/migrate/20150209213422_remove_is_stepped_column_from_memberships.rb +5 -0
  576. data/db/migrate/20150210142824_destroy_invalid_messages.rb +5 -0
  577. data/db/migrate/20150210153608_add_slide_reference_to_media_access_events.rb +8 -0
  578. data/db/migrate/20150210161100_add_missing_constraints.rb +43 -0
  579. data/db/migrate/20150210163220_add_fk_constraints_to_media_access_events.rb +21 -0
  580. data/db/migrate/20150210164226_add_slide_fk_contstraint_to_media_access_events.rb +21 -0
  581. data/db/migrate/20150210165021_add_tool_constraint.bit_core.rb +26 -0
  582. data/db/migrate/20150218184531_add_has_table_of_contents_to_slideshows.rb +9 -0
  583. data/db/migrate/20150225221700_add_is_reviewed_to_activities.rb +5 -0
  584. data/db/migrate/20150226210641_remove_is_monitored_from_activities.rb +5 -0
  585. data/db/migrate/20150227221640_remove_is_complete_from_activities.rb +5 -0
  586. data/db/migrate/20150302155709_remove_is_scheduled_from_activities.rb +5 -0
  587. data/db/migrate/20150307182155_create_available_content_modules_view.rb +46 -0
  588. data/db/migrate/20150310171015_update_available_content_modules_view.rb +48 -0
  589. data/db/migrate/20150410174157_add_can_message_after_membership_complete_to_arms.rb +5 -0
  590. data/db/migrate/20150410175659_populate_arm_message_flag.rb +7 -0
  591. data/db/migrate/20150810204045_nullify_empty_thoughts_columns.rb +15 -0
  592. data/db/migrate/20150903210028_add_relase_day_not_null_constraint_to_trask.rb +5 -0
  593. data/db/migrate/20151104152804_update_think_tool_type_to_tools_think.rb +9 -0
  594. data/lib/tasks/lesson_notifications.rake +66 -0
  595. data/lib/tasks/seed.rake +30 -0
  596. data/lib/tasks/think_feel_do_engine_tasks.rake +4 -0
  597. data/lib/think_feel_do_engine.rb +16 -0
  598. data/lib/think_feel_do_engine/engine.rb +16 -0
  599. data/lib/think_feel_do_engine/version.rb +4 -0
  600. data/vendor/assets/images/jplayer.blue.monday.jpg +0 -0
  601. data/vendor/assets/images/jplayer.blue.monday.seeking.gif +0 -0
  602. data/vendor/assets/images/jplayer.blue.monday.video.play.png +0 -0
  603. data/vendor/assets/javascripts/bootstrap-markdown.js +1347 -0
  604. data/vendor/assets/javascripts/bootstrap-timepicker.js +1097 -0
  605. data/vendor/assets/javascripts/d3.min.js +5 -0
  606. data/vendor/assets/javascripts/froogaloop.min.js +4 -0
  607. data/vendor/assets/javascripts/jplayer.2.9.2.min.js +1 -0
  608. data/vendor/assets/javascripts/moment.min.js +6 -0
  609. data/vendor/assets/javascripts/snap.js +568 -0
  610. data/vendor/assets/stylesheets/bootstrap-timepicker.min.css +10 -0
  611. data/vendor/assets/stylesheets/jplayer.blue.monday.css.scss +630 -0
  612. data/vendor/assets/stylesheets/snap.css.scss +80 -0
  613. metadata +949 -0
@@ -0,0 +1,1097 @@
1
+ /*!
2
+ * Timepicker Component for Twitter Bootstrap
3
+ *
4
+ * Copyright 2013 Joris de Wit
5
+ *
6
+ * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+ (function($, window, document, undefined) {
12
+ 'use strict';
13
+
14
+ // TIMEPICKER PUBLIC CLASS DEFINITION
15
+ var Timepicker = function(element, options) {
16
+ this.widget = '';
17
+ this.$element = $(element);
18
+ this.defaultTime = options.defaultTime;
19
+ this.disableFocus = options.disableFocus;
20
+ this.disableMousewheel = options.disableMousewheel;
21
+ this.isOpen = options.isOpen;
22
+ this.minuteStep = options.minuteStep;
23
+ this.modalBackdrop = options.modalBackdrop;
24
+ this.orientation = options.orientation;
25
+ this.secondStep = options.secondStep;
26
+ this.showInputs = options.showInputs;
27
+ this.showMeridian = options.showMeridian;
28
+ this.showSeconds = options.showSeconds;
29
+ this.template = options.template;
30
+ this.appendWidgetTo = options.appendWidgetTo;
31
+ this.showWidgetOnAddonClick = options.showWidgetOnAddonClick;
32
+
33
+ this._init();
34
+ };
35
+
36
+ Timepicker.prototype = {
37
+
38
+ constructor: Timepicker,
39
+ _init: function() {
40
+ var self = this;
41
+
42
+ if (this.showWidgetOnAddonClick && (this.$element.parent().hasClass('input-append') || this.$element.parent().hasClass('input-prepend'))) {
43
+ this.$element.parent('.input-append, .input-prepend').find('.add-on').on({
44
+ 'click.timepicker': $.proxy(this.showWidget, this)
45
+ });
46
+ this.$element.on({
47
+ 'focus.timepicker': $.proxy(this.highlightUnit, this),
48
+ 'click.timepicker': $.proxy(this.highlightUnit, this),
49
+ 'keydown.timepicker': $.proxy(this.elementKeydown, this),
50
+ 'blur.timepicker': $.proxy(this.blurElement, this),
51
+ 'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this)
52
+ });
53
+ } else {
54
+ if (this.template) {
55
+ this.$element.on({
56
+ 'focus.timepicker': $.proxy(this.showWidget, this),
57
+ 'click.timepicker': $.proxy(this.showWidget, this),
58
+ 'blur.timepicker': $.proxy(this.blurElement, this),
59
+ 'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this)
60
+ });
61
+ } else {
62
+ this.$element.on({
63
+ 'focus.timepicker': $.proxy(this.highlightUnit, this),
64
+ 'click.timepicker': $.proxy(this.highlightUnit, this),
65
+ 'keydown.timepicker': $.proxy(this.elementKeydown, this),
66
+ 'blur.timepicker': $.proxy(this.blurElement, this),
67
+ 'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this)
68
+ });
69
+ }
70
+ }
71
+
72
+ if (this.template !== false) {
73
+ this.$widget = $(this.getTemplate()).on('click', $.proxy(this.widgetClick, this));
74
+ } else {
75
+ this.$widget = false;
76
+ }
77
+
78
+ if (this.showInputs && this.$widget !== false) {
79
+ this.$widget.find('input').each(function() {
80
+ $(this).on({
81
+ 'click.timepicker': function() { $(this).select(); },
82
+ 'keydown.timepicker': $.proxy(self.widgetKeydown, self),
83
+ 'keyup.timepicker': $.proxy(self.widgetKeyup, self)
84
+ });
85
+ });
86
+ }
87
+
88
+ this.setDefaultTime(this.defaultTime);
89
+ },
90
+
91
+ blurElement: function() {
92
+ this.highlightedUnit = null;
93
+ this.updateFromElementVal();
94
+ },
95
+
96
+ clear: function() {
97
+ this.hour = '';
98
+ this.minute = '';
99
+ this.second = '';
100
+ this.meridian = '';
101
+
102
+ this.$element.val('');
103
+ },
104
+
105
+ decrementHour: function() {
106
+ if (this.showMeridian) {
107
+ if (this.hour === 1) {
108
+ this.hour = 12;
109
+ } else if (this.hour === 12) {
110
+ this.hour--;
111
+
112
+ return this.toggleMeridian();
113
+ } else if (this.hour === 0) {
114
+ this.hour = 11;
115
+
116
+ return this.toggleMeridian();
117
+ } else {
118
+ this.hour--;
119
+ }
120
+ } else {
121
+ if (this.hour <= 0) {
122
+ this.hour = 23;
123
+ } else {
124
+ this.hour--;
125
+ }
126
+ }
127
+ },
128
+
129
+ decrementMinute: function(step) {
130
+ var newVal;
131
+
132
+ if (step) {
133
+ newVal = this.minute - step;
134
+ } else {
135
+ newVal = this.minute - this.minuteStep;
136
+ }
137
+
138
+ if (newVal < 0) {
139
+ this.decrementHour();
140
+ this.minute = newVal + 60;
141
+ } else {
142
+ this.minute = newVal;
143
+ }
144
+ },
145
+
146
+ decrementSecond: function() {
147
+ var newVal = this.second - this.secondStep;
148
+
149
+ if (newVal < 0) {
150
+ this.decrementMinute(true);
151
+ this.second = newVal + 60;
152
+ } else {
153
+ this.second = newVal;
154
+ }
155
+ },
156
+
157
+ elementKeydown: function(e) {
158
+ switch (e.keyCode) {
159
+ case 9: //tab
160
+ case 27: // escape
161
+ this.updateFromElementVal();
162
+ break;
163
+ case 37: // left arrow
164
+ e.preventDefault();
165
+ this.highlightPrevUnit();
166
+ break;
167
+ case 38: // up arrow
168
+ e.preventDefault();
169
+ switch (this.highlightedUnit) {
170
+ case 'hour':
171
+ this.incrementHour();
172
+ this.highlightHour();
173
+ break;
174
+ case 'minute':
175
+ this.incrementMinute();
176
+ this.highlightMinute();
177
+ break;
178
+ case 'second':
179
+ this.incrementSecond();
180
+ this.highlightSecond();
181
+ break;
182
+ case 'meridian':
183
+ this.toggleMeridian();
184
+ this.highlightMeridian();
185
+ break;
186
+ }
187
+ this.update();
188
+ break;
189
+ case 39: // right arrow
190
+ e.preventDefault();
191
+ this.highlightNextUnit();
192
+ break;
193
+ case 40: // down arrow
194
+ e.preventDefault();
195
+ switch (this.highlightedUnit) {
196
+ case 'hour':
197
+ this.decrementHour();
198
+ this.highlightHour();
199
+ break;
200
+ case 'minute':
201
+ this.decrementMinute();
202
+ this.highlightMinute();
203
+ break;
204
+ case 'second':
205
+ this.decrementSecond();
206
+ this.highlightSecond();
207
+ break;
208
+ case 'meridian':
209
+ this.toggleMeridian();
210
+ this.highlightMeridian();
211
+ break;
212
+ }
213
+
214
+ this.update();
215
+ break;
216
+ }
217
+ },
218
+
219
+ getCursorPosition: function() {
220
+ var input = this.$element.get(0);
221
+
222
+ if ('selectionStart' in input) {// Standard-compliant browsers
223
+
224
+ return input.selectionStart;
225
+ } else if (document.selection) {// IE fix
226
+ input.focus();
227
+ var sel = document.selection.createRange(),
228
+ selLen = document.selection.createRange().text.length;
229
+
230
+ sel.moveStart('character', - input.value.length);
231
+
232
+ return sel.text.length - selLen;
233
+ }
234
+ },
235
+
236
+ getTemplate: function() {
237
+ var template,
238
+ hourTemplate,
239
+ minuteTemplate,
240
+ secondTemplate,
241
+ meridianTemplate,
242
+ templateContent;
243
+
244
+ if (this.showInputs) {
245
+ hourTemplate = '<input type="text" class="bootstrap-timepicker-hour" maxlength="2"/>';
246
+ minuteTemplate = '<input type="text" class="bootstrap-timepicker-minute" maxlength="2"/>';
247
+ secondTemplate = '<input type="text" class="bootstrap-timepicker-second" maxlength="2"/>';
248
+ meridianTemplate = '<input type="text" class="bootstrap-timepicker-meridian" maxlength="2"/>';
249
+ } else {
250
+ hourTemplate = '<span class="bootstrap-timepicker-hour"></span>';
251
+ minuteTemplate = '<span class="bootstrap-timepicker-minute"></span>';
252
+ secondTemplate = '<span class="bootstrap-timepicker-second"></span>';
253
+ meridianTemplate = '<span class="bootstrap-timepicker-meridian"></span>';
254
+ }
255
+
256
+ templateContent = '<table>'+
257
+ '<tr>'+
258
+ '<td><a href="#" data-action="incrementHour"><i class="fa fa-chevron-up"></i></a></td>'+
259
+ '<td class="separator">&nbsp;</td>'+
260
+ '<td><a href="#" data-action="incrementMinute"><i class="fa fa-chevron-up"></i></a></td>'+
261
+ (this.showSeconds ?
262
+ '<td class="separator">&nbsp;</td>'+
263
+ '<td><a href="#" data-action="incrementSecond"><i class="fa fa-chevron-up"></i></a></td>'
264
+ : '') +
265
+ (this.showMeridian ?
266
+ '<td class="separator">&nbsp;</td>'+
267
+ '<td class="meridian-column"><a href="#" data-action="toggleMeridian"><i class="fa fa-chevron-up"></i></a></td>'
268
+ : '') +
269
+ '</tr>'+
270
+ '<tr>'+
271
+ '<td>'+ hourTemplate +'</td> '+
272
+ '<td class="separator">:</td>'+
273
+ '<td>'+ minuteTemplate +'</td> '+
274
+ (this.showSeconds ?
275
+ '<td class="separator">:</td>'+
276
+ '<td>'+ secondTemplate +'</td>'
277
+ : '') +
278
+ (this.showMeridian ?
279
+ '<td class="separator">&nbsp;</td>'+
280
+ '<td>'+ meridianTemplate +'</td>'
281
+ : '') +
282
+ '</tr>'+
283
+ '<tr>'+
284
+ '<td><a href="#" data-action="decrementHour"><i class="fa fa-chevron-down"></i></a></td>'+
285
+ '<td class="separator"></td>'+
286
+ '<td><a href="#" data-action="decrementMinute"><i class="fa fa-chevron-down"></i></a></td>'+
287
+ (this.showSeconds ?
288
+ '<td class="separator">&nbsp;</td>'+
289
+ '<td><a href="#" data-action="decrementSecond"><i class="fa fa-chevron-down"></i></a></td>'
290
+ : '') +
291
+ (this.showMeridian ?
292
+ '<td class="separator">&nbsp;</td>'+
293
+ '<td><a href="#" data-action="toggleMeridian"><i class="fa fa-chevron-down"></i></a></td>'
294
+ : '') +
295
+ '</tr>'+
296
+ '</table>';
297
+
298
+ switch(this.template) {
299
+ case 'modal':
300
+ template = '<div class="bootstrap-timepicker-widget modal hide fade in" data-backdrop="'+ (this.modalBackdrop ? 'true' : 'false') +'">'+
301
+ '<div class="modal-header">'+
302
+ '<a href="#" class="close" data-dismiss="modal">×</a>'+
303
+ '<h3>Pick a Time</h3>'+
304
+ '</div>'+
305
+ '<div class="modal-content">'+
306
+ templateContent +
307
+ '</div>'+
308
+ '<div class="modal-footer">'+
309
+ '<a href="#" class="btn btn-default" data-dismiss="modal">OK</a>'+
310
+ '</div>'+
311
+ '</div>';
312
+ break;
313
+ case 'dropdown':
314
+ template = '<div class="bootstrap-timepicker-widget dropdown-menu">'+ templateContent +'</div>';
315
+ break;
316
+ }
317
+
318
+ return template;
319
+ },
320
+
321
+ getTime: function() {
322
+ if (this.hour === '') {
323
+ return '';
324
+ }
325
+
326
+ return this.hour + ':' + (this.minute.toString().length === 1 ? '0' + this.minute : this.minute) + (this.showSeconds ? ':' + (this.second.toString().length === 1 ? '0' + this.second : this.second) : '') + (this.showMeridian ? ' ' + this.meridian : '');
327
+ },
328
+
329
+ hideWidget: function() {
330
+ if (this.isOpen === false) {
331
+ return;
332
+ }
333
+
334
+ this.$element.trigger({
335
+ 'type': 'hide.timepicker',
336
+ 'time': {
337
+ 'value': this.getTime(),
338
+ 'hours': this.hour,
339
+ 'minutes': this.minute,
340
+ 'seconds': this.second,
341
+ 'meridian': this.meridian
342
+ }
343
+ });
344
+
345
+ if (this.template === 'modal' && this.$widget.modal) {
346
+ this.$widget.modal('hide');
347
+ } else {
348
+ this.$widget.removeClass('open');
349
+ }
350
+
351
+ $(document).off('mousedown.timepicker, touchend.timepicker');
352
+
353
+ this.isOpen = false;
354
+ // show/hide approach taken by datepicker
355
+ this.$widget.detach();
356
+ },
357
+
358
+ highlightUnit: function() {
359
+ this.position = this.getCursorPosition();
360
+ if (this.position >= 0 && this.position <= 2) {
361
+ this.highlightHour();
362
+ } else if (this.position >= 3 && this.position <= 5) {
363
+ this.highlightMinute();
364
+ } else if (this.position >= 6 && this.position <= 8) {
365
+ if (this.showSeconds) {
366
+ this.highlightSecond();
367
+ } else {
368
+ this.highlightMeridian();
369
+ }
370
+ } else if (this.position >= 9 && this.position <= 11) {
371
+ this.highlightMeridian();
372
+ }
373
+ },
374
+
375
+ highlightNextUnit: function() {
376
+ switch (this.highlightedUnit) {
377
+ case 'hour':
378
+ this.highlightMinute();
379
+ break;
380
+ case 'minute':
381
+ if (this.showSeconds) {
382
+ this.highlightSecond();
383
+ } else if (this.showMeridian){
384
+ this.highlightMeridian();
385
+ } else {
386
+ this.highlightHour();
387
+ }
388
+ break;
389
+ case 'second':
390
+ if (this.showMeridian) {
391
+ this.highlightMeridian();
392
+ } else {
393
+ this.highlightHour();
394
+ }
395
+ break;
396
+ case 'meridian':
397
+ this.highlightHour();
398
+ break;
399
+ }
400
+ },
401
+
402
+ highlightPrevUnit: function() {
403
+ switch (this.highlightedUnit) {
404
+ case 'hour':
405
+ if(this.showMeridian){
406
+ this.highlightMeridian();
407
+ } else if (this.showSeconds) {
408
+ this.highlightSecond();
409
+ } else {
410
+ this.highlightMinute();
411
+ }
412
+ break;
413
+ case 'minute':
414
+ this.highlightHour();
415
+ break;
416
+ case 'second':
417
+ this.highlightMinute();
418
+ break;
419
+ case 'meridian':
420
+ if (this.showSeconds) {
421
+ this.highlightSecond();
422
+ } else {
423
+ this.highlightMinute();
424
+ }
425
+ break;
426
+ }
427
+ },
428
+
429
+ highlightHour: function() {
430
+ var $element = this.$element.get(0),
431
+ self = this;
432
+
433
+ this.highlightedUnit = 'hour';
434
+
435
+ if ($element.setSelectionRange) {
436
+ setTimeout(function() {
437
+ if (self.hour < 10) {
438
+ $element.setSelectionRange(0,1);
439
+ } else {
440
+ $element.setSelectionRange(0,2);
441
+ }
442
+ }, 0);
443
+ }
444
+ },
445
+
446
+ highlightMinute: function() {
447
+ var $element = this.$element.get(0),
448
+ self = this;
449
+
450
+ this.highlightedUnit = 'minute';
451
+
452
+ if ($element.setSelectionRange) {
453
+ setTimeout(function() {
454
+ if (self.hour < 10) {
455
+ $element.setSelectionRange(2,4);
456
+ } else {
457
+ $element.setSelectionRange(3,5);
458
+ }
459
+ }, 0);
460
+ }
461
+ },
462
+
463
+ highlightSecond: function() {
464
+ var $element = this.$element.get(0),
465
+ self = this;
466
+
467
+ this.highlightedUnit = 'second';
468
+
469
+ if ($element.setSelectionRange) {
470
+ setTimeout(function() {
471
+ if (self.hour < 10) {
472
+ $element.setSelectionRange(5,7);
473
+ } else {
474
+ $element.setSelectionRange(6,8);
475
+ }
476
+ }, 0);
477
+ }
478
+ },
479
+
480
+ highlightMeridian: function() {
481
+ var $element = this.$element.get(0),
482
+ self = this;
483
+
484
+ this.highlightedUnit = 'meridian';
485
+
486
+ if ($element.setSelectionRange) {
487
+ if (this.showSeconds) {
488
+ setTimeout(function() {
489
+ if (self.hour < 10) {
490
+ $element.setSelectionRange(8,10);
491
+ } else {
492
+ $element.setSelectionRange(9,11);
493
+ }
494
+ }, 0);
495
+ } else {
496
+ setTimeout(function() {
497
+ if (self.hour < 10) {
498
+ $element.setSelectionRange(5,7);
499
+ } else {
500
+ $element.setSelectionRange(6,8);
501
+ }
502
+ }, 0);
503
+ }
504
+ }
505
+ },
506
+
507
+ incrementHour: function() {
508
+ if (this.showMeridian) {
509
+ if (this.hour === 11) {
510
+ this.hour++;
511
+ return this.toggleMeridian();
512
+ } else if (this.hour === 12) {
513
+ this.hour = 0;
514
+ }
515
+ }
516
+ if (this.hour === 23) {
517
+ this.hour = 0;
518
+
519
+ return;
520
+ }
521
+ this.hour++;
522
+ },
523
+
524
+ incrementMinute: function(step) {
525
+ var newVal;
526
+
527
+ if (step) {
528
+ newVal = this.minute + step;
529
+ } else {
530
+ newVal = this.minute + this.minuteStep - (this.minute % this.minuteStep);
531
+ }
532
+
533
+ if (newVal > 59) {
534
+ this.incrementHour();
535
+ this.minute = newVal - 60;
536
+ } else {
537
+ this.minute = newVal;
538
+ }
539
+ },
540
+
541
+ incrementSecond: function() {
542
+ var newVal = this.second + this.secondStep - (this.second % this.secondStep);
543
+
544
+ if (newVal > 59) {
545
+ this.incrementMinute(true);
546
+ this.second = newVal - 60;
547
+ } else {
548
+ this.second = newVal;
549
+ }
550
+ },
551
+
552
+ mousewheel: function(e) {
553
+ if (this.disableMousewheel) {
554
+ return;
555
+ }
556
+
557
+ e.preventDefault();
558
+ e.stopPropagation();
559
+
560
+ var delta = e.originalEvent.wheelDelta || -e.originalEvent.detail,
561
+ scrollTo = null;
562
+
563
+ if (e.type === 'mousewheel') {
564
+ scrollTo = (e.originalEvent.wheelDelta * -1);
565
+ }
566
+ else if (e.type === 'DOMMouseScroll') {
567
+ scrollTo = 40 * e.originalEvent.detail;
568
+ }
569
+
570
+ if (scrollTo) {
571
+ e.preventDefault();
572
+ $(this).scrollTop(scrollTo + $(this).scrollTop());
573
+ }
574
+
575
+ switch (this.highlightedUnit) {
576
+ case 'minute':
577
+ if (delta > 0) {
578
+ this.incrementMinute();
579
+ } else {
580
+ this.decrementMinute();
581
+ }
582
+ this.highlightMinute();
583
+ break;
584
+ case 'second':
585
+ if (delta > 0) {
586
+ this.incrementSecond();
587
+ } else {
588
+ this.decrementSecond();
589
+ }
590
+ this.highlightSecond();
591
+ break;
592
+ case 'meridian':
593
+ this.toggleMeridian();
594
+ this.highlightMeridian();
595
+ break;
596
+ default:
597
+ if (delta > 0) {
598
+ this.incrementHour();
599
+ } else {
600
+ this.decrementHour();
601
+ }
602
+ this.highlightHour();
603
+ break;
604
+ }
605
+
606
+ return false;
607
+ },
608
+
609
+ // This method was adapted from bootstrap-datepicker.
610
+ place : function() {
611
+ if (this.isInline) {
612
+ return;
613
+ }
614
+ var widgetWidth = this.$widget.outerWidth(), widgetHeight = this.$widget.outerHeight(), visualPadding = 10, windowWidth =
615
+ $(window).width(), windowHeight = $(window).height(), scrollTop = $(window).scrollTop();
616
+
617
+ var zIndex = parseInt(this.$element.parents().filter(function() {}).first().css('z-index'), 10) + 10;
618
+ var offset = this.component ? this.component.parent().offset() : this.$element.offset();
619
+ var height = this.component ? this.component.outerHeight(true) : this.$element.outerHeight(false);
620
+ var width = this.component ? this.component.outerWidth(true) : this.$element.outerWidth(false);
621
+ var left = offset.left, top = offset.top;
622
+
623
+ this.$widget.removeClass('timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left');
624
+
625
+ if (this.orientation.x !== 'auto') {
626
+ this.picker.addClass('datepicker-orient-' + this.orientation.x);
627
+ if (this.orientation.x === 'right') {
628
+ left -= widgetWidth - width;
629
+ }
630
+ } else{
631
+ // auto x orientation is best-placement: if it crosses a window edge, fudge it sideways
632
+ // Default to left
633
+ this.$widget.addClass('timepicker-orient-left');
634
+ if (offset.left < 0) {
635
+ left -= offset.left - visualPadding;
636
+ } else if (offset.left + widgetWidth > windowWidth) {
637
+ left = windowWidth - widgetWidth - visualPadding;
638
+ }
639
+ }
640
+ // auto y orientation is best-situation: top or bottom, no fudging, decision based on which shows more of the widget
641
+ var yorient = this.orientation.y, topOverflow, bottomOverflow;
642
+ if (yorient === 'auto') {
643
+ topOverflow = -scrollTop + offset.top - widgetHeight;
644
+ bottomOverflow = scrollTop + windowHeight - (offset.top + height + widgetHeight);
645
+ if (Math.max(topOverflow, bottomOverflow) === bottomOverflow) {
646
+ yorient = 'top';
647
+ } else {
648
+ yorient = 'bottom';
649
+ }
650
+ }
651
+ this.$widget.addClass('timepicker-orient-' + yorient);
652
+ if (yorient === 'top'){
653
+ top += height;
654
+ } else{
655
+ top -= widgetHeight + parseInt(this.$widget.css('padding-top'), 10);
656
+ }
657
+
658
+ this.$widget.css({
659
+ top : top,
660
+ left : left,
661
+ zIndex : zIndex
662
+ });
663
+ },
664
+
665
+ remove: function() {
666
+ $('document').off('.timepicker');
667
+ if (this.$widget) {
668
+ this.$widget.remove();
669
+ }
670
+ delete this.$element.data().timepicker;
671
+ },
672
+
673
+ setDefaultTime: function(defaultTime) {
674
+ if (!this.$element.val()) {
675
+ if (defaultTime === 'current') {
676
+ var dTime = new Date(),
677
+ hours = dTime.getHours(),
678
+ minutes = dTime.getMinutes(),
679
+ seconds = dTime.getSeconds(),
680
+ meridian = 'AM';
681
+
682
+ if (seconds !== 0) {
683
+ seconds = Math.ceil(dTime.getSeconds() / this.secondStep) * this.secondStep;
684
+ if (seconds === 60) {
685
+ minutes += 1;
686
+ seconds = 0;
687
+ }
688
+ }
689
+
690
+ if (minutes !== 0) {
691
+ minutes = Math.ceil(dTime.getMinutes() / this.minuteStep) * this.minuteStep;
692
+ if (minutes === 60) {
693
+ hours += 1;
694
+ minutes = 0;
695
+ }
696
+ }
697
+
698
+ if (this.showMeridian) {
699
+ if (hours === 0) {
700
+ hours = 12;
701
+ } else if (hours >= 12) {
702
+ if (hours > 12) {
703
+ hours = hours - 12;
704
+ }
705
+ meridian = 'PM';
706
+ } else {
707
+ meridian = 'AM';
708
+ }
709
+ }
710
+
711
+ this.hour = hours;
712
+ this.minute = minutes;
713
+ this.second = seconds;
714
+ this.meridian = meridian;
715
+
716
+ this.update();
717
+
718
+ } else if (defaultTime === false) {
719
+ this.hour = 0;
720
+ this.minute = 0;
721
+ this.second = 0;
722
+ this.meridian = 'AM';
723
+ } else {
724
+ this.setTime(defaultTime);
725
+ }
726
+ } else {
727
+ this.updateFromElementVal();
728
+ }
729
+ },
730
+
731
+ setTime: function(time, ignoreWidget) {
732
+ if (!time) {
733
+ this.clear();
734
+ return;
735
+ }
736
+
737
+ var timeArray,
738
+ hour,
739
+ minute,
740
+ second,
741
+ meridian;
742
+
743
+ if (typeof time === 'object' && time.getMonth){
744
+ // this is a date object
745
+ hour = time.getHours();
746
+ minute = time.getMinutes();
747
+ second = time.getSeconds();
748
+
749
+ if (this.showMeridian){
750
+ meridian = 'AM';
751
+ if (hour > 12){
752
+ meridian = 'PM';
753
+ hour = hour % 12;
754
+ }
755
+
756
+ if (hour === 12){
757
+ meridian = 'PM';
758
+ }
759
+ }
760
+ } else {
761
+ if (time.match(/p/i) !== null) {
762
+ meridian = 'PM';
763
+ } else {
764
+ meridian = 'AM';
765
+ }
766
+
767
+ time = time.replace(/[^0-9\:]/g, '');
768
+
769
+ timeArray = time.split(':');
770
+
771
+ hour = timeArray[0] ? timeArray[0].toString() : timeArray.toString();
772
+ minute = timeArray[1] ? timeArray[1].toString() : '';
773
+ second = timeArray[2] ? timeArray[2].toString() : '';
774
+
775
+ // idiot proofing
776
+ if (hour.length > 4) {
777
+ second = hour.substr(4, 2);
778
+ }
779
+ if (hour.length > 2) {
780
+ minute = hour.substr(2, 2);
781
+ hour = hour.substr(0, 2);
782
+ }
783
+ if (minute.length > 2) {
784
+ second = minute.substr(2, 2);
785
+ minute = minute.substr(0, 2);
786
+ }
787
+ if (second.length > 2) {
788
+ second = second.substr(2, 2);
789
+ }
790
+
791
+ hour = parseInt(hour, 10);
792
+ minute = parseInt(minute, 10);
793
+ second = parseInt(second, 10);
794
+
795
+ if (isNaN(hour)) {
796
+ hour = 0;
797
+ }
798
+ if (isNaN(minute)) {
799
+ minute = 0;
800
+ }
801
+ if (isNaN(second)) {
802
+ second = 0;
803
+ }
804
+
805
+ if (this.showMeridian) {
806
+ if (hour < 1) {
807
+ hour = 1;
808
+ } else if (hour > 12) {
809
+ hour = 12;
810
+ }
811
+ } else {
812
+ if (hour >= 24) {
813
+ hour = 23;
814
+ } else if (hour < 0) {
815
+ hour = 0;
816
+ }
817
+ if (hour < 13 && meridian === 'PM') {
818
+ hour = hour + 12;
819
+ }
820
+ }
821
+
822
+ if (minute < 0) {
823
+ minute = 0;
824
+ } else if (minute >= 60) {
825
+ minute = 59;
826
+ }
827
+
828
+ if (this.showSeconds) {
829
+ if (isNaN(second)) {
830
+ second = 0;
831
+ } else if (second < 0) {
832
+ second = 0;
833
+ } else if (second >= 60) {
834
+ second = 59;
835
+ }
836
+ }
837
+ }
838
+
839
+ this.hour = hour;
840
+ this.minute = minute;
841
+ this.second = second;
842
+ this.meridian = meridian;
843
+
844
+ this.update(ignoreWidget);
845
+ },
846
+
847
+ showWidget: function() {
848
+ if (this.isOpen) {
849
+ return;
850
+ }
851
+
852
+ if (this.$element.is(':disabled')) {
853
+ return;
854
+ }
855
+
856
+ // show/hide approach taken by datepicker
857
+ this.$widget.appendTo(this.appendWidgetTo);
858
+ var self = this;
859
+ $(document).on('mousedown.timepicker, touchend.timepicker', function (e) {
860
+ // This condition was inspired by bootstrap-datepicker.
861
+ // The element the timepicker is invoked on is the input but it has a sibling for addon/button.
862
+ if (!(self.$element.parent().find(e.target).length ||
863
+ self.$widget.is(e.target) ||
864
+ self.$widget.find(e.target).length)) {
865
+ self.hideWidget();
866
+ }
867
+ });
868
+
869
+ this.$element.trigger({
870
+ 'type': 'show.timepicker',
871
+ 'time': {
872
+ 'value': this.getTime(),
873
+ 'hours': this.hour,
874
+ 'minutes': this.minute,
875
+ 'seconds': this.second,
876
+ 'meridian': this.meridian
877
+ }
878
+ });
879
+
880
+ this.place();
881
+ if (this.disableFocus) {
882
+ this.$element.blur();
883
+ }
884
+
885
+ // widget shouldn't be empty on open
886
+ if (this.hour === '') {
887
+ if (this.defaultTime) {
888
+ this.setDefaultTime(this.defaultTime);
889
+ } else {
890
+ this.setTime('0:0:0');
891
+ }
892
+ }
893
+
894
+ if (this.template === 'modal' && this.$widget.modal) {
895
+ this.$widget.modal('show').on('hidden', $.proxy(this.hideWidget, this));
896
+ } else {
897
+ if (this.isOpen === false) {
898
+ this.$widget.addClass('open');
899
+ }
900
+ }
901
+
902
+ this.isOpen = true;
903
+ },
904
+
905
+ toggleMeridian: function() {
906
+ this.meridian = this.meridian === 'AM' ? 'PM' : 'AM';
907
+ },
908
+
909
+ update: function(ignoreWidget) {
910
+ this.updateElement();
911
+ if (!ignoreWidget) {
912
+ this.updateWidget();
913
+ }
914
+
915
+ this.$element.trigger({
916
+ 'type': 'changeTime.timepicker',
917
+ 'time': {
918
+ 'value': this.getTime(),
919
+ 'hours': this.hour,
920
+ 'minutes': this.minute,
921
+ 'seconds': this.second,
922
+ 'meridian': this.meridian
923
+ }
924
+ });
925
+ },
926
+
927
+ updateElement: function() {
928
+ this.$element.val(this.getTime()).change();
929
+ },
930
+
931
+ updateFromElementVal: function() {
932
+ this.setTime(this.$element.val());
933
+ },
934
+
935
+ updateWidget: function() {
936
+ if (this.$widget === false) {
937
+ return;
938
+ }
939
+
940
+ var hour = this.hour,
941
+ minute = this.minute.toString().length === 1 ? '0' + this.minute : this.minute,
942
+ second = this.second.toString().length === 1 ? '0' + this.second : this.second;
943
+
944
+ if (this.showInputs) {
945
+ this.$widget.find('input.bootstrap-timepicker-hour').val(hour);
946
+ this.$widget.find('input.bootstrap-timepicker-minute').val(minute);
947
+
948
+ if (this.showSeconds) {
949
+ this.$widget.find('input.bootstrap-timepicker-second').val(second);
950
+ }
951
+ if (this.showMeridian) {
952
+ this.$widget.find('input.bootstrap-timepicker-meridian').val(this.meridian);
953
+ }
954
+ } else {
955
+ this.$widget.find('span.bootstrap-timepicker-hour').text(hour);
956
+ this.$widget.find('span.bootstrap-timepicker-minute').text(minute);
957
+
958
+ if (this.showSeconds) {
959
+ this.$widget.find('span.bootstrap-timepicker-second').text(second);
960
+ }
961
+ if (this.showMeridian) {
962
+ this.$widget.find('span.bootstrap-timepicker-meridian').text(this.meridian);
963
+ }
964
+ }
965
+ },
966
+
967
+ updateFromWidgetInputs: function() {
968
+ if (this.$widget === false) {
969
+ return;
970
+ }
971
+
972
+ var t = this.$widget.find('input.bootstrap-timepicker-hour').val() + ':' +
973
+ this.$widget.find('input.bootstrap-timepicker-minute').val() +
974
+ (this.showSeconds ? ':' + this.$widget.find('input.bootstrap-timepicker-second').val() : '') +
975
+ (this.showMeridian ? this.$widget.find('input.bootstrap-timepicker-meridian').val() : '')
976
+ ;
977
+
978
+ this.setTime(t, true);
979
+ },
980
+
981
+ widgetClick: function(e) {
982
+ e.stopPropagation();
983
+ e.preventDefault();
984
+
985
+ var $input = $(e.target),
986
+ action = $input.closest('a').data('action');
987
+
988
+ if (action) {
989
+ this[action]();
990
+ }
991
+ this.update();
992
+
993
+ if ($input.is('input')) {
994
+ $input.get(0).setSelectionRange(0,2);
995
+ }
996
+ },
997
+
998
+ widgetKeydown: function(e) {
999
+ var $input = $(e.target),
1000
+ name = $input.attr('class').replace('bootstrap-timepicker-', '');
1001
+
1002
+ switch (e.keyCode) {
1003
+ case 9: //tab
1004
+ if ((this.showMeridian && name === 'meridian') || (this.showSeconds && name === 'second') || (!this.showMeridian && !this.showSeconds && name === 'minute')) {
1005
+ return this.hideWidget();
1006
+ }
1007
+ break;
1008
+ case 27: // escape
1009
+ this.hideWidget();
1010
+ break;
1011
+ case 38: // up arrow
1012
+ e.preventDefault();
1013
+ switch (name) {
1014
+ case 'hour':
1015
+ this.incrementHour();
1016
+ break;
1017
+ case 'minute':
1018
+ this.incrementMinute();
1019
+ break;
1020
+ case 'second':
1021
+ this.incrementSecond();
1022
+ break;
1023
+ case 'meridian':
1024
+ this.toggleMeridian();
1025
+ break;
1026
+ }
1027
+ this.setTime(this.getTime());
1028
+ $input.get(0).setSelectionRange(0,2);
1029
+ break;
1030
+ case 40: // down arrow
1031
+ e.preventDefault();
1032
+ switch (name) {
1033
+ case 'hour':
1034
+ this.decrementHour();
1035
+ break;
1036
+ case 'minute':
1037
+ this.decrementMinute();
1038
+ break;
1039
+ case 'second':
1040
+ this.decrementSecond();
1041
+ break;
1042
+ case 'meridian':
1043
+ this.toggleMeridian();
1044
+ break;
1045
+ }
1046
+ this.setTime(this.getTime());
1047
+ $input.get(0).setSelectionRange(0,2);
1048
+ break;
1049
+ }
1050
+ },
1051
+
1052
+ widgetKeyup: function(e) {
1053
+ if ((e.keyCode === 65) || (e.keyCode === 77) || (e.keyCode === 80) || (e.keyCode === 46) || (e.keyCode === 8) || (e.keyCode >= 46 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) {
1054
+ this.updateFromWidgetInputs();
1055
+ }
1056
+ }
1057
+ };
1058
+
1059
+ //TIMEPICKER PLUGIN DEFINITION
1060
+ $.fn.timepicker = function(option) {
1061
+ var args = Array.apply(null, arguments);
1062
+ args.shift();
1063
+ return this.each(function() {
1064
+ var $this = $(this),
1065
+ data = $this.data('timepicker'),
1066
+ options = typeof option === 'object' && option;
1067
+
1068
+ if (!data) {
1069
+ $this.data('timepicker', (data = new Timepicker(this, $.extend({}, $.fn.timepicker.defaults, options, $(this).data()))));
1070
+ }
1071
+
1072
+ if (typeof option === 'string') {
1073
+ data[option].apply(data, args);
1074
+ }
1075
+ });
1076
+ };
1077
+
1078
+ $.fn.timepicker.defaults = {
1079
+ defaultTime: 'current',
1080
+ disableFocus: false,
1081
+ disableMousewheel: false,
1082
+ isOpen: false,
1083
+ minuteStep: 15,
1084
+ modalBackdrop: false,
1085
+ orientation: { x: 'auto', y: 'auto'},
1086
+ secondStep: 15,
1087
+ showSeconds: false,
1088
+ showInputs: true,
1089
+ showMeridian: true,
1090
+ template: 'dropdown',
1091
+ appendWidgetTo: 'body',
1092
+ showWidgetOnAddonClick: true
1093
+ };
1094
+
1095
+ $.fn.timepicker.Constructor = Timepicker;
1096
+
1097
+ })(jQuery, window, document);