mumuki-laboratory 7.12.0 → 8.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/characters.js +3 -1
  3. data/app/assets/javascripts/mumuki_laboratory/application/gamification.js +89 -11
  4. data/app/assets/javascripts/mumuki_laboratory/application/kids.js +171 -333
  5. data/app/assets/javascripts/mumuki_laboratory/application/kindergarten.js +144 -130
  6. data/app/assets/javascripts/mumuki_laboratory/application/mu-modal-carrousel.js +63 -0
  7. data/app/assets/javascripts/mumuki_laboratory/application/number-counter.js +18 -0
  8. data/app/assets/javascripts/mumuki_laboratory/application/primary.js +258 -0
  9. data/app/assets/javascripts/mumuki_laboratory/application/submission.js +1 -1
  10. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids_results.scss +117 -0
  11. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kindergarten.scss +47 -113
  12. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_terms.scss +9 -12
  13. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +31 -3
  14. data/app/controllers/api/courses_controller.rb +1 -2
  15. data/app/controllers/api/organizations_controller.rb +2 -3
  16. data/app/controllers/api/users_controller.rb +2 -4
  17. data/app/controllers/application_controller.rb +41 -8
  18. data/app/controllers/assets_controller.rb +1 -0
  19. data/app/controllers/book_discussions_controller.rb +1 -1
  20. data/app/controllers/chapters_controller.rb +1 -0
  21. data/app/controllers/discussions_controller.rb +4 -0
  22. data/app/controllers/exercises_controller.rb +1 -0
  23. data/app/controllers/guides_controller.rb +2 -0
  24. data/app/controllers/invitations_controller.rb +2 -2
  25. data/app/controllers/lessons_controller.rb +1 -0
  26. data/app/controllers/login_controller.rb +1 -0
  27. data/app/controllers/users_controller.rb +9 -1
  28. data/app/helpers/assistance_box_helper.rb +7 -5
  29. data/app/helpers/contextualization_result_helper.rb +9 -1
  30. data/app/helpers/gamification_helper.rb +5 -0
  31. data/app/helpers/links_helper.rb +1 -1
  32. data/app/views/exercise_solutions/_assistant_rules_box.html.erb +13 -0
  33. data/app/views/exercise_solutions/_contextualization_results_container.html.erb +9 -0
  34. data/app/views/exercise_solutions/_kids_level_up.html.erb +11 -0
  35. data/app/views/exercise_solutions/_kids_results.html.erb +1 -1
  36. data/app/views/exercise_solutions/_results.html.erb +19 -19
  37. data/app/views/exercise_solutions/_results_title.html.erb +5 -0
  38. data/app/views/exercises/show.html.erb +4 -1
  39. data/app/views/layouts/_kindergarten.html.erb +4 -4
  40. data/app/views/layouts/_organizations_listing.html.erb +8 -12
  41. data/app/views/layouts/application.html.erb +8 -2
  42. data/app/views/layouts/modals/_guide_corollary.html.erb +1 -1
  43. data/app/views/layouts/modals/_kids_context.html.erb +1 -1
  44. data/app/views/layouts/modals/_kids_results.html.erb +16 -6
  45. data/app/views/layouts/modals/_kindergarten_context.html.erb +15 -15
  46. data/app/views/layouts/modals/_kindergarten_results.html.erb +20 -7
  47. data/app/views/layouts/modals/_kindergarten_results_aborted.html.erb +10 -7
  48. data/app/views/layouts/modals/_level_up.html.erb +27 -0
  49. data/app/views/users/_edit_user_form.html.erb +1 -1
  50. data/app/views/users/_user_form.html.erb +12 -2
  51. data/app/views/users/terms.html.erb +12 -0
  52. data/config/routes.rb +8 -8
  53. data/lib/mumuki/laboratory.rb +18 -5
  54. data/lib/mumuki/laboratory/controllers.rb +2 -0
  55. data/lib/mumuki/laboratory/controllers/action_redirector.rb +21 -0
  56. data/lib/mumuki/laboratory/controllers/immersive_navigation.rb +7 -0
  57. data/lib/mumuki/laboratory/controllers/results_rendering.rb +1 -0
  58. data/lib/mumuki/laboratory/events/events.rb +0 -33
  59. data/lib/mumuki/laboratory/locales/en.yml +11 -0
  60. data/lib/mumuki/laboratory/locales/es-CL.yml +5 -0
  61. data/lib/mumuki/laboratory/locales/es.yml +12 -1
  62. data/lib/mumuki/laboratory/locales/pt.yml +11 -0
  63. data/lib/mumuki/laboratory/version.rb +1 -1
  64. data/spec/capybara_helper.rb +5 -1
  65. data/spec/controllers/exercise_solutions_controller_spec.rb +1 -1
  66. data/spec/features/immersive_redirection_spec.rb +181 -0
  67. data/spec/features/profile_flow_spec.rb +35 -3
  68. data/spec/features/terms_flow_spec.rb +155 -0
  69. metadata +108 -98
  70. data/app/helpers/organization_list_helper.rb +0 -5
  71. data/spec/features/choose_organization_spec.rb +0 -74
@@ -26,7 +26,7 @@ mumuki.submission = (() => {
26
26
  this.submissionsResultsArea.html(data.html);
27
27
  data.status === 'aborted' ? this.error(submitButton) : submitButton.enable();
28
28
  mumuki.updateProgressBarAndShowModal(data);
29
- mumuki.gamification._currentLevelProgression.setExpMessage(data.current_exp);
29
+ mumuki.gamification.currentLevelProgression.setExpMessage(data);
30
30
  }
31
31
  error(submitButton) {
32
32
  this.submissionsResultsArea.html('');
@@ -1,3 +1,14 @@
1
+ @mixin full-size-character {
2
+ width: 100%;
3
+ height: 100%;
4
+ img {
5
+ width: 100%;
6
+ height: 100%;
7
+ object-position: center;
8
+ object-fit: contain;
9
+ }
10
+ }
11
+
1
12
  @each $class in success, warning, danger, broken {
2
13
  .mu-kids-callout-#{$class} {
3
14
  h4 {
@@ -47,3 +58,109 @@ $capital-animation-width: 135px;
47
58
  }
48
59
  }
49
60
 
61
+ .mu-kids-modal-border {
62
+
63
+ .modal-dialog {
64
+
65
+ height: 100vh;
66
+ width: 100vw;
67
+ margin: 0;
68
+
69
+ .modal-content {
70
+
71
+ position: absolute;
72
+
73
+ $width-lg: 800px;
74
+
75
+ width: $width-lg;
76
+
77
+ top: 60px;
78
+ left: calc(50% - #{$width-lg} / 2);
79
+
80
+ @media (max-width: $width-lg + 30px) {
81
+ width: calc(100vw - 30px);
82
+ }
83
+
84
+ $border-width: 16px;
85
+ border-width: $border-width;
86
+ border-style: solid;
87
+ border-color: $mu-color-link;
88
+ border-radius: $border-width;
89
+ box-shadow: none;
90
+
91
+ .modal-body {
92
+ div, p {
93
+ height: 100%;
94
+ .mu-kids-results-carrousel,
95
+ .mu-kindergarten-context-image-slides {
96
+ > :not(.active) {
97
+ display: none;
98
+ }
99
+ }
100
+ }
101
+ .mu-level p {
102
+ height: unset;
103
+ }
104
+ }
105
+
106
+ .mu-kids-modal-button {
107
+ $diameter: 64px;
108
+ position: absolute;
109
+ border-radius: 50%;
110
+ height: $diameter;
111
+ width: $diameter;
112
+ color: white;
113
+ font-weight: bold;
114
+ border: none;
115
+ padding: 0;
116
+ background: $mu-color-link;
117
+ &.mu-next,
118
+ &.mu-close {
119
+ top: - $diameter / 2 - $border-width / 2;
120
+ right: - $diameter / 2 - $border-width / 2;
121
+ }
122
+ &.mu-previous {
123
+ top: - $diameter / 2 - $border-width / 2;
124
+ left: - $diameter / 2 - $border-width / 2;
125
+ }
126
+ }
127
+
128
+ $mu-statuses-colors: (
129
+ 'broken': $mu-color-broken,
130
+ 'danger': $mu-color-danger,
131
+ 'success': $mu-color-success,
132
+ 'warning': $mu-color-warning,
133
+ 'passed': $mu-color-success,
134
+ 'passed-with-warnings': $mu-color-warning,
135
+ 'failed': $mu-color-danger,
136
+ 'errored': $mu-color-broken,
137
+ 'aborted': $mu-color-broken,
138
+ 'pending': $mu-color-info
139
+ );
140
+
141
+ @each $class, $color in $mu-statuses-colors {
142
+ &.#{$class} {
143
+ border-color: $color;
144
+ .mu-kids-modal-button {
145
+ background: $color;
146
+ }
147
+ }
148
+ .mu-kids-character.kindergarten {
149
+ @include full-size-character;
150
+ }
151
+
152
+ .submission-results.kindergarten {
153
+ width: 100%;
154
+ height: 100%;
155
+ .mu-kids-callout-#{$class},
156
+ p {
157
+ display: none;
158
+ }
159
+ .mu-kids-default-#{$class} {
160
+ @include full-size-character;
161
+ }
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }
@@ -14,15 +14,6 @@ $modal-footer-height: 95px;
14
14
  height: calc(100% - #{$kids-characters-height} - 15px);
15
15
  width: 100%;
16
16
 
17
- .konvajs-content {
18
- width: unset !important;
19
- height: unset !important;
20
- canvas {
21
- width: unset !important;
22
- height: unset !important;
23
- }
24
- }
25
-
26
17
  .mu-kids-single-state,
27
18
  .mu-kids-blocks {
28
19
  width: 50%;
@@ -30,7 +21,7 @@ $modal-footer-height: 95px;
30
21
  }
31
22
 
32
23
  .mu-kids-blocks {
33
- padding-bottom: 15px;
24
+ margin-right: 15px;
34
25
  }
35
26
 
36
27
  &.mu-full-workspace {
@@ -78,7 +69,7 @@ $modal-footer-height: 95px;
78
69
  padding: 30px;
79
70
  img {
80
71
  padding: 0;
81
- border: 5px solid black;
72
+ border: 3px solid black;
82
73
  border-radius: 30px;
83
74
  }
84
75
  }
@@ -96,126 +87,69 @@ $modal-footer-height: 95px;
96
87
  }
97
88
  }
98
89
 
99
- .mu-kindergarten-context {
90
+ .modal-content.kindergarten {
91
+ $width-lg: 800px;
92
+ $height-lg: $width-lg * 0.625;
100
93
 
101
- .modal-dialog {
94
+ width: $width-lg;
95
+ height: $height-lg;
102
96
 
103
- height: 100vh;
104
- width: 100vw;
105
- margin: 0;
97
+ top: calc(50vh - #{$height-lg} / 2);
106
98
 
107
- .modal-content {
108
- position: absolute;
99
+ @media (orientation: landscape) and (max-height: $height-lg + 50px) {
100
+ $height-sm: 85vh;
101
+ $width-sm: $height-sm / 0.625;
109
102
 
110
- $width: 800px;
111
- $height: $width * 0.625;
103
+ width: $width-sm;
104
+ height: $height-sm;
112
105
 
113
- width: $width;
114
- height: $height;
106
+ top: calc(50vh - #{$height-sm} / 2);
107
+ left: calc(50vw - #{$width-sm} / 2);
108
+ }
115
109
 
116
- top: calc(50vh - #{$height} / 2);
117
- left: calc(50vw - #{$width} / 2);
110
+ @media (orientation: portrait) {
111
+ $height-sm: 85vh;
112
+ $width-sm: 85vw;
118
113
 
119
- $border-width: 16px;
120
- border-width: $border-width;
121
- border-style: solid;
122
- border-color: $mu-color-link;
123
- border-radius: $border-width;
124
- box-shadow: none;
114
+ width: $width-sm;
115
+ height: $height-sm;
125
116
 
126
- .modal-body {
127
- height: 100%;
128
- div, p {
129
- height: 100%;
130
- .mu-kindergarten-context-image-slides {
131
- img:not(.active) {
132
- display: none;
133
- }
134
- }
135
- img {
136
- width: 100%;
137
- height: 100%;
138
- object-position: center;
139
- object-fit: contain;
140
- }
141
- }
142
- }
117
+ top: calc(50vh - #{$height-sm} / 2);
118
+ left: calc(50vw - #{$width-sm} / 2);
119
+ }
143
120
 
144
- .mu-kindergarten-modal-button {
145
- $diameter: 64px;
146
- position: absolute;
147
- border-radius: 50%;
148
- height: $diameter;
149
- width: $diameter;
150
- color: white;
151
- font-weight: bold;
152
- border: none;
153
- padding: 0;
154
- background: $mu-color-link;
155
- &.mu-next,
156
- &.mu-close {
157
- top: - $diameter / 2 - $border-width / 2;
158
- right: - $diameter / 2 - $border-width / 2;
159
- }
160
- &.mu-previous {
161
- top: - $diameter / 2 - $border-width / 2;
162
- left: - $diameter / 2 - $border-width / 2;
163
- }
164
- }
121
+ .modal-header,
122
+ .modal-footer {
123
+ text-align: center;
124
+ text-transform: uppercase;
125
+ }
165
126
 
166
- $mu-statuses-colors: (
167
- 'broken': $mu-color-broken,
168
- 'danger': $mu-color-danger,
169
- 'success': $mu-color-success,
170
- 'warning': $mu-color-warning,
171
- 'passed': $mu-color-success,
172
- 'passed-with-warnings': $mu-color-warning,
173
- 'failed': $mu-color-danger,
174
- 'aborted': $mu-color-broken,
175
- 'pending': $mu-color-info
176
- );
177
-
178
- @each $class, $color in $mu-statuses-colors {
179
- &.#{$class} {
180
- border-color: $color;
181
- .mu-kindergarten-modal-button {
182
- background: $color;
183
- }
184
- }
185
- .submission-results {
186
- width: 100%;
187
- height: 100%;
188
- .mu-kids-callout-#{$class},
189
- p {
190
- display: none;
191
- }
192
- .mu-kids-default-#{$class} {
193
- width: 100%;
194
- height: 100%;
195
- img {
196
- width: 100%;
197
- height: 100%;
198
- object-position: center;
199
- object-fit: contain;
200
- }
201
- }
202
- }
203
- }
127
+ .modal-body.mu-kids-context-body {
128
+ height: 100%;
129
+ div img, p img {
130
+ width: 100%;
131
+ height: 100%;
132
+ object-position: center;
133
+ object-fit: contain;
204
134
  }
205
135
  }
206
136
  }
207
137
 
208
- #kids-results.mu-kindergarten-context {
138
+ #kids-results.mu-kids-modal-border {
209
139
  .modal-body{
210
140
  height: calc(100% - #{$modal-header-height} - #{$modal-footer-height});
211
141
  }
212
142
  }
213
- #kids-results-aborted.mu-kindergarten-context {
214
- .modal-body{
215
- height: calc(100% - #{$modal-header-height});
216
- }
217
- h4.modal-header {
218
- margin: 0;
143
+
144
+ #kids-results-aborted.mu-kids-modal-border {
145
+ .modal-content.kindergarten {
146
+ .modal-body {
147
+ height: calc(100% - #{$modal-header-height});
148
+ }
149
+
150
+ h4.modal-header {
151
+ margin: 0;
152
+ }
219
153
  }
220
154
  }
221
155
 
@@ -1,12 +1,3 @@
1
- summary.terms-summary {
2
- font-size: 29px;
3
- outline: 0;
4
- cursor: pointer;
5
- .terms-summary-title {
6
- display: inline;
7
- }
8
- }
9
-
10
1
  .terms-card {
11
2
  position: relative;
12
3
  display: -ms-flexbox;
@@ -38,7 +29,13 @@ summary.terms-summary {
38
29
  padding: 1.25rem;
39
30
  }
40
31
 
41
- .terms-acceptance-btn {
42
- margin-top: 10px;
43
- display: block
32
+ .terms-acceptance {
33
+ margin-top: 30px;
34
+
35
+ .terms-acceptance-btn {
36
+ margin-top: 10px;
37
+ display: block
38
+ }
44
39
  }
40
+
41
+
@@ -31,7 +31,37 @@
31
31
  }
32
32
  }
33
33
 
34
- .mu-profile-info {
34
+ .mu-profile-info-left {
35
+ display: flex;
36
+ flex-direction: column;
37
+ align-items: center;
38
+ text-align: center;
39
+
40
+ .mu-level-progress {
41
+ position: relative;
42
+ top: -275px;
43
+ margin-bottom: -275px;
44
+ }
45
+ }
46
+
47
+ .mu-level {
48
+ .mu-level-number {
49
+ position: absolute;
50
+ margin-top: 11px;
51
+ margin-left: -86px;
52
+ width: 87px;
53
+
54
+ text-align: center;
55
+ font-size: 1.5em;
56
+ font-weight: bold;
57
+ color: white;
58
+
59
+ user-select: none;
60
+ pointer-events: none;
61
+ }
62
+ }
63
+
64
+ .mu-profile-info-right {
35
65
  font-size: 20px;
36
66
  margin-top: 5px;
37
67
  div {
@@ -40,6 +70,4 @@
40
70
  font-style: italic;
41
71
  }
42
72
  }
43
-
44
-
45
73
  }
@@ -5,7 +5,6 @@ module Api
5
5
 
6
6
  def create
7
7
  @course.save!
8
- @course.notify!
9
8
  render json: @course
10
9
  end
11
10
 
@@ -23,4 +22,4 @@ module Api
23
22
  @course.slug
24
23
  end
25
24
  end
26
- end
25
+ end
@@ -14,13 +14,12 @@ module Api
14
14
  end
15
15
 
16
16
  def create
17
- @organization.save_and_notify!
17
+ @organization.save!
18
18
  render json: @organization.to_resource_h
19
19
  end
20
20
 
21
21
  def update
22
- @organization.update_and_notify! organization_params
23
-
22
+ @organization.update! organization_params
24
23
  render json: @organization.to_resource_h
25
24
  end
26
25
  end
@@ -4,14 +4,12 @@ module Api
4
4
  before_action :authorize_janitor!
5
5
 
6
6
  def create
7
- @user.save!
8
- @user.notify!
7
+ @user.save_and_notify!
9
8
  render json: @user.to_resource_h
10
9
  end
11
10
 
12
11
  def update
13
- @user.update! user_params.except([:email, :permissions, :uid])
14
- @user.notify!
12
+ @user.update_and_notify! user_params.except([:email, :permissions, :uid])
15
13
  render json: @user.to_resource_h
16
14
  end
17
15
  end