mumuki-laboratory 7.12.1 → 7.12.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/gamification.js +89 -11
  3. data/app/assets/javascripts/mumuki_laboratory/application/kids.js +16 -4
  4. data/app/assets/javascripts/mumuki_laboratory/application/kindergarten.js +9 -50
  5. data/app/assets/javascripts/mumuki_laboratory/application/mu-modal-carrousel.js +63 -0
  6. data/app/assets/javascripts/mumuki_laboratory/application/number-counter.js +18 -0
  7. data/app/assets/javascripts/mumuki_laboratory/application/primary.js +2 -1
  8. data/app/assets/javascripts/mumuki_laboratory/application/submission.js +1 -1
  9. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids_results.scss +117 -0
  10. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kindergarten.scss +45 -131
  11. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +31 -3
  12. data/app/helpers/gamification_helper.rb +5 -0
  13. data/app/views/exercise_solutions/_contextualization_results_container.html.erb +9 -0
  14. data/app/views/exercise_solutions/_kids_level_up.html.erb +11 -0
  15. data/app/views/exercise_solutions/_results_title.html.erb +5 -0
  16. data/app/views/exercises/show.html.erb +4 -1
  17. data/app/views/layouts/_kindergarten.html.erb +1 -1
  18. data/app/views/layouts/application.html.erb +8 -2
  19. data/app/views/layouts/modals/_guide_corollary.html.erb +1 -1
  20. data/app/views/layouts/modals/_kids_context.html.erb +1 -1
  21. data/app/views/layouts/modals/_kids_results.html.erb +16 -6
  22. data/app/views/layouts/modals/_kindergarten_context.html.erb +15 -15
  23. data/app/views/layouts/modals/_kindergarten_results.html.erb +20 -7
  24. data/app/views/layouts/modals/_kindergarten_results_aborted.html.erb +4 -4
  25. data/app/views/layouts/modals/_level_up.html.erb +27 -0
  26. data/app/views/users/_user_form.html.erb +12 -2
  27. data/lib/mumuki/laboratory/controllers/results_rendering.rb +1 -0
  28. data/lib/mumuki/laboratory/locales/en.yml +5 -0
  29. data/lib/mumuki/laboratory/locales/es-CL.yml +5 -0
  30. data/lib/mumuki/laboratory/locales/es.yml +5 -0
  31. data/lib/mumuki/laboratory/locales/pt.yml +5 -0
  32. data/lib/mumuki/laboratory/version.rb +1 -1
  33. data/spec/controllers/exercise_solutions_controller_spec.rb +1 -1
  34. metadata +102 -97
@@ -87,155 +87,69 @@ $modal-footer-height: 95px;
87
87
  }
88
88
  }
89
89
 
90
- .mu-kindergarten-context {
90
+ .modal-content.kindergarten {
91
+ $width-lg: 800px;
92
+ $height-lg: $width-lg * 0.625;
91
93
 
92
- .modal-dialog {
94
+ width: $width-lg;
95
+ height: $height-lg;
93
96
 
94
- height: 100vh;
95
- width: 100vw;
96
- margin: 0;
97
+ top: calc(50vh - #{$height-lg} / 2);
97
98
 
98
- .modal-content {
99
- position: absolute;
100
-
101
- $width-lg: 800px;
102
- $height-lg: $width-lg * 0.625;
103
-
104
- width: $width-lg;
105
- height: $height-lg;
106
-
107
- top: calc(50vh - #{$height-lg} / 2);
108
- left: calc(50vw - #{$width-lg} / 2);
109
-
110
- @media (orientation: landscape) and (max-height: $height-lg + 50px) {
111
- $height-sm: 85vh;
112
- $width-sm: $height-sm / 0.625;
99
+ @media (orientation: landscape) and (max-height: $height-lg + 50px) {
100
+ $height-sm: 85vh;
101
+ $width-sm: $height-sm / 0.625;
113
102
 
114
- width: $width-sm;
115
- height: $height-sm;
103
+ width: $width-sm;
104
+ height: $height-sm;
116
105
 
117
- top: calc(50vh - #{$height-sm} / 2);
118
- left: calc(50vw - #{$width-sm} / 2);
119
- }
120
-
121
- @media (orientation: portrait) {
122
- $height-sm: 85vh;
123
- $width-sm: 85vw;
124
-
125
- width: $width-sm;
126
- height: $height-sm;
127
-
128
- top: calc(50vh - #{$height-sm} / 2);
129
- left: calc(50vw - #{$width-sm} / 2);
130
- }
106
+ top: calc(50vh - #{$height-sm} / 2);
107
+ left: calc(50vw - #{$width-sm} / 2);
108
+ }
131
109
 
132
- $border-width: 16px;
133
- border-width: $border-width;
134
- border-style: solid;
135
- border-color: $mu-color-link;
136
- border-radius: $border-width;
137
- box-shadow: none;
110
+ @media (orientation: portrait) {
111
+ $height-sm: 85vh;
112
+ $width-sm: 85vw;
138
113
 
139
- .modal-header,
140
- .modal-footer {
141
- text-align: center;
142
- text-transform: uppercase;
143
- }
114
+ width: $width-sm;
115
+ height: $height-sm;
144
116
 
145
- .modal-body {
146
- height: 100%;
147
- div, p {
148
- height: 100%;
149
- .mu-kindergarten-context-image-slides {
150
- img:not(.active) {
151
- display: none;
152
- }
153
- }
154
- img {
155
- width: 100%;
156
- height: 100%;
157
- object-position: center;
158
- object-fit: contain;
159
- }
160
- }
161
- }
117
+ top: calc(50vh - #{$height-sm} / 2);
118
+ left: calc(50vw - #{$width-sm} / 2);
119
+ }
162
120
 
163
- .mu-kindergarten-modal-button {
164
- $diameter: 64px;
165
- position: absolute;
166
- border-radius: 50%;
167
- height: $diameter;
168
- width: $diameter;
169
- color: white;
170
- font-weight: bold;
171
- border: none;
172
- padding: 0;
173
- background: $mu-color-link;
174
- &.mu-next,
175
- &.mu-close {
176
- top: - $diameter / 2 - $border-width / 2;
177
- right: - $diameter / 2 - $border-width / 2;
178
- }
179
- &.mu-previous {
180
- top: - $diameter / 2 - $border-width / 2;
181
- left: - $diameter / 2 - $border-width / 2;
182
- }
183
- }
121
+ .modal-header,
122
+ .modal-footer {
123
+ text-align: center;
124
+ text-transform: uppercase;
125
+ }
184
126
 
185
- $mu-statuses-colors: (
186
- 'broken': $mu-color-broken,
187
- 'danger': $mu-color-danger,
188
- 'success': $mu-color-success,
189
- 'warning': $mu-color-warning,
190
- 'passed': $mu-color-success,
191
- 'passed-with-warnings': $mu-color-warning,
192
- 'failed': $mu-color-danger,
193
- 'errored': $mu-color-broken,
194
- 'aborted': $mu-color-broken,
195
- 'pending': $mu-color-info
196
- );
197
-
198
- @each $class, $color in $mu-statuses-colors {
199
- &.#{$class} {
200
- border-color: $color;
201
- .mu-kindergarten-modal-button {
202
- background: $color;
203
- }
204
- }
205
- .submission-results {
206
- width: 100%;
207
- height: 100%;
208
- .mu-kids-callout-#{$class},
209
- p {
210
- display: none;
211
- }
212
- .mu-kids-default-#{$class} {
213
- width: 100%;
214
- height: 100%;
215
- img {
216
- width: 100%;
217
- height: 100%;
218
- object-position: center;
219
- object-fit: contain;
220
- }
221
- }
222
- }
223
- }
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;
224
134
  }
225
135
  }
226
136
  }
227
137
 
228
- #kids-results.mu-kindergarten-context {
138
+ #kids-results.mu-kids-modal-border {
229
139
  .modal-body{
230
140
  height: calc(100% - #{$modal-header-height} - #{$modal-footer-height});
231
141
  }
232
142
  }
233
- #kids-results-aborted.mu-kindergarten-context {
234
- .modal-body{
235
- height: calc(100% - #{$modal-header-height});
236
- }
237
- h4.modal-header {
238
- 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
+ }
239
153
  }
240
154
  }
241
155
 
@@ -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
  }
@@ -0,0 +1,5 @@
1
+ module GamificationHelper
2
+ def in_gamified_context?
3
+ Organization.current.gamification_enabled?
4
+ end
5
+ end
@@ -1,4 +1,13 @@
1
1
  <div class="<%= "bs-callout bs-callout-#{icon_class_for contextualization.submission_status}" %>">
2
2
  <%= render partial: 'exercise_solutions/results_title', locals: {contextualization: contextualization} %>
3
+
4
+ <% if in_gamified_context? %>
5
+ <div id="mu-exp-earned-message" class="hidden">
6
+ <span><%= t(:you_earned) %></span>
7
+ <strong><span id="mu-exp-points"></span></strong>
8
+ <span><%= t(:exp_points) %></span>
9
+ </div>
10
+ <% end %>
11
+
3
12
  <%= yield %>
4
13
  </div>
@@ -0,0 +1,11 @@
1
+ <div>
2
+ <h3 class="text-center">
3
+ <%= t :level_up %>
4
+ </h3>
5
+ <div class="text-center mu-level">
6
+ <i class="fa fa-star fa-fw fa-4x"></i>
7
+ <span class="mu-level-number"></span>
8
+ <p></p>
9
+ <p id="mu-solve-more-exercises"> <%= (t :solve_more_exercises_to_level_up).html_safe %></p>
10
+ </div>
11
+ </div>
@@ -1,3 +1,8 @@
1
1
  <h4 class="text-<%= icon_class_for(contextualization.submission_status) %>">
2
2
  <strong><%= fa_icon icon_type_for(contextualization.submission_status) %> <%= t_contextualization_status contextualization %></strong>
3
+ <% if in_gamified_context? %>
4
+ <strong><small class="text-success">
5
+ <span class="mu-experience"></span>
6
+ </small></strong>
7
+ <% end %>
3
8
  </h4>
@@ -48,7 +48,6 @@
48
48
  <%= hidden_field_tag "mu-exercise-id", @exercise.id %>
49
49
  <%= hidden_field_tag "mu-exercise-layout", @exercise.layout %>
50
50
  <%= hidden_field_tag "mu-exercise-settings", @exercise.settings.to_json %>
51
- <%= hidden_field_tag "mu-current-exp", UserStats.exp_for(@current_user) %>
52
51
 
53
52
  <div style="display: none" id="processing-template">
54
53
  <div class="bs-callout bs-callout-info">
@@ -62,6 +61,10 @@
62
61
  <%= render partial: 'layouts/exercise_skipped' %>
63
62
  <% end %>
64
63
 
64
+ <% if in_gamified_context? %>
65
+ <%= render partial: 'layouts/modals/level_up' %>
66
+ <% end %>
67
+
65
68
  <%= render partial: 'layouts/modals/guide_corollary', locals: {guide: @guide} %>
66
69
  <%= render partial: 'layouts/modals/new_message', locals: {exercise: @exercise} if should_render_message_input?(@exercise) %>
67
70
  <% end if current_user? %>
@@ -4,7 +4,7 @@
4
4
  <div class="mu-kindergarten-character-speech-bubble">
5
5
  <span class="mu-kindergarten-exercise-description"><%= exercise.description_task %></span>
6
6
  <div class="mu-kindergarten-buttons">
7
- <button class="mu-kindergarten-show-context" onclick="mumuki.kids.context.showContext()">
7
+ <button class="mu-kindergarten-show-context" onclick="mumuki.kids.context.show()">
8
8
  <img class="mu-kindergarten-button-image" src="https://mumuki.io/static/show-context.svg" alt="">
9
9
  </button>
10
10
  <button class="mu-kindergarten-play-description" onclick="mumuki.kids.speech.click('.mu-kindergarten-exercise-description', '<%= exercise.locale %>')">
@@ -1,4 +1,5 @@
1
1
  <%= content_for :navbar do %>
2
+ <%= hidden_field_tag("mu-current-exp", UserStats.exp_for(@current_user)) if in_gamified_context? %>
2
3
  <div class="<%= exercise_container_type %>">
3
4
  <nav class="mu-navbar">
4
5
  <div class="mu-navbar-breadcrumb hidden-xs">
@@ -18,16 +19,20 @@
18
19
  </div>
19
20
  <div class="mu-navbar-avatar">
20
21
  <% if current_logged_user? %>
22
+ <% if in_gamified_context? %>
23
+ <i class="fa fa-star fa-fw fa-2x navbar-icon mu-level-tooltip" data-toggle="tooltip" data-placement="bottom" title="<%= t(:level) %>"></i>
24
+ <span class="mu-level-number"></span>
25
+ <% end %>
21
26
  <div class="dropdown">
22
27
  <span>
23
28
  <a class="notifications-box <%= has_notifications? ? '' : 'notifications-box-empty' %>" href=<%= "#{user_notifications_path}" %>>
24
- <i class="fa fa-bell fa-fw fa-lg"></i>
29
+ <i class="fa fa-bell fa-fw fa-2x navbar-icon"></i>
25
30
  <span class="badge badge-notifications"><%= notifications_count %></span>
26
31
  </a>
27
32
  </span>
28
33
  </div>
29
34
  <div class="dropdown">
30
- <div id="profileDropdown" class="profile-dropdown" data-toggle="dropdown" aria-label="<%= t(:user) %>" role="menu" tabindex="0">
35
+ <div id="profileDropdown" class="profile-dropdown navbar-icon" data-toggle="dropdown" aria-label="<%= t(:user) %>" role="menu" tabindex="0">
31
36
  <%= profile_picture_for current_user %>
32
37
  <span class="caret"></span>
33
38
  </div>
@@ -76,3 +81,4 @@
76
81
  <% end %>
77
82
 
78
83
  <%= render partial: 'layouts/main' %>
84
+
@@ -1,4 +1,4 @@
1
- <div class="modal fade guide-corollary" id="guide-done" tabindex="-1" role="dialog" aria-hidden="true">
1
+ <div class="modal fade guide-corollary mu-kids-modal-border" id="guide-done" tabindex="-1" role="dialog" aria-hidden="true">
2
2
  <div class="modal-dialog">
3
3
  <div class="modal-content">
4
4
  <div class="modal-header">
@@ -1,4 +1,4 @@
1
- <div class="modal fade mu-kids-context" id="mu-kids-context" tabindex="-1" role="dialog" aria-hidden="true">
1
+ <div class="modal fade mu-kids-context mu-kids-modal-border" id="mu-kids-context" tabindex="-1" role="dialog" aria-hidden="true">
2
2
  <div class="modal-dialog">
3
3
  <div class="modal-content">
4
4
  <div class="modal-header">
@@ -1,17 +1,27 @@
1
- <div class="modal fade mu-kids-results" id="kids-results" tabindex="-1" role="dialog" aria-hidden="true">
1
+ <div class="modal fade mu-kids-results mu-kids-modal-border" id="kids-results" tabindex="-1" role="dialog" aria-hidden="true">
2
2
  <div class="modal-dialog">
3
- <div class="modal-content">
4
- <div class="modal-header">
3
+ <div class="modal-content success">
4
+ <button type="button" class="mu-kids-modal-button mu-previous hidden" onclick="mumuki.kids.resultsCarrousel.prevSlide()" aria-label="Previous">
5
+ <span aria-hidden="true">
6
+ <i class="fa fa-fw fa-arrow-left fa-3x"></i>
7
+ </span>
8
+ </button>
9
+ <button type="button" class="mu-kids-modal-button mu-next" onclick="mumuki.kids.resultsCarrousel.nextSlide()" aria-label="Next">
10
+ <span aria-hidden="true">
11
+ <i class="fa fa-fw fa-arrow-right fa-3x"></i>
12
+ </span>
13
+ </button>
14
+ <div class="modal-header text-center">
5
15
  </div>
6
16
  <div class="modal-body">
7
17
  <div class="container-fluid">
8
18
  <div class="row">
9
19
  <div class="col-md-12">
10
- <div class="row">
11
- <div class="col-md-12 submission-results">
20
+ <div class="mu-kids-results-carrousel">
21
+ <div class="active submission-results">
12
22
  <% if current_user? && @assignment.solved? %>
13
23
  <%= render partial: 'exercise_solutions/kids_results',
14
- locals: {assignment: @assignment, guide_finished_by_solution: false} %>
24
+ locals: {assignment: @assignment, guide_finished_by_solution: false} %>
15
25
  <% end %>
16
26
  </div>
17
27
  </div>
@@ -1,22 +1,22 @@
1
- <div class="modal fade mu-kindergarten-context" id="mu-kids-context" tabindex="-1" role="dialog" aria-hidden="true">
1
+ <div class="modal fade mu-kids-modal-border" id="mu-kids-context" tabindex="-1" role="dialog" aria-hidden="true">
2
2
  <div class="modal-dialog">
3
- <div class="modal-content">
4
- <button type="button" class="mu-kindergarten-modal-button mu-close" data-waiting="" data-dismiss="modal" aria-label="Close">
5
- <span aria-hidden="true">
6
- <i class="fa fa-fw fa-times fa-3x"></i>
7
- </span>
3
+ <div class="modal-content kindergarten">
4
+ <button type="button" class="mu-kids-modal-button mu-close" data-waiting="" data-dismiss="modal" aria-label="Close">
5
+ <span aria-hidden="true">
6
+ <i class="fa fa-fw fa-times fa-3x"></i>
7
+ </span>
8
8
  </button>
9
- <button type="button" class="mu-kindergarten-modal-button mu-previous hidden" onclick="mumuki.kids.context.prevSlide()" aria-label="Previous">
10
- <span aria-hidden="true">
11
- <i class="fa fa-fw fa-arrow-left fa-3x"></i>
12
- </span>
9
+ <button type="button" class="mu-kids-modal-button mu-previous hidden" onclick="mumuki.kids.context.prevSlide()" aria-label="Previous">
10
+ <span aria-hidden="true">
11
+ <i class="fa fa-fw fa-arrow-left fa-3x"></i>
12
+ </span>
13
13
  </button>
14
- <button type="button" class="mu-kindergarten-modal-button mu-next" onclick="mumuki.kids.context.nextSlide()" aria-label="Next">
15
- <span aria-hidden="true">
16
- <i class="fa fa-fw fa-arrow-right fa-3x"></i>
17
- </span>
14
+ <button type="button" class="mu-kids-modal-button mu-next" onclick="mumuki.kids.context.nextSlide()" aria-label="Next">
15
+ <span aria-hidden="true">
16
+ <i class="fa fa-fw fa-arrow-right fa-3x"></i>
17
+ </span>
18
18
  </button>
19
- <div class="modal-body">
19
+ <div class="modal-body mu-kids-context-body">
20
20
  <div class="container-fluid">
21
21
  <div class="row">
22
22
  <div class="col-md-12">
@@ -1,17 +1,30 @@
1
- <div class="modal fade mu-kids-results mu-kindergarten-context" id="kids-results" tabindex="-1" role="dialog" aria-hidden="true">
1
+ <div class="modal fade mu-kids-results mu-kids-modal-border" id="kids-results" tabindex="-1" role="dialog" aria-hidden="true">
2
2
  <div class="modal-dialog">
3
- <div class="modal-content">
4
- <button type="button" class="mu-kindergarten-modal-button mu-close" data-dismiss="modal" aria-label="Close">
5
- <span aria-hidden="true">
6
- <i class="fa fa-fw fa-times fa-3x"></i>
7
- </span>
3
+ <div class="modal-content kindergarten">
4
+ <button type="button" class="mu-kids-modal-button mu-close" data-waiting="" data-dismiss="modal" aria-label="Close">
5
+ <span aria-hidden="true">
6
+ <i class="fa fa-fw fa-times fa-3x"></i>
7
+ </span>
8
+ </button>
9
+ <button type="button" class="mu-kids-modal-button mu-previous hidden" onclick="mumuki.kids.resultsCarrousel.prevSlide()" aria-label="Previous">
10
+ <span aria-hidden="true">
11
+ <i class="fa fa-fw fa-arrow-left fa-3x"></i>
12
+ </span>
13
+ </button>
14
+ <button type="button" class="mu-kids-modal-button mu-next" onclick="mumuki.kids.resultsCarrousel.nextSlide()" aria-label="Next">
15
+ <span aria-hidden="true">
16
+ <i class="fa fa-fw fa-arrow-right fa-3x"></i>
17
+ </span>
8
18
  </button>
9
19
  <div class="modal-header">
10
20
  </div>
11
21
  <div class="modal-body">
12
22
  <div class="container-fluid">
13
23
  <div class="row">
14
- <div class="col-md-12 submission-results">
24
+ <div class="col-md-12">
25
+ <div class="mu-kids-results-carrousel">
26
+ <div class="active submission-results kindergarten"></div>
27
+ </div>
15
28
  </div>
16
29
  </div>
17
30
  </div>