mumuki-laboratory 8.1.1 → 8.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -8
- data/app/assets/javascripts/mumuki_laboratory/application/bridge.js +2 -1
- data/app/assets/javascripts/mumuki_laboratory/application/button.js +4 -6
- data/app/assets/javascripts/mumuki_laboratory/application/codemirror-builder.js +3 -3
- data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +6 -6
- 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 +13 -3
- data/app/assets/javascripts/mumuki_laboratory/application/i18n.js +73 -0
- data/app/assets/javascripts/mumuki_laboratory/application/inputs.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/kids.js +26 -5
- data/app/assets/javascripts/mumuki_laboratory/application/kindergarten.js +13 -8
- data/app/assets/javascripts/mumuki_laboratory/application/messages.js +6 -6
- data/app/assets/javascripts/mumuki_laboratory/application/mu-modal-carrousel.js +1 -1
- 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/pin.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/primary.js +6 -4
- data/app/assets/javascripts/mumuki_laboratory/application/progress.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/results-renderer.js +29 -2
- data/app/assets/javascripts/mumuki_laboratory/application/speech-bubble-renderer.js +4 -4
- data/app/assets/javascripts/mumuki_laboratory/application/submission.js +72 -48
- 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.scss +4 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids_results.scss +1 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_overlap.scss +0 -4
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_terms.scss +4 -0
- data/app/controllers/chapters_controller.rb +9 -5
- data/app/controllers/concerns/with_user_discussion_validation.rb +6 -0
- data/app/controllers/discussions_controller.rb +0 -6
- data/app/controllers/guide_container_controller.rb +2 -7
- data/app/helpers/assignment_result_helper.rb +1 -1
- data/app/helpers/contextualization_result_helper.rb +0 -8
- data/app/helpers/discussions_helper.rb +12 -4
- data/app/helpers/editor_tabs_helper.rb +1 -1
- data/app/helpers/icons_helper.rb +1 -1
- data/app/helpers/links_helper.rb +3 -3
- data/app/helpers/menu_bar_helper.rb +9 -1
- data/app/helpers/overlapped_buttons_helper.rb +6 -2
- data/app/views/book/show.html.erb +2 -2
- data/app/views/book_discussions/index.html.erb +3 -1
- data/app/views/chapters/show.html.erb +21 -9
- data/app/views/complements/show.html.erb +1 -1
- data/app/views/discussions/_message.html.erb +2 -2
- data/app/views/discussions/index.html.erb +11 -4
- data/app/views/exams/show.html.erb +1 -1
- data/app/views/exercise_solutions/_kids_level_up.html.erb +1 -1
- data/app/views/exercises/_exercise_assignment.html.erb +1 -1
- data/app/views/exercises/_read_only.html.erb +1 -1
- data/app/views/exercises/show.html.erb +2 -2
- data/app/views/layouts/_copyright.html.erb +1 -1
- data/app/views/layouts/_discussions.html.erb +0 -4
- data/app/views/layouts/_guide.html.erb +9 -36
- data/app/views/layouts/_guide_container.html.erb +28 -0
- data/app/views/layouts/_guide_title_icons.html.erb +9 -0
- data/app/views/layouts/_kids.html.erb +4 -4
- data/app/views/layouts/_kindergarten.html.erb +5 -5
- data/app/views/layouts/_social_media.html.erb +4 -4
- data/app/views/layouts/_timer.html.erb +1 -1
- data/app/views/layouts/application.html.erb +31 -27
- data/app/views/layouts/embedded.html.erb +14 -11
- data/app/views/layouts/exercise_inputs/editors/_code.html.erb +1 -6
- data/app/views/layouts/exercise_inputs/editors/_multiple_files.html.erb +4 -9
- data/app/views/layouts/exercise_inputs/forms/_problem_form.html.erb +1 -1
- data/app/views/layouts/exercise_inputs/layouts/_input_kindergarten.html.erb +1 -1
- data/app/views/layouts/modals/_guide_corollary.html.erb +13 -3
- data/app/views/layouts/modals/_kids_results.html.erb +2 -2
- data/app/views/layouts/modals/_kindergarten_context.html.erb +3 -3
- data/app/views/layouts/modals/_kindergarten_results.html.erb +3 -3
- data/app/views/layouts/modals/_kindergarten_results_aborted.html.erb +2 -2
- data/app/views/layouts/modals/_level_up.html.erb +1 -1
- data/app/views/lessons/show.html.erb +1 -1
- data/app/views/users/_edit_user_form.html.erb +1 -1
- data/app/views/users/_term.html.erb +1 -1
- data/app/views/users/_user_form.html.erb +1 -1
- data/lib/mumuki/laboratory/controllers/results_rendering.rb +2 -1
- data/lib/mumuki/laboratory/engine.rb +1 -1
- data/lib/mumuki/laboratory/locales/en.yml +5 -8
- data/lib/mumuki/laboratory/locales/es-CL.yml +5 -3
- data/lib/mumuki/laboratory/locales/es.yml +8 -10
- data/lib/mumuki/laboratory/locales/pt.yml +5 -8
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/controllers/discussions_controller_spec.rb +19 -0
- data/spec/controllers/exercise_solutions_controller_spec.rb +3 -2
- data/spec/dummy/db/schema.rb +50 -1
- data/spec/dummy/public/character/animations.json +1 -0
- data/{public → spec/dummy/public}/character/kibi/context.svg +0 -0
- data/{public → spec/dummy/public}/character/kibi/failure.svg +0 -0
- data/{public → spec/dummy/public}/character/kibi/jump.svg +0 -0
- data/spec/dummy/public/character/kibi/passed_with_warnings.svg +4 -0
- data/{public → spec/dummy/public}/character/kibi/success2_l.svg +0 -0
- data/{public → spec/dummy/public}/character/kibi/success_l.svg +0 -0
- data/{public → spec/dummy/public}/character/magnifying_glass/apparition.svg +0 -0
- data/{public → spec/dummy/public}/character/magnifying_glass/loop.svg +0 -0
- data/spec/features/chapters_flow_spec.rb +112 -0
- data/spec/features/login_flow_spec.rb +1 -1
- data/spec/features/terms_flow_spec.rb +2 -0
- data/spec/features/topic_flow_spec.rb +0 -1
- data/spec/helpers/icons_helper_spec.rb +3 -3
- data/spec/helpers/test_results_rendering_spec.rb +8 -8
- data/spec/helpers/with_navigation_spec.rb +14 -14
- data/spec/javascripts/gamification-spec.js +2 -2
- data/spec/javascripts/i18n-spec.js +79 -0
- data/spec/javascripts/kids-button-spec.js +36 -0
- metadata +136 -115
- data/spec/dummy/config/database.travis.yml +0 -4
- data/spec/features/chapter_spec.rb +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 222bd258be2916956f315e5195ed53f60ff730f176852e7d52ae17194e789f06
|
4
|
+
data.tar.gz: d3e1701ba286cdfa8d7b44ad529c85df6b9b6fdbe3912fa77dfafab35f9a4545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb75e14d8e9da062677b7cfb5595ece2717f9b226f085c3432379c87a63acf80e905fda9d890a85bc3afd970d623029d729c86ffff35781fe5b6f1fc938ff92e
|
7
|
+
data.tar.gz: 531e671791fec8e27fb3694a7315eb444d1e3d790ba3186789616562b2b7d6ad609bb7bc1221c94a741c207f2a573aeae9427a1e68aa3d4e3d272ae6f3ce3480
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
|
1
|
+
![Build status](https://github.com/mumuki/mumuki-laboratory/workflows/Test%20and%20deploy/badge.svg?branch=master)
|
2
2
|
[![Code Climate](https://codeclimate.com/github/mumuki/mumuki-laboratory/badges/gpa.svg)](https://codeclimate.com/github/mumuki/mumuki-laboratory)
|
3
|
-
[![Issue Count](https://codeclimate.com/github/mumuki/mumuki-laboratory/badges/issue_count.svg)](https://codeclimate.com/github/mumuki/mumuki-laboratory)
|
4
3
|
|
5
4
|
<img width="60%" src="https://raw.githubusercontent.com/mumuki/mumuki-laboratory/master/laboratory-screenshot.png"></img>
|
6
5
|
|
@@ -286,6 +285,7 @@ which are granted to be safe and stable.
|
|
286
285
|
* `updateButtonsVisibility`
|
287
286
|
* `mumuki.submission`
|
288
287
|
* `processSolution`
|
288
|
+
* `sendSolution`
|
289
289
|
* `registerContentSyncer`
|
290
290
|
* `mumuki.version`
|
291
291
|
|
@@ -482,16 +482,27 @@ mumuki.editors.addCustomSource({
|
|
482
482
|
});
|
483
483
|
```
|
484
484
|
|
485
|
-
#### 2.5 Optional:
|
485
|
+
#### 2.5 Optional: Triggering submission processing programmatically
|
486
486
|
|
487
|
-
Your solution will be automatically sent to the client when the submit button is pressed.
|
488
|
-
if you need to trigger submission process programmatically,
|
487
|
+
Your solution will be automatically sent to the client and processed when the submit button is pressed.
|
488
|
+
However, if you need to trigger the whole submission process programmatically,
|
489
|
+
call `mumuki.submission.processSolution`:
|
489
490
|
|
490
491
|
```javascript
|
491
492
|
mumuki.submission.processSolution({solution: {content: /* ... */}});
|
492
493
|
```
|
493
494
|
|
494
|
-
#### 2.6 Optional:
|
495
|
+
#### 2.6 Optional: Sending your solution to the server programmatically
|
496
|
+
|
497
|
+
Your solution will be automatically sent to the client when the submit button is pressed, as part of the
|
498
|
+
solution processing. However, if you just need to send your submission to the server programmatically,
|
499
|
+
call `mumuki.submission.sendSolution`:
|
500
|
+
|
501
|
+
```javascript
|
502
|
+
mumuki.submission.sendSolution({solution: {content: /* ... */}});
|
503
|
+
```
|
504
|
+
|
505
|
+
#### 2.7 Optional: customizing your submit button
|
495
506
|
|
496
507
|
You can alternatively override the default submit button UI and behaviour, by replacing it with a custom component. In order to
|
497
508
|
do that, override the `.mu-submit-button` or the kids-specific `.mu-kids-submit-button`:
|
@@ -506,7 +517,7 @@ However, doing this is tricky, since you will need to manually update the UI and
|
|
506
517
|
* `mumuki.bridge.Laboratory.runTests`
|
507
518
|
* `mumuki.updateProgressBarAndShowModal`
|
508
519
|
|
509
|
-
#### 2.
|
520
|
+
#### 2.8 Register kids scalers
|
510
521
|
|
511
522
|
Kids layouts have some special areas:
|
512
523
|
|
@@ -525,7 +536,7 @@ mumuki.kids.registerBlocksAreaScaler(($blocks) => {
|
|
525
536
|
});
|
526
537
|
```
|
527
538
|
|
528
|
-
#### 2.
|
539
|
+
#### 2.9 Notify when your assets have been loaded
|
529
540
|
|
530
541
|
In order to remove loading spinners, you will need to call `mumuki.assetsLoadedFor` when your code is ready.
|
531
542
|
|
@@ -113,7 +113,8 @@ 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.results.progressListItemClassForStatus(result.status, true);
|
117
|
+
result.title_html = mumuki.renderers.results.translatedTitleHtml(result.status, result.in_gamified_context);
|
117
118
|
return result;
|
118
119
|
}
|
119
120
|
}
|
@@ -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
|
// ==============
|
@@ -49,7 +49,6 @@ mumuki.Button = class {
|
|
49
49
|
*/
|
50
50
|
wait() {
|
51
51
|
this.$button.off('click');
|
52
|
-
|
53
52
|
this.setWaiting();
|
54
53
|
}
|
55
54
|
|
@@ -77,10 +76,9 @@ mumuki.Button = class {
|
|
77
76
|
*/
|
78
77
|
continue() {
|
79
78
|
this.$button.off('click');
|
80
|
-
|
81
79
|
this.enable();
|
82
80
|
|
83
|
-
this.$button.on('click', this.main)
|
81
|
+
this.$button.on('click', this.main);
|
84
82
|
}
|
85
83
|
|
86
84
|
// =============
|
@@ -106,11 +104,11 @@ mumuki.Button = class {
|
|
106
104
|
}
|
107
105
|
|
108
106
|
setWaitingText () {
|
109
|
-
this.$button.html('<i class="
|
107
|
+
this.$button.html('<i class="fas fa-sync-alt fa-spin"></i> ' + this.$button.attr('data-waiting'));
|
110
108
|
}
|
111
109
|
|
112
110
|
setRetryText() {
|
113
|
-
this.$button.html('<i class="
|
111
|
+
this.$button.html('<i class="fas fa-undo"></i>');
|
114
112
|
}
|
115
113
|
|
116
114
|
setOriginalContent () {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
(() => {
|
2
2
|
function submit() {
|
3
3
|
$('body').removeClass('fullscreen');
|
4
|
-
$('.editor-resize .
|
4
|
+
$('.editor-resize .fas').toggleClass('fa-expand fa-compress');
|
5
5
|
$('.btn-submit').click();
|
6
6
|
}
|
7
7
|
|
@@ -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,20 +23,20 @@ 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
|
|
37
37
|
function toggleFullscreen() {
|
38
38
|
$('body').toggleClass('fullscreen');
|
39
|
-
$('.editor-resize .
|
39
|
+
$('.editor-resize .fas').toggleClass('fa-expand fa-compress');
|
40
40
|
}
|
41
41
|
|
42
42
|
function indentWithSpaces(cm) {
|
@@ -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
|
+
};
|
@@ -108,12 +108,22 @@ mumuki.gamification = (() => {
|
|
108
108
|
}
|
109
109
|
|
110
110
|
updateLevel() {
|
111
|
-
const $muLevelProgress = $('#mu-level-progress');
|
112
|
-
|
113
111
|
$('#mu-solve-more-exercises span').text(this.exercisesToNextLevel());
|
114
112
|
$('.mu-level-number').html(this.currentLevel());
|
115
|
-
$('.mu-level-tooltip').attr("title", (_, value) => `${value} ${this.currentLevel()}`);
|
116
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');
|
117
127
|
if (this.currentLevelProgress() === 0) {
|
118
128
|
$muLevelProgress.attr("display", "none");
|
119
129
|
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
mumuki.I18n = (() => {
|
2
|
+
|
3
|
+
const translations = {
|
4
|
+
'es': {
|
5
|
+
aborted: () => "Ups, no pudimos evaluar tu solución",
|
6
|
+
errored: () => "¡Ups! Tu solución no se puede ejecutar",
|
7
|
+
failed: () => "Tu solución no pasó las pruebas",
|
8
|
+
passed: () => "¡Muy bien! Tu solución pasó todas las pruebas",
|
9
|
+
passed_with_warnings: () => "Tu solución funcionó, pero hay cosas que mejorar",
|
10
|
+
pending: () => "Pendiente",
|
11
|
+
skipped: () => "Venís aprendiendo muy bien, por lo que aprobaste este ejercicio",
|
12
|
+
},
|
13
|
+
'es-CL': {
|
14
|
+
aborted: () => "Ups, no pudimos evaluar tu solución",
|
15
|
+
errored: () => "¡Ups! Tu solución no se puede ejecutar",
|
16
|
+
failed: () => "Tu solución no pasó las pruebas",
|
17
|
+
passed: () => "¡Muy bien! Tu solución pasó todas las pruebas",
|
18
|
+
passed_with_warnings: () => "Tu solución funcionó, pero hay cosas que mejorar",
|
19
|
+
pending: () => "Pendiente",
|
20
|
+
skipped: () => "Vienes aprendiendo muy bien, por lo que aprobaste este ejercicio",
|
21
|
+
},
|
22
|
+
'en': {
|
23
|
+
aborted: () => "Oops, we couldn't evaluate your solution",
|
24
|
+
errored: () => "Oops, your solution didn't work",
|
25
|
+
failed: () => "Oops, something went wrong",
|
26
|
+
passed: () => "Everything is in order! Your solution passed all our tests!",
|
27
|
+
passed_with_warnings: () => "It worked, but you can do better",
|
28
|
+
pending: () => "Pending",
|
29
|
+
skipped: () => "You are doing very well, so you've passed this exercise",
|
30
|
+
},
|
31
|
+
'pt': {
|
32
|
+
aborted: () => "Opa, não pudemos avaliar sua solução",
|
33
|
+
errored: () => "Opa! Sua solução não pode ser executada",
|
34
|
+
failed: () => "Sua solução não passou as provas",
|
35
|
+
passed: () => "Muito bem! Sua solução passou todos os testes",
|
36
|
+
passed_with_warnings: () => "Sua solução funcionou, mas há coisas para melhorar",
|
37
|
+
pending: () => "Pendente",
|
38
|
+
skipped: () => "Você está aprendendo muito bem e passou neste exercício",
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
return new class {
|
43
|
+
|
44
|
+
translate(key, data = {}) {
|
45
|
+
const translationValue = this._translationValue(key);
|
46
|
+
switch (typeof(translationValue)) {
|
47
|
+
case 'string': return translationValue;
|
48
|
+
case 'function': return translationValue(data);
|
49
|
+
default: return `Translation missing: ${mumuki.locale}, \`${key}\``;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
t(key, data = {}) {
|
54
|
+
return mumuki.I18n.translate(key, data);
|
55
|
+
}
|
56
|
+
|
57
|
+
register(translationsToOverride) {
|
58
|
+
const locales = Object.keys(translations);
|
59
|
+
locales.forEach((it) => translations[it] = Object.assign(translations[it], translationsToOverride[it]));
|
60
|
+
}
|
61
|
+
|
62
|
+
_prefixTranslationKey(key) {
|
63
|
+
this._prefix = $('[data-i18n-prefix]');
|
64
|
+
return this._prefix.get(0) ? `${this._prefix.data('i18n-prefix')}_${key}` : key;
|
65
|
+
}
|
66
|
+
|
67
|
+
_translationValue(key) {
|
68
|
+
let translationLocale = translations[mumuki.locale];
|
69
|
+
return translationLocale && (translationLocale[this._prefixTranslationKey(key)] || translationLocale[key]);
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
73
|
+
})();
|
@@ -1,3 +1,7 @@
|
|
1
|
+
mumuki.load(() => {
|
2
|
+
mumuki.isKidsExercise = () => $('.mu-kids-exercise').length > 0;
|
3
|
+
})
|
4
|
+
|
1
5
|
mumuki.Kids = class {
|
2
6
|
|
3
7
|
constructor() {
|
@@ -11,8 +15,9 @@ mumuki.Kids = class {
|
|
11
15
|
// ================
|
12
16
|
|
13
17
|
initialize() {
|
14
|
-
this.submitButton = new mumuki.submission.
|
18
|
+
this.submitButton = new mumuki.submission.KidsSubmitButton($('#kids-btn-retry'), $('.submission_control'));
|
15
19
|
this.resultActions = {};
|
20
|
+
this.$overlay = $('.mu-kids-overlay');
|
16
21
|
this.$states = $('.mu-kids-states');
|
17
22
|
this.$state = $('.mu-kids-state');
|
18
23
|
this.$blocks = $('.mu-kids-blocks');
|
@@ -27,6 +32,14 @@ mumuki.Kids = class {
|
|
27
32
|
this.$submissionResult = $('.submission-results');
|
28
33
|
mumuki.gamification.currentLevelProgression.registerLevelUpAction(this.levelUpAction);
|
29
34
|
mumuki.gamification.currentLevelProgression.registerGainedExperienceAction(this.gainedExperienceAction);
|
35
|
+
this.$resultsModal.on('hidden.bs.modal', this.resetExerciseIfSubmitless);
|
36
|
+
this.$resultsAbortedModal.on('hidden.bs.modal', this.resetExerciseIfSubmitless);
|
37
|
+
}
|
38
|
+
|
39
|
+
resetExerciseIfSubmitless() {
|
40
|
+
if ($('.mu-submitless-exercise').get(0)) {
|
41
|
+
mumuki.kids.submitButton.continue();
|
42
|
+
}
|
30
43
|
}
|
31
44
|
|
32
45
|
gainedExperienceAction() {
|
@@ -56,16 +69,24 @@ mumuki.Kids = class {
|
|
56
69
|
this.$resultsAbortedModal.modal();
|
57
70
|
}
|
58
71
|
|
72
|
+
showOverlay() {
|
73
|
+
this.$overlay.show();
|
74
|
+
}
|
75
|
+
|
76
|
+
hideOverlay() {
|
77
|
+
this.$overlay.hide();
|
78
|
+
}
|
79
|
+
|
59
80
|
// ==================
|
60
81
|
// == Hook Methods ==
|
61
82
|
// ==================
|
62
83
|
|
63
84
|
_showSuccessPopup() {
|
64
|
-
this._mustImplementThisMethod()
|
85
|
+
this._mustImplementThisMethod();
|
65
86
|
}
|
66
87
|
|
67
88
|
_showFailurePopup() {
|
68
|
-
this._mustImplementThisMethod()
|
89
|
+
this._mustImplementThisMethod();
|
69
90
|
}
|
70
91
|
|
71
92
|
// ====================
|
@@ -141,7 +162,7 @@ mumuki.Kids = class {
|
|
141
162
|
// ============
|
142
163
|
|
143
164
|
_mustImplementThisMethod() {
|
144
|
-
throw new Error('TODO: implement method')
|
165
|
+
throw new Error('TODO: implement method');
|
145
166
|
}
|
146
167
|
|
147
168
|
// ============
|
@@ -214,4 +235,4 @@ mumuki.Kids = class {
|
|
214
235
|
$blockSvg.height($blocks.height());
|
215
236
|
}
|
216
237
|
|
217
|
-
}
|
238
|
+
};
|