think_feel_do_engine 3.10.10 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/think_feel_do_engine/application_controller.rb +1 -1
- data/app/models/content_providers/gratitude_recordings/index_provider.rb +27 -0
- data/app/models/content_providers/gratitude_recordings/new_provider.rb +27 -0
- data/app/models/gratitude_recording.rb +5 -0
- data/app/models/participant.rb +1 -0
- data/app/models/tools/gratitude_recordings.rb +6 -0
- data/app/views/think_feel_do_engine/gratitude_recordings/index_provider.html.erb +16 -0
- data/app/views/think_feel_do_engine/gratitude_recordings/new_provider.html.erb +27 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20160203222002_create_gratitude_recordings.rb +12 -0
- data/lib/think_feel_do_engine/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e1ac33a734c1c0db5857c3b5511b1daa845be98
|
4
|
+
data.tar.gz: 523bbc794724e191870af113efab4fec6429343e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9aa80980ba99b150eb58e9dc43adfac773ab6a592e6b83aace7e7505c32a12168b15f22ecd6c00e8123b7048553ec0076446b393d6a75230535805b369c6758
|
7
|
+
data.tar.gz: 43f50962c7dffbe04363731baf738ac7117fe09ef661b2f53408f6da77ccac371106f42325b1a0fbfbf339a6c438f38355ac3fe628ea1aad0d69cfe0c9bae079
|
@@ -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
|
data/app/models/participant.rb
CHANGED
@@ -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,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: [
|
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
|
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.
|
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-
|
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
|