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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -8
  3. data/app/assets/javascripts/mumuki_laboratory/application/bridge.js +2 -1
  4. data/app/assets/javascripts/mumuki_laboratory/application/button.js +4 -6
  5. data/app/assets/javascripts/mumuki_laboratory/application/codemirror-builder.js +3 -3
  6. data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +6 -6
  7. data/app/assets/javascripts/mumuki_laboratory/application/console.js +2 -2
  8. data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +7 -7
  9. data/app/assets/javascripts/mumuki_laboratory/application/editors.js +1 -1
  10. data/app/assets/javascripts/mumuki_laboratory/application/elipsis.js +1 -1
  11. data/app/assets/javascripts/mumuki_laboratory/application/events.js +2 -2
  12. data/app/assets/javascripts/mumuki_laboratory/application/exercise.js +2 -2
  13. data/app/assets/javascripts/mumuki_laboratory/application/gamification.js +13 -3
  14. data/app/assets/javascripts/mumuki_laboratory/application/i18n.js +73 -0
  15. data/app/assets/javascripts/mumuki_laboratory/application/inputs.js +1 -1
  16. data/app/assets/javascripts/mumuki_laboratory/application/kids.js +26 -5
  17. data/app/assets/javascripts/mumuki_laboratory/application/kindergarten.js +13 -8
  18. data/app/assets/javascripts/mumuki_laboratory/application/messages.js +6 -6
  19. data/app/assets/javascripts/mumuki_laboratory/application/mu-modal-carrousel.js +1 -1
  20. data/app/assets/javascripts/mumuki_laboratory/application/multiple-choice.js +1 -1
  21. data/app/assets/javascripts/mumuki_laboratory/application/multiple-files.js +3 -3
  22. data/app/assets/javascripts/mumuki_laboratory/application/multiple-scenarios.js +1 -1
  23. data/app/assets/javascripts/mumuki_laboratory/application/pin.js +1 -1
  24. data/app/assets/javascripts/mumuki_laboratory/application/primary.js +6 -4
  25. data/app/assets/javascripts/mumuki_laboratory/application/progress.js +1 -1
  26. data/app/assets/javascripts/mumuki_laboratory/application/results-renderer.js +29 -2
  27. data/app/assets/javascripts/mumuki_laboratory/application/speech-bubble-renderer.js +4 -4
  28. data/app/assets/javascripts/mumuki_laboratory/application/submission.js +72 -48
  29. data/app/assets/javascripts/mumuki_laboratory/application/submissions-store.js +3 -3
  30. data/app/assets/javascripts/mumuki_laboratory/application/sync-mode.js +2 -2
  31. data/app/assets/javascripts/mumuki_laboratory/application/timer.js +1 -1
  32. data/app/assets/stylesheets/mumuki_laboratory/application/_layout.scss +7 -7
  33. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids.scss +4 -0
  34. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids_results.scss +1 -0
  35. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_overlap.scss +0 -4
  36. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_terms.scss +4 -0
  37. data/app/controllers/chapters_controller.rb +9 -5
  38. data/app/controllers/concerns/with_user_discussion_validation.rb +6 -0
  39. data/app/controllers/discussions_controller.rb +0 -6
  40. data/app/controllers/guide_container_controller.rb +2 -7
  41. data/app/helpers/assignment_result_helper.rb +1 -1
  42. data/app/helpers/contextualization_result_helper.rb +0 -8
  43. data/app/helpers/discussions_helper.rb +12 -4
  44. data/app/helpers/editor_tabs_helper.rb +1 -1
  45. data/app/helpers/icons_helper.rb +1 -1
  46. data/app/helpers/links_helper.rb +3 -3
  47. data/app/helpers/menu_bar_helper.rb +9 -1
  48. data/app/helpers/overlapped_buttons_helper.rb +6 -2
  49. data/app/views/book/show.html.erb +2 -2
  50. data/app/views/book_discussions/index.html.erb +3 -1
  51. data/app/views/chapters/show.html.erb +21 -9
  52. data/app/views/complements/show.html.erb +1 -1
  53. data/app/views/discussions/_message.html.erb +2 -2
  54. data/app/views/discussions/index.html.erb +11 -4
  55. data/app/views/exams/show.html.erb +1 -1
  56. data/app/views/exercise_solutions/_kids_level_up.html.erb +1 -1
  57. data/app/views/exercises/_exercise_assignment.html.erb +1 -1
  58. data/app/views/exercises/_read_only.html.erb +1 -1
  59. data/app/views/exercises/show.html.erb +2 -2
  60. data/app/views/layouts/_copyright.html.erb +1 -1
  61. data/app/views/layouts/_discussions.html.erb +0 -4
  62. data/app/views/layouts/_guide.html.erb +9 -36
  63. data/app/views/layouts/_guide_container.html.erb +28 -0
  64. data/app/views/layouts/_guide_title_icons.html.erb +9 -0
  65. data/app/views/layouts/_kids.html.erb +4 -4
  66. data/app/views/layouts/_kindergarten.html.erb +5 -5
  67. data/app/views/layouts/_social_media.html.erb +4 -4
  68. data/app/views/layouts/_timer.html.erb +1 -1
  69. data/app/views/layouts/application.html.erb +31 -27
  70. data/app/views/layouts/embedded.html.erb +14 -11
  71. data/app/views/layouts/exercise_inputs/editors/_code.html.erb +1 -6
  72. data/app/views/layouts/exercise_inputs/editors/_multiple_files.html.erb +4 -9
  73. data/app/views/layouts/exercise_inputs/forms/_problem_form.html.erb +1 -1
  74. data/app/views/layouts/exercise_inputs/layouts/_input_kindergarten.html.erb +1 -1
  75. data/app/views/layouts/modals/_guide_corollary.html.erb +13 -3
  76. data/app/views/layouts/modals/_kids_results.html.erb +2 -2
  77. data/app/views/layouts/modals/_kindergarten_context.html.erb +3 -3
  78. data/app/views/layouts/modals/_kindergarten_results.html.erb +3 -3
  79. data/app/views/layouts/modals/_kindergarten_results_aborted.html.erb +2 -2
  80. data/app/views/layouts/modals/_level_up.html.erb +1 -1
  81. data/app/views/lessons/show.html.erb +1 -1
  82. data/app/views/users/_edit_user_form.html.erb +1 -1
  83. data/app/views/users/_term.html.erb +1 -1
  84. data/app/views/users/_user_form.html.erb +1 -1
  85. data/lib/mumuki/laboratory/controllers/results_rendering.rb +2 -1
  86. data/lib/mumuki/laboratory/engine.rb +1 -1
  87. data/lib/mumuki/laboratory/locales/en.yml +5 -8
  88. data/lib/mumuki/laboratory/locales/es-CL.yml +5 -3
  89. data/lib/mumuki/laboratory/locales/es.yml +8 -10
  90. data/lib/mumuki/laboratory/locales/pt.yml +5 -8
  91. data/lib/mumuki/laboratory/version.rb +1 -1
  92. data/spec/controllers/discussions_controller_spec.rb +19 -0
  93. data/spec/controllers/exercise_solutions_controller_spec.rb +3 -2
  94. data/spec/dummy/db/schema.rb +50 -1
  95. data/spec/dummy/public/character/animations.json +1 -0
  96. data/{public → spec/dummy/public}/character/kibi/context.svg +0 -0
  97. data/{public → spec/dummy/public}/character/kibi/failure.svg +0 -0
  98. data/{public → spec/dummy/public}/character/kibi/jump.svg +0 -0
  99. data/spec/dummy/public/character/kibi/passed_with_warnings.svg +4 -0
  100. data/{public → spec/dummy/public}/character/kibi/success2_l.svg +0 -0
  101. data/{public → spec/dummy/public}/character/kibi/success_l.svg +0 -0
  102. data/{public → spec/dummy/public}/character/magnifying_glass/apparition.svg +0 -0
  103. data/{public → spec/dummy/public}/character/magnifying_glass/loop.svg +0 -0
  104. data/spec/features/chapters_flow_spec.rb +112 -0
  105. data/spec/features/login_flow_spec.rb +1 -1
  106. data/spec/features/terms_flow_spec.rb +2 -0
  107. data/spec/features/topic_flow_spec.rb +0 -1
  108. data/spec/helpers/icons_helper_spec.rb +3 -3
  109. data/spec/helpers/test_results_rendering_spec.rb +8 -8
  110. data/spec/helpers/with_navigation_spec.rb +14 -14
  111. data/spec/javascripts/gamification-spec.js +2 -2
  112. data/spec/javascripts/i18n-spec.js +79 -0
  113. data/spec/javascripts/kids-button-spec.js +36 -0
  114. metadata +136 -115
  115. data/spec/dummy/config/database.travis.yml +0 -4
  116. data/spec/features/chapter_spec.rb +0 -70
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5feda4ed95a66abdfc68c218f1d2b5752fe6fdd8d8da0a18cc7c968d90550bbd
4
- data.tar.gz: '080a983c6f384a8568ba2c8e7f092fcab9afe2a82b728bdfcc1e66fb8256377f'
3
+ metadata.gz: 222bd258be2916956f315e5195ed53f60ff730f176852e7d52ae17194e789f06
4
+ data.tar.gz: d3e1701ba286cdfa8d7b44ad529c85df6b9b6fdbe3912fa77dfafab35f9a4545
5
5
  SHA512:
6
- metadata.gz: f95a1a2057a7946e2f26589a50076ec7e3c0e3d538a3feeb75da6a7cd1e030598a048dbb2e8918f1dcf39aa6565bc22fec237c66c88ee6842503c4d0bf94947c
7
- data.tar.gz: 006504d33b8cb9ea871cff01be16fbc9f4b9f89e8cab63f11e1bfcc41cb4384cf1aff2e6e501e053d9279a1dd3a2009ae0b6a5c242012ab311b0a1e1ed9702a5
6
+ metadata.gz: fb75e14d8e9da062677b7cfb5595ece2717f9b226f085c3432379c87a63acf80e905fda9d890a85bc3afd970d623029d729c86ffff35781fe5b6f1fc938ff92e
7
+ data.tar.gz: 531e671791fec8e27fb3694a7315eb444d1e3d790ba3186789616562b2b7d6ad609bb7bc1221c94a741c207f2a573aeae9427a1e68aa3d4e3d272ae6f3ce3480
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
- [![Build Status](https://travis-ci.com/mumuki/mumuki-laboratory.svg?branch=master)](https://travis-ci.com/mumuki/mumuki-laboratory)
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: Sending your solution to the server programmatically
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. However,
488
- if you need to trigger submission process programmatically, call `mumuki.submission.processSolution`:
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: customizing your submit button
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.7 Register kids scalers
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.8 Notify when your assets have been loaded
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="fa fa-refresh fa-spin"></i> ' + this.$button.attr('data-waiting'));
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="fa fa-undo"></i>');
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 .fa-stack-1x').removeClass('fa-compress').addClass('fa-expand');
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 .fa-stack-1x').toggleClass('fa-expand').toggleClass('fa-compress');
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');
@@ -99,6 +99,6 @@ mumuki.editors = {
99
99
  * @param {CustomEditorSource} source
100
100
  */
101
101
  addCustomSource(source) {
102
- mumuki.CustomEditor.addSource(source)
102
+ mumuki.CustomEditor.addSource(source);
103
103
  }
104
104
  };
@@ -21,7 +21,7 @@ mumuki.elipsis = (() => {
21
21
  $elipsis.each((it, e) => {
22
22
  let $e = $(e);
23
23
  $e.html(mumuki.elipsis($e.html()));
24
- })
24
+ });
25
25
  };
26
26
 
27
27
  mumuki.load(() => {
@@ -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
+ };
@@ -63,6 +63,6 @@ mumuki.exercise = {
63
63
  this._current = null;
64
64
  }
65
65
  }
66
- }
66
+ };
67
67
 
68
- mumuki.load(() => mumuki.exercise.load())
68
+ mumuki.load(() => mumuki.exercise.load());
@@ -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
+ })();
@@ -7,7 +7,7 @@ mumuki.onInputsReady = (() => {
7
7
  if ($(inputsSelector).length === 0) return;
8
8
 
9
9
  callback(event);
10
- })
10
+ });
11
11
  }
12
12
 
13
13
  return onInputsReady;
@@ -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.SubmitButton($('#kids-btn-retry'), $('.submission_control'));
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
+ };