think_feel_do_engine 3.12.4 → 3.12.5

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: d2f279384413ae9527ed63dccf63ac46f933d377
4
- data.tar.gz: aa19128c6c22d29d07d829ec1cf65e9eb67c8303
3
+ metadata.gz: 7c424bf129d83b553ad5026cdcc2dcffef8661b9
4
+ data.tar.gz: f908680e54c34dd2cf8889196ae5250200b4810e
5
5
  SHA512:
6
- metadata.gz: 28b0dc6f1d139ee57be4f1eee004dba48269bfaa606f171dd8f89077f8077404d0696b3e81ea45f836e9626475f54f4d4374e29b6ed05090c193c4c9d8e2847c
7
- data.tar.gz: 3a664d335ad7e15538aeaf5c9f1ef22db659d8d245eb1bb0400f7af99a34467196ae8c5c2b2df6c0103b5e32164231a5dd739d956aa46a24519bee28e051f75e
6
+ metadata.gz: daffa05c180b0cd7f4f9b8addb0fe8bdbae3c29cb63454ee8930aa79b8e7aef544843ed826a3cfed69d13e39aa15d9f9856e10910d6d3fc2d1c6ad249d0479d2
7
+ data.tar.gz: 272318ee0392c0d501cabfccb50454f0a22e26b154927bd8915cd014cf8b7c11f709f7669143dfdf464eb1ca654dda387979fe4e680b6402ad59f9108e07bedf
@@ -2,7 +2,10 @@ module ThinkFeelDoEngine
2
2
  # Mailer for SiteMessage delivery.
3
3
  class SiteMessageMailer < ActionMailer::Base
4
4
  def general(message)
5
- @body = message.body
5
+ markdown = Redcarpet::Markdown.new(
6
+ Redcarpet::Render::HTML,
7
+ space_after_headers: true)
8
+ @body = markdown.render(message.body)
6
9
 
7
10
  mail to: message.participant.email,
8
11
  subject: message.subject
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+ module Concerns
3
+ # Copies lesson content from one arm's learning tool
4
+ # (i.e., LEARN tool) to another arm's learning tool
5
+ module Copier
6
+ LEARN_TOOL = "Tools::Learn"
7
+ TOOL_TITLE = "LEARN"
8
+
9
+ Arm.class_eval do
10
+ def copy_lessons_to(new_arm)
11
+ new_tools = new_arm.bit_core_tools
12
+ new_tool = new_tools.find_by(type: LEARN_TOOL) ||
13
+ new_tools.create!(
14
+ position: new_tools.count,
15
+ title: TOOL_TITLE,
16
+ type: LEARN_TOOL)
17
+
18
+ return unless new_tool
19
+
20
+ bit_core_tools
21
+ .find_by(type: LEARN_TOOL)
22
+ .copy_content_modules_to(
23
+ new_arm: new_arm,
24
+ new_tool: new_tool)
25
+ end
26
+ end
27
+
28
+ # Extend BitCore classes
29
+ # rubocop:disable ClassAndModuleChildren
30
+ module ::BitCore
31
+ Tool.class_eval do
32
+ LESSON_MODULE = "ContentModules::LessonModule"
33
+
34
+ def copy_content_modules_to(new_arm:, new_tool:)
35
+ ContentModule.transaction do
36
+ content_modules.where(type: LESSON_MODULE).each do |content_module|
37
+ content_module.copy_content_providers_to(
38
+ new_arm: new_arm,
39
+ new_tool: new_tool)
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ ContentModule.class_eval do
46
+ def copy_content_providers_to(new_arm:, new_tool:)
47
+ ContentModule.transaction do
48
+ new_content_module =
49
+ ContentModule.create!(
50
+ position: position,
51
+ title: title,
52
+ tool: new_tool,
53
+ type: type)
54
+
55
+ new_content_module.content_providers.destroy_all
56
+
57
+ content_providers.each do |content_provider|
58
+ content_provider
59
+ .copy_source_content_to!(
60
+ new_arm: new_arm,
61
+ new_content_module: new_content_module)
62
+ end
63
+
64
+ new_content_module
65
+ end
66
+ end
67
+ end
68
+
69
+ ContentProvider.class_eval do
70
+ def copy_source_content_to!(new_arm:, new_content_module:)
71
+ ContentProvider.transaction do
72
+ # rubocop:disable DoubleNegation
73
+ ContentProvider.create!(
74
+ content_module: new_content_module,
75
+ position: position,
76
+ show_next_nav: !!show_next_nav,
77
+ type: type,
78
+ source_content: source_content.try(:copy_to, new_arm))
79
+ # rubocop:enable DoubleNegation
80
+ end
81
+ end
82
+ end
83
+
84
+ Slideshow.class_eval do
85
+ def copy_to(new_arm)
86
+ Slideshow.transaction do
87
+ slideshow = Slideshow.create!(arm: new_arm, title: title)
88
+
89
+ copy_slides_to!(slideshow)
90
+
91
+ slideshow
92
+ end
93
+ end
94
+
95
+ private
96
+
97
+ def copy_slides_to!(slideshow)
98
+ Slide.transaction do
99
+ slides.each do |slide|
100
+ slide.copy_to!(slideshow)
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ Slide.class_eval do
107
+ def copy_to!(slideshow)
108
+ Slide.create!(
109
+ body: body,
110
+ is_title_visible: is_title_visible,
111
+ options: options,
112
+ position: position,
113
+ slideshow: slideshow,
114
+ title: title,
115
+ type: type)
116
+ end
117
+ end
118
+ end
119
+ # rubocop:enable ClassAndModuleChildren
120
+ end
121
+ end
@@ -1,5 +1,5 @@
1
1
  <p>
2
- <%= @body %>
2
+ <%= @body.html_safe %>
3
3
  </p>
4
4
 
5
5
  <p>
@@ -1,4 +1,4 @@
1
1
  # nodoc
2
2
  module ThinkFeelDoEngine
3
- VERSION = "3.12.4"
3
+ VERSION = "3.12.5"
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.12.4
4
+ version: 3.12.5
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-03-01 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -445,6 +445,7 @@ files:
445
445
  - app/models/awake_period.rb
446
446
  - app/models/bit_core/slide_observer.rb
447
447
  - app/models/coach_assignment.rb
448
+ - app/models/concerns/copier.rb
448
449
  - app/models/content_modules.rb
449
450
  - app/models/content_modules/lesson_module.rb
450
451
  - app/models/content_provider_decorator.rb