mumuki-laboratory 7.12.1 → 8.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mumuki_laboratory/application/bridge.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/button.js +2 -2
- data/app/assets/javascripts/mumuki_laboratory/application/codemirror-builder.js +2 -2
- data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +5 -5
- data/app/assets/javascripts/mumuki_laboratory/application/console.js +2 -2
- data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +7 -7
- data/app/assets/javascripts/mumuki_laboratory/application/editors.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/elipsis.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/events.js +2 -2
- data/app/assets/javascripts/mumuki_laboratory/application/exercise.js +2 -2
- data/app/assets/javascripts/mumuki_laboratory/application/gamification.js +99 -11
- data/app/assets/javascripts/mumuki_laboratory/application/inputs.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/kids.js +20 -8
- data/app/assets/javascripts/mumuki_laboratory/application/kindergarten.js +16 -57
- data/app/assets/javascripts/mumuki_laboratory/application/messages.js +6 -6
- data/app/assets/javascripts/mumuki_laboratory/application/mu-modal-carrousel.js +63 -0
- data/app/assets/javascripts/mumuki_laboratory/application/multiple-choice.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/multiple-files.js +3 -3
- data/app/assets/javascripts/mumuki_laboratory/application/multiple-scenarios.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/number-counter.js +18 -0
- data/app/assets/javascripts/mumuki_laboratory/application/pin.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/primary.js +3 -2
- data/app/assets/javascripts/mumuki_laboratory/application/progress.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/results-renderer.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/speech-bubble-renderer.js +4 -4
- data/app/assets/javascripts/mumuki_laboratory/application/submission.js +3 -3
- data/app/assets/javascripts/mumuki_laboratory/application/submissions-store.js +3 -3
- data/app/assets/javascripts/mumuki_laboratory/application/sync-mode.js +2 -2
- data/app/assets/javascripts/mumuki_laboratory/application/timer.js +1 -1
- data/app/assets/stylesheets/mumuki_laboratory/application/_layout.scss +7 -7
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids_results.scss +117 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kindergarten.scss +45 -131
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_terms.scss +9 -12
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +31 -3
- data/app/controllers/api/courses_controller.rb +1 -2
- data/app/controllers/api/organizations_controller.rb +2 -3
- data/app/controllers/api/users_controller.rb +2 -4
- data/app/controllers/application_controller.rb +41 -8
- data/app/controllers/assets_controller.rb +1 -0
- data/app/controllers/book_discussions_controller.rb +1 -1
- data/app/controllers/chapters_controller.rb +1 -0
- data/app/controllers/concerns/with_user_discussion_validation.rb +6 -0
- data/app/controllers/discussions_controller.rb +4 -6
- data/app/controllers/exercises_controller.rb +1 -0
- data/app/controllers/guides_controller.rb +2 -0
- data/app/controllers/invitations_controller.rb +2 -2
- data/app/controllers/lessons_controller.rb +1 -0
- data/app/controllers/login_controller.rb +1 -0
- data/app/controllers/users_controller.rb +9 -1
- data/app/helpers/assistance_box_helper.rb +7 -5
- data/app/helpers/gamification_helper.rb +5 -0
- data/app/helpers/links_helper.rb +2 -2
- data/app/views/exercise_solutions/_assistant_rules_box.html.erb +13 -0
- data/app/views/exercise_solutions/_contextualization_results_container.html.erb +9 -0
- data/app/views/exercise_solutions/_kids_level_up.html.erb +11 -0
- data/app/views/exercise_solutions/_results.html.erb +19 -19
- data/app/views/exercise_solutions/_results_title.html.erb +5 -0
- data/app/views/exercises/show.html.erb +4 -1
- data/app/views/layouts/_copyright.html.erb +1 -1
- data/app/views/layouts/_kindergarten.html.erb +1 -1
- data/app/views/layouts/_organizations_listing.html.erb +8 -12
- data/app/views/layouts/application.html.erb +23 -15
- data/app/views/layouts/embedded.html.erb +14 -11
- data/app/views/layouts/modals/_guide_corollary.html.erb +1 -1
- data/app/views/layouts/modals/_kids_context.html.erb +1 -1
- data/app/views/layouts/modals/_kids_results.html.erb +16 -6
- data/app/views/layouts/modals/_kindergarten_context.html.erb +15 -15
- data/app/views/layouts/modals/_kindergarten_results.html.erb +20 -7
- data/app/views/layouts/modals/_kindergarten_results_aborted.html.erb +4 -4
- data/app/views/layouts/modals/_level_up.html.erb +27 -0
- data/app/views/users/_edit_user_form.html.erb +1 -1
- data/app/views/users/_user_form.html.erb +12 -2
- data/app/views/users/terms.html.erb +12 -0
- data/config/routes.rb +8 -8
- data/lib/mumuki/laboratory.rb +18 -5
- data/lib/mumuki/laboratory/controllers.rb +2 -0
- data/lib/mumuki/laboratory/controllers/action_redirector.rb +21 -0
- data/lib/mumuki/laboratory/controllers/immersive_navigation.rb +7 -0
- data/lib/mumuki/laboratory/controllers/results_rendering.rb +1 -0
- data/lib/mumuki/laboratory/events/events.rb +0 -33
- data/lib/mumuki/laboratory/locales/en.yml +5 -0
- data/lib/mumuki/laboratory/locales/es-CL.yml +6 -1
- data/lib/mumuki/laboratory/locales/es.yml +7 -2
- data/lib/mumuki/laboratory/locales/pt.yml +6 -1
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/capybara_helper.rb +5 -1
- data/spec/controllers/discussions_controller_spec.rb +19 -0
- data/spec/controllers/exercise_solutions_controller_spec.rb +1 -1
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/features/immersive_redirection_spec.rb +181 -0
- data/spec/features/profile_flow_spec.rb +35 -3
- data/spec/features/terms_flow_spec.rb +155 -0
- metadata +110 -101
- data/app/helpers/organization_list_helper.rb +0 -5
- data/spec/features/choose_organization_spec.rb +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d366cf0d6d349759281213746e2c6a6f1a998db2d07efa9dc45b02480487108e
|
4
|
+
data.tar.gz: 0c890e15fa8b8f3164372b7c8f6844b17e85ded1686bb1c4d0947d9a08b7cd6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ff7d88d695024cbd9feac650c31b77055291f280791b262ddf6c6477f54a2e7ef0d858bbe4668594e88b755dd5ab1934ac7b8acc045acf02360ddae9dca8d7f
|
7
|
+
data.tar.gz: 555cfdee07fa9e97d62507360fda991dfd6bf16668093d6af44ab6f6ee79dcf22ab57aaf08d49a2e434767bd3a7dadfb8316321b22d3efa0e0b0f19f5ad7c1e0
|
@@ -113,7 +113,7 @@ mumuki.bridge = (() => {
|
|
113
113
|
* @returns {SubmissionResult}
|
114
114
|
*/
|
115
115
|
_preRenderResult(result) {
|
116
|
-
result.class_for_progress_list_item = mumuki.renderers.progressListItemClassForStatus(result.status, true)
|
116
|
+
result.class_for_progress_list_item = mumuki.renderers.progressListItemClassForStatus(result.status, true);
|
117
117
|
return result;
|
118
118
|
}
|
119
119
|
}
|
@@ -36,7 +36,7 @@ mumuki.Button = class {
|
|
36
36
|
e.preventDefault();
|
37
37
|
main();
|
38
38
|
};
|
39
|
-
this.$button.on('click', this.main)
|
39
|
+
this.$button.on('click', this.main);
|
40
40
|
}
|
41
41
|
|
42
42
|
// ==============
|
@@ -80,7 +80,7 @@ mumuki.Button = class {
|
|
80
80
|
|
81
81
|
this.enable();
|
82
82
|
|
83
|
-
this.$button.on('click', this.main)
|
83
|
+
this.$button.on('click', this.main);
|
84
84
|
}
|
85
85
|
|
86
86
|
// =============
|
@@ -38,7 +38,7 @@
|
|
38
38
|
mumuki.editor.toggleFullscreen();
|
39
39
|
},
|
40
40
|
'Tab': function (cm) {
|
41
|
-
mumuki.editor.indentWithSpaces(cm)
|
41
|
+
mumuki.editor.indentWithSpaces(cm);
|
42
42
|
}
|
43
43
|
}
|
44
44
|
});
|
@@ -53,7 +53,7 @@
|
|
53
53
|
'Cmd-Enter': submitMessage,
|
54
54
|
'Ctrl-Enter': submitMessage,
|
55
55
|
'Tab': function (cm) {
|
56
|
-
mumuki.editor.indentWithSpaces(cm)
|
56
|
+
mumuki.editor.indentWithSpaces(cm);
|
57
57
|
}
|
58
58
|
}
|
59
59
|
});
|
@@ -23,14 +23,14 @@ mumuki.page.editors = [];
|
|
23
23
|
function resetEditor() {
|
24
24
|
mumuki.page.dynamicEditors.forEach(function (e) {
|
25
25
|
setDefaultContent(e, $('#default_content').val());
|
26
|
-
})
|
26
|
+
});
|
27
27
|
}
|
28
28
|
|
29
29
|
function formatContent() {
|
30
30
|
mumuki.page.editors.each(function (_, editor) {
|
31
|
-
editor.setSelection({line: 0, ch: 0}, {line: editor.lineCount()})
|
32
|
-
editor.indentSelection("smart")
|
33
|
-
editor.setSelection({line: 0})
|
31
|
+
editor.setSelection({line: 0, ch: 0}, {line: editor.lineCount()});
|
32
|
+
editor.indentSelection("smart");
|
33
|
+
editor.setSelection({line: 0});
|
34
34
|
});
|
35
35
|
}
|
36
36
|
|
@@ -56,7 +56,7 @@ mumuki.page.editors = [];
|
|
56
56
|
if (language !== undefined) {
|
57
57
|
mumuki.page.dynamicEditors.forEach(function (e) {
|
58
58
|
setEditorLanguage(e, language);
|
59
|
-
})
|
59
|
+
});
|
60
60
|
}
|
61
61
|
}
|
62
62
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
function clearConsole() {
|
33
33
|
$('.jquery-console-message-error').remove();
|
34
34
|
$('.jquery-console-message-value').remove();
|
35
|
-
$('.jquery-console-prompt-box:not(:last)').remove()
|
35
|
+
$('.jquery-console-prompt-box:not(:last)').remove();
|
36
36
|
}
|
37
37
|
|
38
38
|
class QueryConsole {
|
@@ -134,7 +134,7 @@
|
|
134
134
|
url: self._requestUrl,
|
135
135
|
type: 'POST',
|
136
136
|
data: self._requestData
|
137
|
-
})
|
137
|
+
});
|
138
138
|
}
|
139
139
|
get _requestUrl() {
|
140
140
|
return this.console.endpoint;
|
@@ -34,33 +34,33 @@ mumuki.load(() => {
|
|
34
34
|
},
|
35
35
|
token: new mumuki.CsrfToken(),
|
36
36
|
tokenRequest: function (data) {
|
37
|
-
return $.ajax(Forum.token.newRequest(data))
|
37
|
+
return $.ajax(Forum.token.newRequest(data));
|
38
38
|
},
|
39
39
|
discussionPost: function (url) {
|
40
40
|
return Forum.tokenRequest({
|
41
41
|
url: url,
|
42
42
|
method: 'POST',
|
43
43
|
xhrFields: {withCredentials: true}
|
44
|
-
})
|
44
|
+
});
|
45
45
|
},
|
46
46
|
discussionSubscription: function (url) {
|
47
|
-
Forum.discussionPostAndToggle(url, $subscriptionSpans)
|
47
|
+
Forum.discussionPostAndToggle(url, $subscriptionSpans);
|
48
48
|
},
|
49
49
|
discussionUpvote: function (url) {
|
50
|
-
Forum.discussionPostAndToggle(url, $upvoteSpans)
|
50
|
+
Forum.discussionPostAndToggle(url, $upvoteSpans);
|
51
51
|
},
|
52
52
|
discussionPostAndToggle: function (url, elem) {
|
53
|
-
Forum.discussionPost(url).done(Forum.toggleButton(elem))
|
53
|
+
Forum.discussionPost(url).done(Forum.toggleButton(elem));
|
54
54
|
},
|
55
55
|
discussionMessageToggleApprove: function (url, elem) {
|
56
56
|
Forum.discussionPost(url).done(function () {
|
57
57
|
elem.toggleClass("selected");
|
58
|
-
})
|
58
|
+
});
|
59
59
|
},
|
60
60
|
discussionMessageToggleNotActuallyAQuestion: function (url, elem) {
|
61
61
|
Forum.discussionPost(url).done(function () {
|
62
62
|
elem.toggleClass("selected");
|
63
|
-
})
|
63
|
+
});
|
64
64
|
},
|
65
65
|
discussionsToggleCheckbox: function (elem) {
|
66
66
|
const key = elem.attr('name');
|
@@ -34,7 +34,7 @@ mumuki.events = {
|
|
34
34
|
*/
|
35
35
|
fire(eventName, value = null) {
|
36
36
|
if (this._handlers[eventName]) {
|
37
|
-
this._handlers[eventName].forEach(it => it(value))
|
37
|
+
this._handlers[eventName].forEach(it => it(value));
|
38
38
|
}
|
39
39
|
},
|
40
40
|
|
@@ -48,4 +48,4 @@ mumuki.events = {
|
|
48
48
|
this._handlers[eventName] = [];
|
49
49
|
}
|
50
50
|
}
|
51
|
-
}
|
51
|
+
};
|
@@ -5,9 +5,22 @@ mumuki.gamification = (() => {
|
|
5
5
|
static get CONSTANT_TERM() { return -125; }
|
6
6
|
}
|
7
7
|
|
8
|
+
class DummyLevelProgression {
|
9
|
+
setExpMessage() {}
|
10
|
+
|
11
|
+
registerLevelUpAction() {}
|
12
|
+
|
13
|
+
registerGainedExperienceAction() {}
|
14
|
+
|
15
|
+
updateLevel() {}
|
16
|
+
}
|
17
|
+
|
8
18
|
class LevelProgression {
|
9
19
|
constructor(currentExp) {
|
10
20
|
this.currentExp = currentExp;
|
21
|
+
this.lastEarnedExp = 0;
|
22
|
+
this._levelUpAction = this.defaultLevelUpAction;
|
23
|
+
this._gainedExperienceAction = this.defaultGainedExperienceAction;
|
11
24
|
}
|
12
25
|
|
13
26
|
expToLevelUp() {
|
@@ -38,8 +51,8 @@ mumuki.gamification = (() => {
|
|
38
51
|
return Math.floor((-b + Math.sqrt(Math.pow(b, 2) - 4 * a * (c - exp))) / (2 * a));
|
39
52
|
}
|
40
53
|
|
41
|
-
triggersLevelChange(
|
42
|
-
return this.levelFor(
|
54
|
+
triggersLevelChange(newExp) {
|
55
|
+
return this.levelFor(this.currentExp + newExp) !== this.currentLevel();
|
43
56
|
}
|
44
57
|
|
45
58
|
currentLevelProgress() {
|
@@ -50,23 +63,97 @@ mumuki.gamification = (() => {
|
|
50
63
|
return this.expFor(this.currentLevel());
|
51
64
|
}
|
52
65
|
|
53
|
-
|
54
|
-
|
66
|
+
exercisesToNextLevel() {
|
67
|
+
return Math.ceil(this.expToLevelUp() / 100);
|
68
|
+
}
|
69
|
+
|
70
|
+
setExpMessage(data) {
|
71
|
+
const exp = data.current_exp;
|
72
|
+
this.lastEarnedExp = exp - this.currentExp;
|
73
|
+
|
74
|
+
if (this.lastEarnedExp > 0) {
|
75
|
+
this.levelUpActionIfLevelUp(data.level_up_html);
|
76
|
+
this._gainedExperienceAction();
|
55
77
|
|
56
|
-
if (expGained > 0) {
|
57
78
|
this.currentExp = exp;
|
58
|
-
|
59
|
-
|
79
|
+
this.updateLevel();
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
defaultGainedExperienceAction() {
|
84
|
+
$('#mu-exp-points').html(this.lastEarnedExp);
|
85
|
+
$('#mu-exp-earned-message').removeClass('hidden');
|
86
|
+
}
|
87
|
+
|
88
|
+
defaultLevelUpAction(_levelUpHtml) {
|
89
|
+
$('#mu-level-up').modal();
|
90
|
+
}
|
91
|
+
|
92
|
+
registerLevelUpAction(action) {
|
93
|
+
this._levelUpAction = action;
|
94
|
+
}
|
95
|
+
|
96
|
+
registerGainedExperienceAction(action) {
|
97
|
+
this._gainedExperienceAction = action;
|
98
|
+
}
|
99
|
+
|
100
|
+
levelUpActionIfLevelUp(levelUpHtml) {
|
101
|
+
if (this.triggersLevelChange(this.lastEarnedExp)) {
|
102
|
+
this._levelUpAction(levelUpHtml);
|
60
103
|
}
|
61
104
|
}
|
105
|
+
|
106
|
+
animateExperienceCounter(selector) {
|
107
|
+
mumuki.animateNumberCounter(selector, this.lastEarnedExp);
|
108
|
+
}
|
109
|
+
|
110
|
+
updateLevel() {
|
111
|
+
$('#mu-solve-more-exercises span').text(this.exercisesToNextLevel());
|
112
|
+
$('.mu-level-number').html(this.currentLevel());
|
113
|
+
|
114
|
+
this.updateTooltip();
|
115
|
+
this.animateProgressIfAny();
|
116
|
+
}
|
117
|
+
|
118
|
+
updateTooltip() {
|
119
|
+
const $muLevelTooltip = $('.mu-level-tooltip');
|
120
|
+
|
121
|
+
$muLevelTooltip.attr("data-original-title", `${$muLevelTooltip.attr("level")} ${this.currentLevel()}`);
|
122
|
+
$muLevelTooltip.attr("title", "");
|
123
|
+
}
|
124
|
+
|
125
|
+
animateProgressIfAny() {
|
126
|
+
const $muLevelProgress = $('#mu-level-progress');
|
127
|
+
if (this.currentLevelProgress() === 0) {
|
128
|
+
$muLevelProgress.attr("display", "none");
|
129
|
+
}
|
130
|
+
|
131
|
+
$muLevelProgress.animate(
|
132
|
+
{'progress': this.currentLevelProgress() * 250},
|
133
|
+
{
|
134
|
+
step: function(progress) {
|
135
|
+
let pattern = progress + ", 999";
|
136
|
+
$(this).attr("stroke-dasharray", pattern);
|
137
|
+
},
|
138
|
+
duration: 1000
|
139
|
+
});
|
140
|
+
}
|
62
141
|
}
|
63
142
|
|
64
143
|
function _setUpCurrentLevelProgression() {
|
65
|
-
|
144
|
+
if (_gamificationEnabled()) {
|
145
|
+
mumuki.gamification.currentLevelProgression = new LevelProgression(currentExp());
|
146
|
+
} else {
|
147
|
+
mumuki.gamification.currentLevelProgression = new DummyLevelProgression();
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
function _gamificationEnabled() {
|
152
|
+
return $('#mu-current-exp').length;
|
66
153
|
}
|
67
154
|
|
68
155
|
function currentExp() {
|
69
|
-
return $('#mu-current-exp').val();
|
156
|
+
return parseInt($('#mu-current-exp').val());
|
70
157
|
}
|
71
158
|
|
72
159
|
return {
|
@@ -75,11 +162,12 @@ mumuki.gamification = (() => {
|
|
75
162
|
|
76
163
|
_setUpCurrentLevelProgression,
|
77
164
|
|
78
|
-
/** @type {LevelProgression} */
|
79
|
-
|
165
|
+
/** @type {LevelProgression|DummyLevelProgression} */
|
166
|
+
currentLevelProgression: null
|
80
167
|
};
|
81
168
|
})();
|
82
169
|
|
83
170
|
mumuki.load(() => {
|
84
171
|
mumuki.gamification._setUpCurrentLevelProgression();
|
172
|
+
mumuki.gamification.currentLevelProgression.updateLevel();
|
85
173
|
});
|
@@ -21,9 +21,20 @@ mumuki.Kids = class {
|
|
21
21
|
this.$stateImage = $('.mu-kids-state-image');
|
22
22
|
this.$contextModal = $('#mu-kids-context');
|
23
23
|
this.$resultsModal = $('#kids-results');
|
24
|
+
this.resultsCarrousel = new mumuki.ModalCarrousel('.mu-kids-results-carrousel');
|
24
25
|
this.$resultsAbortedModal = $('#kids-results-aborted');
|
25
26
|
this.$bubbleCharacterAnimation = $('.mu-kids-character-animation');
|
26
27
|
this.$submissionResult = $('.submission-results');
|
28
|
+
mumuki.gamification.currentLevelProgression.registerLevelUpAction(this.levelUpAction);
|
29
|
+
mumuki.gamification.currentLevelProgression.registerGainedExperienceAction(this.gainedExperienceAction);
|
30
|
+
}
|
31
|
+
|
32
|
+
gainedExperienceAction() {
|
33
|
+
mumuki.gamification.currentLevelProgression.animateExperienceCounter('.mu-kids-results .mu-experience');
|
34
|
+
}
|
35
|
+
|
36
|
+
levelUpAction(levelUpHtml) {
|
37
|
+
$('.mu-kids-results-carrousel').append(levelUpHtml);
|
27
38
|
}
|
28
39
|
|
29
40
|
showContext() {
|
@@ -50,11 +61,11 @@ mumuki.Kids = class {
|
|
50
61
|
// ==================
|
51
62
|
|
52
63
|
_showSuccessPopup() {
|
53
|
-
this._mustImplementThisMethod()
|
64
|
+
this._mustImplementThisMethod();
|
54
65
|
}
|
55
66
|
|
56
67
|
_showFailurePopup() {
|
57
|
-
this._mustImplementThisMethod()
|
68
|
+
this._mustImplementThisMethod();
|
58
69
|
}
|
59
70
|
|
60
71
|
// ====================
|
@@ -74,7 +85,7 @@ mumuki.Kids = class {
|
|
74
85
|
}
|
75
86
|
|
76
87
|
onSubmissionResultModalOpen(_data) {
|
77
|
-
|
88
|
+
this.resultsCarrousel.show();
|
78
89
|
}
|
79
90
|
|
80
91
|
// =================
|
@@ -82,9 +93,10 @@ mumuki.Kids = class {
|
|
82
93
|
// =================
|
83
94
|
|
84
95
|
_openSubmissionResultModal(data) {
|
85
|
-
this.$resultsModal.modal({ backdrop: 'static', keyboard: false })
|
86
|
-
this.$resultsModal.find('.modal-header').first().html(data.title_html)
|
87
|
-
|
96
|
+
this.$resultsModal.modal({ backdrop: 'static', keyboard: false });
|
97
|
+
this.$resultsModal.find('.modal-header').first().html(data.title_html);
|
98
|
+
mumuki.gamification.currentLevelProgression.setExpMessage(data);
|
99
|
+
this.$resultsModal.find('.modal-footer').first().html(data.button_html);
|
88
100
|
$('.mu-close-modal').click(() => this.$resultsModal.modal('hide'));
|
89
101
|
this.onSubmissionResultModalOpen(data);
|
90
102
|
}
|
@@ -129,7 +141,7 @@ mumuki.Kids = class {
|
|
129
141
|
// ============
|
130
142
|
|
131
143
|
_mustImplementThisMethod() {
|
132
|
-
throw new Error('TODO: implement method')
|
144
|
+
throw new Error('TODO: implement method');
|
133
145
|
}
|
134
146
|
|
135
147
|
// ============
|
@@ -202,4 +214,4 @@ mumuki.Kids = class {
|
|
202
214
|
$blockSvg.height($blocks.height());
|
203
215
|
}
|
204
216
|
|
205
|
-
}
|
217
|
+
};
|
@@ -10,7 +10,7 @@ mumuki.load(() => {
|
|
10
10
|
|
11
11
|
initialize() {
|
12
12
|
super.initialize();
|
13
|
-
this.$contextModalButton = new mumuki.Button($('#mu-kids-context .mu-
|
13
|
+
this.$contextModalButton = new mumuki.Button($('#mu-kids-context .mu-kids-modal-button.mu-close'));
|
14
14
|
|
15
15
|
this.resultActions.passed = this._showSuccessPopup.bind(this);
|
16
16
|
this.resultActions.passed_with_warnings = this._showSuccessPopup.bind(this);
|
@@ -29,10 +29,9 @@ mumuki.load(() => {
|
|
29
29
|
// ================
|
30
30
|
|
31
31
|
showNonAbortedPopup(data, animation_name) {
|
32
|
-
data.guide_finished_by_solution = false;
|
33
32
|
this.$submissionResult.html(data.title_html);
|
34
|
-
this.$resultsModal.find('.modal-content').removeClass().addClass('modal-content').addClass(data.status);
|
35
|
-
super.showNonAbortedPopup(data, animation_name
|
33
|
+
this.$resultsModal.find('.modal-content').removeClass().addClass('modal-content kindergarten').addClass(data.status);
|
34
|
+
super.showNonAbortedPopup(data, animation_name);
|
36
35
|
}
|
37
36
|
|
38
37
|
showAbortedPopup(data) {
|
@@ -72,6 +71,11 @@ mumuki.load(() => {
|
|
72
71
|
// == Called by the runner ==
|
73
72
|
// ==========================
|
74
73
|
|
74
|
+
showResult(data) {
|
75
|
+
data.guide_finished_by_solution = false;
|
76
|
+
super.showResult(data);
|
77
|
+
}
|
78
|
+
|
75
79
|
restart() {
|
76
80
|
mumuki.presenterCharacter.playAnimation('talk', this.$bubbleCharacterAnimation);
|
77
81
|
}
|
@@ -99,27 +103,27 @@ mumuki.load(() => {
|
|
99
103
|
this._action('play', 'stop', true, (speech) => {
|
100
104
|
mumuki.presenterCharacter.playAnimation('talk', mumuki.kids.$bubbleCharacterAnimation);
|
101
105
|
speech.speak(msg);
|
102
|
-
})
|
106
|
+
});
|
103
107
|
},
|
104
108
|
stop() {
|
105
|
-
this._action('stop', 'play', false, (speech) => speech.cancel())
|
109
|
+
this._action('stop', 'play', false, (speech) => speech.cancel());
|
106
110
|
},
|
107
111
|
_action(add, remove, isPlaying, callback) {
|
108
112
|
callback(window.speechSynthesis);
|
109
|
-
const $button = $('.mu-kindergarten-play-description')
|
113
|
+
const $button = $('.mu-kindergarten-play-description');
|
110
114
|
$button.find(`.mu-kindergarten-${add}`).addClass('hidden');
|
111
115
|
$button.find(`.mu-kindergarten-${remove}`).removeClass('hidden');
|
112
116
|
this._isPlaying = isPlaying;
|
113
117
|
},
|
114
118
|
verifyBrowserSupport() {
|
115
119
|
if (!window.speechSynthesis) {
|
116
|
-
const $button = $('.mu-kindergarten-play-description')
|
120
|
+
const $button = $('.mu-kindergarten-play-description');
|
117
121
|
$button.prop('disabled', true);
|
118
122
|
$button.css('cursor', 'not-allowed');
|
119
|
-
this._action('play', 'stop', false)
|
123
|
+
this._action('play', 'stop', false);
|
120
124
|
}
|
121
125
|
}
|
122
|
-
}
|
126
|
+
};
|
123
127
|
|
124
128
|
}
|
125
129
|
|
@@ -139,56 +143,11 @@ mumuki.load(() => {
|
|
139
143
|
const $hintMedia = $('.mu-kindergarten-hint-media');
|
140
144
|
if (!$hintMedia.get(0)) $button.addClass('hidden');
|
141
145
|
},
|
142
|
-
}
|
146
|
+
};
|
143
147
|
}
|
144
148
|
|
145
149
|
get context() {
|
146
|
-
return
|
147
|
-
showContext() {
|
148
|
-
mumuki.kids.showContext();
|
149
|
-
this._showFirstSlideImage();
|
150
|
-
},
|
151
|
-
nextSlide() {
|
152
|
-
this._clickButton('next');
|
153
|
-
},
|
154
|
-
prevSlide() {
|
155
|
-
this._clickButton('prev');
|
156
|
-
},
|
157
|
-
_imageSlides() {
|
158
|
-
return $('.mu-kindergarten-context-image-slides');
|
159
|
-
},
|
160
|
-
_activeSlideImage() {
|
161
|
-
return this._imageSlides().find('.active');
|
162
|
-
},
|
163
|
-
_clickButton(prevOrNext) {
|
164
|
-
this._activeSlideImage().removeClass('active')[prevOrNext]().addClass('active');
|
165
|
-
this.showNextOrCloseButton();
|
166
|
-
this._hidePreviousButtonIfFirstImage();
|
167
|
-
},
|
168
|
-
showNextOrCloseButton() {
|
169
|
-
const $next = $('.mu-kindergarten-modal-button.mu-next');
|
170
|
-
const $close = $('.mu-kindergarten-modal-button.mu-close');
|
171
|
-
const isLastChild = this._activeSlideImage().is(':last-child');
|
172
|
-
this._addClassIf($next, 'hidden', () => isLastChild);
|
173
|
-
this._addClassIf($close, 'hidden', () => !isLastChild);
|
174
|
-
},
|
175
|
-
_hidePreviousButtonIfFirstImage() {
|
176
|
-
const $prev = $('.mu-kindergarten-modal-button.mu-previous');
|
177
|
-
this._addClassIf($prev, 'hidden', () => this._activeSlideImage().is(':first-child'))
|
178
|
-
},
|
179
|
-
_showFirstSlideImage() {
|
180
|
-
this._imageSlides().find('img').each((i, el) => this._addClassIf($(el), 'active', () => i === 0))
|
181
|
-
this.showNextOrCloseButton();
|
182
|
-
this._hidePreviousButtonIfFirstImage();
|
183
|
-
},
|
184
|
-
_addClassIf(element, clazz, criteria) {
|
185
|
-
if (criteria()) {
|
186
|
-
element.addClass(clazz)
|
187
|
-
} else {
|
188
|
-
element.removeClass(clazz);
|
189
|
-
}
|
190
|
-
}
|
191
|
-
}
|
150
|
+
return new mumuki.ModalCarrousel('.mu-kindergarten-context-image-slides', () => mumuki.kids.showContext());
|
192
151
|
}
|
193
152
|
|
194
153
|
}
|