think_feel_do_engine 3.11.0 → 3.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e1ac33a734c1c0db5857c3b5511b1daa845be98
4
- data.tar.gz: 523bbc794724e191870af113efab4fec6429343e
3
+ metadata.gz: c610316f9c19471a999dd44c70b243876b0cb5df
4
+ data.tar.gz: 4863c457916cac39399a06ec5f86c20ae8b60d6a
5
5
  SHA512:
6
- metadata.gz: e9aa80980ba99b150eb58e9dc43adfac773ab6a592e6b83aace7e7505c32a12168b15f22ecd6c00e8123b7048553ec0076446b393d6a75230535805b369c6758
7
- data.tar.gz: 43f50962c7dffbe04363731baf738ac7117fe09ef661b2f53408f6da77ccac371106f42325b1a0fbfbf339a6c438f38355ac3fe628ea1aad0d69cfe0c9bae079
6
+ metadata.gz: 5e4fba71fede93a2bdedeb4478d07b868ad0abbe3497862dd56fa8e1ec43541a6b621426c1f9ff47368d2c5c2f46af15de168079f05def91bd20bf91a0455fd5
7
+ data.tar.gz: 575ae1e4bfd48f1fcddca86b5ee702f004cf543b0ede765822b2d901a1186ec6a6bb56c5700523b409fab5a836575ec4b8bedfe07cc69b641aacf8a3d1a86081
@@ -7,6 +7,9 @@ module ThinkFeelDoEngine
7
7
  def show
8
8
  @slideshow = BitCore::Slideshow.find(params[:slideshow_id])
9
9
  @slide = @slideshow.slides.find(params[:id])
10
+
11
+ rescue ActiveRecord::RecordNotFound => e
12
+ redirect_to new_participant_session_path, alert: e.message
10
13
  end
11
14
  end
12
15
  end
@@ -0,0 +1,27 @@
1
+ module ContentProviders
2
+ module Experiences
3
+ # Allows participants view past positive experiences/events
4
+ class IndexProvider < BitCore::ContentProvider
5
+ def render_current(options)
6
+ options.view_context.render(
7
+ template: "think_feel_do_engine/experiences/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
+ experiences: options
16
+ .view_context.current_participant.experiences
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 Experiences
3
+ # Allows participants to record a positive experiences/events
4
+ class NewProvider < BitCore::ContentProvider
5
+ def data_attributes
6
+ [:challenging_amplification, :description]
7
+ end
8
+
9
+ def data_class_name
10
+ "Experience"
11
+ end
12
+
13
+ def render_current(options)
14
+ options.view_context.render(
15
+ template: "think_feel_do_engine/experiences/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
+ # A daily experience that happened to a participant
2
+ class Experience < 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 :experiences, dependent: :destroy
64
65
  has_many :gratitude_recordings, dependent: :destroy
65
66
 
66
67
  delegate :end_date, to: :active_membership, prefix: true, allow_nil: true
@@ -0,0 +1,5 @@
1
+ module Tools
2
+ # Records a user's positive experience
3
+ class Experiences < BitCore::Tool
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ <h2>Experiences</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
+ <% experiences.each do |experience| %>
9
+ <li class="list-group-item">
10
+ <h4 class="list-group-item-heading">
11
+ <%= experience.description %>
12
+ </h4>
13
+ <p class="list-group-item-text">
14
+ How you amplifed/savored this experience:
15
+ <%= experience.challenging_amplification %>
16
+ </p>
17
+ </li>
18
+ <% end %>
19
+ </ul>
@@ -0,0 +1,30 @@
1
+ <h2>New Positive Experience</h2>
2
+
3
+ <%= form_for(participant.experiences.build, url: create_path, html: { method: :post, role: :form }) do |f| %>
4
+ <div class="form-group">
5
+ <%= f.label :description, "Describe something good that happened in the past day.", class: "control-label" %>
6
+ <%= f.text_area :description, class: "form-control" %>
7
+
8
+ <%= f.label :challenging_amplification, "Did you do anything to amplify or savor it? You can also think of an opportunity to do something right now!", class: "control-label" %>
9
+ <%= f.text_area :challenging_amplification, class: "form-control" %>
10
+
11
+ <a data-toggle="collapse" href="#collapse-experience-examples">see some examples</a>
12
+
13
+ <div class="collapse" id="collapse-experience-examples">
14
+ <div class="well">
15
+ <ul>
16
+ <li>Eating your favorite food</li>
17
+ <li>Hearing a song you like</li>
18
+ <li>Drinking coffee in the morning</li>
19
+ <li>Getting exercise or a good night's sleep</li>
20
+ <li>Playing video games or seeing something funny online</li>
21
+ <li>A friend or family member doing something nice for you (giving you a hug, doing a chore, bringing you a small gift)</li>
22
+ <li>Nice weather or scenery</li>
23
+ <li>... anything at all that went well (or better than you might have expected)</li>
24
+ </ul>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <%= f.submit t(:next), class: "btn btn-primary" %>
30
+ <% end %>
@@ -5,12 +5,12 @@
5
5
  </div>
6
6
 
7
7
  <ul class="list-group">
8
- <% gratitude_recordings.each do |g| %>
8
+ <% gratitude_recordings.each do |gratitude_recording| %>
9
9
  <li class="list-group-item clearfix">
10
10
  <span class="text-muted pull-right">
11
- <%= g.created_at.to_s(:participant_date) %>
11
+ <%= gratitude_recording.created_at.to_s(:participant_date) %>
12
12
  </span>
13
- <%= g.description %>
13
+ <%= gratitude_recording.description %>
14
14
  </li>
15
15
  <% end %>
16
16
  </ul>
@@ -0,0 +1,13 @@
1
+ class CreateExperiences < ActiveRecord::Migration
2
+ def change
3
+ create_table :experiences do |t|
4
+ t.text :challenging_amplification
5
+ t.text :description, null: false
6
+ t.integer :participant_id, null: false
7
+
8
+ t.timestamps null: false
9
+ end
10
+
11
+ add_foreign_key :experiences, :participants
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
1
  # nodoc
2
2
  module ThinkFeelDoEngine
3
- VERSION = "3.11.0"
3
+ VERSION = "3.11.3"
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.11.0
4
+ version: 3.11.3
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-02-04 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -440,6 +440,8 @@ files:
440
440
  - app/models/content_providers/create_activity.rb
441
441
  - app/models/content_providers/edit_past_feel_provider.rb
442
442
  - app/models/content_providers/evaluate_thoughts_provider.rb
443
+ - app/models/content_providers/experiences/index_provider.rb
444
+ - app/models/content_providers/experiences/new_provider.rb
443
445
  - app/models/content_providers/fun_activity_checklist.rb
444
446
  - app/models/content_providers/gratitude_recordings/index_provider.rb
445
447
  - app/models/content_providers/gratitude_recordings/new_provider.rb
@@ -477,6 +479,7 @@ files:
477
479
  - app/models/emotion.rb
478
480
  - app/models/emotional_rating.rb
479
481
  - app/models/engagement.rb
482
+ - app/models/experience.rb
480
483
  - app/models/gratitude_recording.rb
481
484
  - app/models/group.rb
482
485
  - app/models/media_access_event.rb
@@ -524,6 +527,7 @@ files:
524
527
  - app/models/thought.rb
525
528
  - app/models/thought_pattern.rb
526
529
  - app/models/tool_nav_item.rb
530
+ - app/models/tools/experiences.rb
527
531
  - app/models/tools/gratitude_recordings.rb
528
532
  - app/models/tools/home.rb
529
533
  - app/models/tools/learn.rb
@@ -655,6 +659,8 @@ files:
655
659
  - app/views/think_feel_do_engine/emotions/_form.html.erb
656
660
  - app/views/think_feel_do_engine/emotions/index.html.erb
657
661
  - app/views/think_feel_do_engine/emotions/new_current.html.erb
662
+ - app/views/think_feel_do_engine/experiences/index_provider.html.erb
663
+ - app/views/think_feel_do_engine/experiences/new_provider.html.erb
658
664
  - app/views/think_feel_do_engine/gratitude_recordings/index_provider.html.erb
659
665
  - app/views/think_feel_do_engine/gratitude_recordings/new_provider.html.erb
660
666
  - app/views/think_feel_do_engine/learn/_completion_data.html.erb
@@ -910,6 +916,7 @@ files:
910
916
  - db/migrate/20150903210028_add_relase_day_not_null_constraint_to_trask.rb
911
917
  - db/migrate/20151104152804_update_think_tool_type_to_tools_think.rb
912
918
  - db/migrate/20160203222002_create_gratitude_recordings.rb
919
+ - db/migrate/20160205212840_create_experiences.rb
913
920
  - lib/tasks/lesson_notifications.rake
914
921
  - lib/tasks/seed.rake
915
922
  - lib/tasks/think_feel_do_engine_tasks.rake