think_feel_do_engine 3.10.10 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 260af006064a8d3f4c26190f294125f61d59bda7
4
- data.tar.gz: 8e2d0651076729f5961ad5cd01567c5cb143f113
3
+ metadata.gz: 9e1ac33a734c1c0db5857c3b5511b1daa845be98
4
+ data.tar.gz: 523bbc794724e191870af113efab4fec6429343e
5
5
  SHA512:
6
- metadata.gz: 5fd10b328f4c820c2d7f6952e870a4e81ed05233aba03d76fe95475be1b273997788c706e8a2f4348f459800a4c4a1ee624df6b9fe85e7a9871c4814e5db847c
7
- data.tar.gz: ce2c68f6dcf8b7507294c8ab623f113683ae31a4115921d11217a06ab46058523448dafec67ea030d1eb9f87b1924bafbd771e4b81120227d49caaea76ec78cf
6
+ metadata.gz: e9aa80980ba99b150eb58e9dc43adfac773ab6a592e6b83aace7e7505c32a12168b15f22ecd6c00e8123b7048553ec0076446b393d6a75230535805b369c6758
7
+ data.tar.gz: 43f50962c7dffbe04363731baf738ac7117fe09ef661b2f53408f6da77ccac371106f42325b1a0fbfbf339a6c438f38355ac3fe628ea1aad0d69cfe0c9bae079
@@ -1,4 +1,4 @@
1
- require "cancan"
1
+ require "cancancan"
2
2
 
3
3
  module ThinkFeelDoEngine
4
4
  # Site-wide controller superclass.
@@ -0,0 +1,27 @@
1
+ module ContentProviders
2
+ module GratitudeRecordings
3
+ # Allows participants to record a new gratitude recording
4
+ class IndexProvider < BitCore::ContentProvider
5
+ def render_current(options)
6
+ options.view_context.render(
7
+ template: "think_feel_do_engine/gratitude_recordings/index_provider",
8
+ locals: {
9
+ new_link: options.view_context.navigator_location_path(
10
+ module_id: first_new_provider
11
+ .try(:bit_core_content_module_id),
12
+ provider_id: first_new_provider
13
+ .try(:id),
14
+ content_position: 1),
15
+ gratitude_recordings: options
16
+ .view_context.current_participant.gratitude_recordings
17
+ })
18
+ end
19
+
20
+ private
21
+
22
+ def first_new_provider
23
+ NewProvider.first
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module ContentProviders
2
+ module GratitudeRecordings
3
+ # Allows participants to record a new gratitude
4
+ class NewProvider < BitCore::ContentProvider
5
+ def data_attributes
6
+ [:description]
7
+ end
8
+
9
+ def data_class_name
10
+ "GratitudeRecording"
11
+ end
12
+
13
+ def render_current(options)
14
+ options.view_context.render(
15
+ template: "think_feel_do_engine/gratitude_recordings/new_provider",
16
+ locals: {
17
+ create_path: options.view_context.participant_data_path,
18
+ participant: options.view_context.current_participant
19
+ })
20
+ end
21
+
22
+ def show_nav_link?
23
+ false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ # Recording of something a participant is grateful for
2
+ class GratitudeRecording < ActiveRecord::Base
3
+ validates :description,
4
+ :participant_id, presence: true
5
+ end
@@ -61,6 +61,7 @@ class Participant < ActiveRecord::Base
61
61
  -> { where(kind: "click") },
62
62
  class_name: "EventCapture::Event",
63
63
  foreign_key: :participant_id
64
+ has_many :gratitude_recordings, dependent: :destroy
64
65
 
65
66
  delegate :end_date, to: :active_membership, prefix: true, allow_nil: true
66
67
 
@@ -0,0 +1,6 @@
1
+ module Tools
2
+ # Tool that records and displays
3
+ # all items a participant is greatful for
4
+ class GratitudeRecordings < BitCore::Tool
5
+ end
6
+ end
@@ -0,0 +1,16 @@
1
+ <h2>Gratitude Recordings</h2>
2
+
3
+ <div class="btn-toolbar">
4
+ <%= link_to "New", new_link, class: "btn btn-primary" %>
5
+ </div>
6
+
7
+ <ul class="list-group">
8
+ <% gratitude_recordings.each do |g| %>
9
+ <li class="list-group-item clearfix">
10
+ <span class="text-muted pull-right">
11
+ <%= g.created_at.to_s(:participant_date) %>
12
+ </span>
13
+ <%= g.description %>
14
+ </li>
15
+ <% end %>
16
+ </ul>
@@ -0,0 +1,27 @@
1
+ <h2>New Gratitude Recording</h2>
2
+
3
+ <%= form_for(participant.gratitude_recordings.build, url: create_path, html: { method: :post, role: :form }) do |f| %>
4
+ <div class="form-group">
5
+ <%= f.label :description, "What were you grateful for today? Or, thinking back, what can you feel grateful for now?", class: "control-label" %>
6
+ <%= f.text_area :description, class: "form-control" %>
7
+
8
+ <a data-toggle="collapse" href="#collapse-gratitude-examples">see some examples</a>
9
+
10
+ <div class="collapse" id="collapse-gratitude-examples">
11
+ <div class="well">
12
+ <ul>
13
+ <li>A person who's done you a favor</li>
14
+ <li>Something you enjoy, like a song or TV show (you can be grateful for the show itself, and also to the people who made it.)</li>
15
+ <li>Things that make life easier or more pleasant - including really simple things, like a warm blanket.</li>
16
+ <li>A pet or friendly animal</li>
17
+ <li>A good friend or close family member, just for being there</li>
18
+ <li>God or a higher power</li>
19
+ <li>Nature in general, or a particular plant, flower, or tree</li>
20
+ <li>Anything else that your're glad to have or experience</li>
21
+ </ul>
22
+ </div>
23
+ </div>
24
+ </div>
25
+
26
+ <%= f.submit t(:next), class: "btn btn-primary" %>
27
+ <% end %>
data/config/routes.rb CHANGED
@@ -59,7 +59,7 @@ ThinkFeelDoEngine::Engine.routes.draw do
59
59
 
60
60
  namespace :coach do
61
61
  resources :phq_assessments
62
- resources :groups, only: [:show] do
62
+ resources :groups, only: [] do
63
63
  resources :messages, only: [:index, :new, :create]
64
64
  resources :patient_dashboards
65
65
  resources :group_dashboard
@@ -0,0 +1,12 @@
1
+ class CreateGratitudeRecordings < ActiveRecord::Migration
2
+ def change
3
+ create_table :gratitude_recordings do |t|
4
+ t.integer :participant_id, null: false
5
+ t.text :description, null: false
6
+
7
+ t.timestamps null: false
8
+ end
9
+
10
+ add_foreign_key :gratitude_recordings, :participants
11
+ end
12
+ end
@@ -1,4 +1,4 @@
1
1
  # nodoc
2
2
  module ThinkFeelDoEngine
3
- VERSION = "3.10.10"
3
+ VERSION = "3.11.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: think_feel_do_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.10
4
+ version: 3.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Carty-Fickes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -441,6 +441,8 @@ files:
441
441
  - app/models/content_providers/edit_past_feel_provider.rb
442
442
  - app/models/content_providers/evaluate_thoughts_provider.rb
443
443
  - app/models/content_providers/fun_activity_checklist.rb
444
+ - app/models/content_providers/gratitude_recordings/index_provider.rb
445
+ - app/models/content_providers/gratitude_recordings/new_provider.rb
444
446
  - app/models/content_providers/harmful_thoughts_edit_form_provider.rb
445
447
  - app/models/content_providers/helpful_thoughts_index_provider.rb
446
448
  - app/models/content_providers/important_activity_checklist.rb
@@ -475,6 +477,7 @@ files:
475
477
  - app/models/emotion.rb
476
478
  - app/models/emotional_rating.rb
477
479
  - app/models/engagement.rb
480
+ - app/models/gratitude_recording.rb
478
481
  - app/models/group.rb
479
482
  - app/models/media_access_event.rb
480
483
  - app/models/membership.rb
@@ -521,6 +524,7 @@ files:
521
524
  - app/models/thought.rb
522
525
  - app/models/thought_pattern.rb
523
526
  - app/models/tool_nav_item.rb
527
+ - app/models/tools/gratitude_recordings.rb
524
528
  - app/models/tools/home.rb
525
529
  - app/models/tools/learn.rb
526
530
  - app/models/tools/messages.rb
@@ -651,6 +655,8 @@ files:
651
655
  - app/views/think_feel_do_engine/emotions/_form.html.erb
652
656
  - app/views/think_feel_do_engine/emotions/index.html.erb
653
657
  - app/views/think_feel_do_engine/emotions/new_current.html.erb
658
+ - app/views/think_feel_do_engine/gratitude_recordings/index_provider.html.erb
659
+ - app/views/think_feel_do_engine/gratitude_recordings/new_provider.html.erb
654
660
  - app/views/think_feel_do_engine/learn/_completion_data.html.erb
655
661
  - app/views/think_feel_do_engine/learn/lessons_index.html.erb
656
662
  - app/views/think_feel_do_engine/lesson_notification_mailer/lesson_notification_email.html.erb
@@ -903,6 +909,7 @@ files:
903
909
  - db/migrate/20150810204045_nullify_empty_thoughts_columns.rb
904
910
  - db/migrate/20150903210028_add_relase_day_not_null_constraint_to_trask.rb
905
911
  - db/migrate/20151104152804_update_think_tool_type_to_tools_think.rb
912
+ - db/migrate/20160203222002_create_gratitude_recordings.rb
906
913
  - lib/tasks/lesson_notifications.rake
907
914
  - lib/tasks/seed.rake
908
915
  - lib/tasks/think_feel_do_engine_tasks.rake