mumuki-laboratory 9.0.2 → 9.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +10 -2
  3. data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +49 -8
  4. data/app/assets/javascripts/mumuki_laboratory/application/faqs.js +14 -4
  5. data/app/assets/javascripts/mumuki_laboratory/application/gamification.js +3 -3
  6. data/app/assets/javascripts/mumuki_laboratory/application/kids.js +11 -7
  7. data/app/assets/javascripts/mumuki_laboratory/application/kindergarten.js +3 -3
  8. data/app/assets/javascripts/mumuki_laboratory/application/messages.js +3 -3
  9. data/app/assets/javascripts/mumuki_laboratory/application/mu-modal-carrousel.js +4 -4
  10. data/app/assets/javascripts/mumuki_laboratory/application/multiple-files.js +18 -5
  11. data/app/assets/javascripts/mumuki_laboratory/application/multiple-scenarios.js +1 -1
  12. data/app/assets/javascripts/mumuki_laboratory/application/organization.js +32 -0
  13. data/app/assets/javascripts/mumuki_laboratory/application/primary.js +4 -4
  14. data/app/assets/javascripts/mumuki_laboratory/application/profile.js +0 -6
  15. data/app/assets/javascripts/mumuki_laboratory/application/progress.js +1 -1
  16. data/app/assets/javascripts/mumuki_laboratory/application/speech-bubble-renderer.js +1 -1
  17. data/app/assets/javascripts/mumuki_laboratory/application/submission.js +4 -3
  18. data/app/assets/javascripts/mumuki_laboratory/application/submissions-store.js +1 -1
  19. data/app/assets/javascripts/mumuki_laboratory/application/toast.js +3 -0
  20. data/app/assets/javascripts/mumuki_laboratory/application/tooltip.js +1 -1
  21. data/app/assets/javascripts/mumuki_laboratory/application/upload.js +2 -2
  22. data/app/assets/javascripts/mumuki_laboratory/application/user.js +49 -5
  23. data/app/assets/stylesheets/mumuki_laboratory/application.scss +0 -1
  24. data/app/assets/stylesheets/mumuki_laboratory/application/_errors.scss +1 -1
  25. data/app/assets/stylesheets/mumuki_laboratory/application/_layout.scss +1 -27
  26. data/app/assets/stylesheets/mumuki_laboratory/application/_modules.scss +1 -2
  27. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_activity.scss +14 -0
  28. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_avatar.scss +5 -0
  29. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_breadcrumb.scss +2 -2
  30. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_datepicker.scss +0 -4
  31. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_discussion.scss +49 -59
  32. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_editor.scss +16 -18
  33. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_exercise_assignment.scss +2 -11
  34. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_exercise_results.scss +1 -7
  35. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_faqs.scss +30 -8
  36. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_flash.scss +7 -46
  37. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids.scss +19 -4
  38. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids_results.scss +18 -23
  39. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kindergarten.scss +1 -9
  40. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_overlap.scss +1 -1
  41. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_progress_bar.scss +5 -5
  42. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_terms.scss +3 -2
  43. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_timer.scss +1 -3
  44. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_menu.scss +38 -3
  45. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +1 -2
  46. data/app/controllers/application_controller.rb +4 -2
  47. data/app/controllers/discussions_messages_controller.rb +9 -3
  48. data/app/controllers/users_controller.rb +13 -0
  49. data/app/helpers/application_helper.rb +5 -5
  50. data/app/helpers/assignment_result_helper.rb +3 -2
  51. data/app/helpers/assistance_box_helper.rb +1 -1
  52. data/app/helpers/concerns/with_student_path_navigation.rb +8 -3
  53. data/app/helpers/concerns/with_student_path_navigation/continue_navigation.rb +1 -1
  54. data/app/helpers/concerns/with_student_path_navigation/finish_navigation.rb +1 -1
  55. data/app/helpers/concerns/with_student_path_navigation/next_parent_navigation.rb +7 -0
  56. data/app/helpers/concerns/with_student_path_navigation/revisit_navigation.rb +1 -1
  57. data/app/helpers/discussions_helper.rb +64 -23
  58. data/app/helpers/editor_tabs_helper.rb +10 -6
  59. data/app/helpers/email_helper.rb +2 -2
  60. data/app/helpers/exercise_input_helper.rb +2 -3
  61. data/app/helpers/links_helper.rb +12 -9
  62. data/app/helpers/menu_bar_helper.rb +1 -1
  63. data/app/helpers/messages_helper.rb +1 -1
  64. data/app/helpers/multiple_file_editor_helper.rb +2 -1
  65. data/app/helpers/overlapped_buttons_helper.rb +22 -12
  66. data/app/helpers/profile_helper.rb +3 -3
  67. data/app/helpers/toast_helper.rb +27 -0
  68. data/app/helpers/user_activity_helper.rb +48 -0
  69. data/app/helpers/user_menu_helper.rb +24 -6
  70. data/app/views/book/show.html.erb +2 -2
  71. data/app/views/certificates/verify.html.erb +1 -1
  72. data/app/views/chapters/show.html.erb +2 -2
  73. data/app/views/discussions/_description_message.html.erb +1 -1
  74. data/app/views/discussions/_message.html.erb +32 -7
  75. data/app/views/discussions/_new_message.html.erb +13 -2
  76. data/app/views/discussions/index.html.erb +8 -10
  77. data/app/views/discussions/new.html.erb +2 -2
  78. data/app/views/discussions/show.html.erb +20 -12
  79. data/app/views/exam_registrations/show.html.erb +10 -11
  80. data/app/views/exercise_solutions/_assistant_rules_box.html.erb +1 -1
  81. data/app/views/exercise_solutions/_contextualization_results_body.html.erb +1 -1
  82. data/app/views/exercise_solutions/_contextualization_results_container.html.erb +1 -1
  83. data/app/views/exercise_solutions/_kids_results_button.html.erb +2 -2
  84. data/app/views/exercise_solutions/_results.html.erb +1 -1
  85. data/app/views/exercises/_exercise_assignment.html.erb +2 -2
  86. data/app/views/exercises/_exercise_skipped.html.erb +1 -1
  87. data/app/views/exercises/_read_only.html.erb +108 -105
  88. data/app/views/exercises/show.html.erb +7 -7
  89. data/app/views/faqs/index.html.erb +5 -1
  90. data/app/views/guides/_guide.html.erb +1 -1
  91. data/app/views/guides/_guide_container.html.erb +4 -4
  92. data/app/views/invitations/_invitation_form.html.erb +5 -4
  93. data/app/views/layouts/_authoring.html.erb +1 -1
  94. data/app/views/layouts/_discussions.html.erb +7 -7
  95. data/app/views/layouts/_kids.html.erb +5 -5
  96. data/app/views/layouts/_kindergarten.html.erb +10 -6
  97. data/app/views/layouts/_main.html.erb +10 -10
  98. data/app/views/layouts/_organizations_listing.html.erb +2 -2
  99. data/app/views/layouts/_progress_bar.html.erb +2 -0
  100. data/app/views/layouts/_submission_result_error.html.erb +1 -1
  101. data/app/views/layouts/_test_results.html.erb +1 -1
  102. data/app/views/layouts/_timer.html.erb +1 -1
  103. data/app/views/layouts/_user_menu.html.erb +13 -20
  104. data/app/views/layouts/application.html.erb +39 -42
  105. data/app/views/layouts/exercise_inputs/editors/_code.html.erb +4 -4
  106. data/app/views/layouts/exercise_inputs/editors/_free_form.html.erb +1 -1
  107. data/app/views/layouts/exercise_inputs/editors/_multiple_choice.html.erb +7 -9
  108. data/app/views/layouts/exercise_inputs/editors/_multiple_files.html.erb +10 -10
  109. data/app/views/layouts/exercise_inputs/editors/_single_choice.html.erb +6 -8
  110. data/app/views/layouts/exercise_inputs/editors/_text.html.erb +2 -3
  111. data/app/views/layouts/exercise_inputs/editors/_upload.html.erb +5 -5
  112. data/app/views/layouts/exercise_inputs/forms/_form.html.erb +1 -1
  113. data/app/views/layouts/exercise_inputs/forms/_interactive_form.html.erb +2 -2
  114. data/app/views/layouts/exercise_inputs/forms/_kids_form.html.erb +1 -1
  115. data/app/views/layouts/exercise_inputs/forms/_playground_form.html.erb +2 -2
  116. data/app/views/layouts/exercise_inputs/forms/_problem_form.html.erb +13 -9
  117. data/app/views/layouts/exercise_inputs/layouts/_input_primary.html.erb +2 -2
  118. data/app/views/layouts/exercise_inputs/layouts/_input_right.html.erb +2 -2
  119. data/app/views/layouts/exercise_inputs/read_only_editors/_code.html.erb +1 -1
  120. data/app/views/layouts/exercise_inputs/read_only_editors/_free_form.html.erb +1 -1
  121. data/app/views/layouts/exercise_inputs/read_only_editors/_multiple_choice.html.erb +4 -4
  122. data/app/views/layouts/exercise_inputs/read_only_editors/_multiple_files.html.erb +2 -2
  123. data/app/views/layouts/exercise_inputs/read_only_editors/_single_choice.html.erb +4 -4
  124. data/app/views/layouts/exercise_inputs/read_only_editors/_text.erb +1 -1
  125. data/app/views/layouts/modals/_avatar_picker.html.erb +2 -5
  126. data/app/views/layouts/modals/_guide_corollary.html.erb +4 -8
  127. data/app/views/layouts/modals/_kids_context.html.erb +7 -5
  128. data/app/views/layouts/modals/_kids_results.html.erb +2 -2
  129. data/app/views/layouts/modals/_kids_results_aborted.html.erb +2 -2
  130. data/app/views/layouts/modals/_kindergarten_context.html.erb +3 -3
  131. data/app/views/layouts/modals/_kindergarten_results.html.erb +3 -3
  132. data/app/views/layouts/modals/_kindergarten_results_aborted.html.erb +2 -2
  133. data/app/views/layouts/modals/_level_up.html.erb +2 -5
  134. data/app/views/layouts/modals/_new_message.html.erb +5 -5
  135. data/app/views/notifications/_dropdown.html.erb +3 -3
  136. data/app/views/users/_activity_indicator.html.erb +17 -0
  137. data/app/views/users/_edit_user_form.html.erb +6 -6
  138. data/app/views/users/_profile_fields.html.erb +6 -6
  139. data/app/views/users/_user_form.html.erb +2 -2
  140. data/app/views/users/activity.html.erb +37 -0
  141. data/app/views/users/certificates.html.erb +26 -24
  142. data/app/views/users/discussions.html.erb +23 -21
  143. data/app/views/users/messages.html.erb +22 -20
  144. data/app/views/users/show.html.erb +5 -3
  145. data/app/views/users/terms.html.erb +4 -2
  146. data/config/initializers/inflections.rb +3 -0
  147. data/config/routes.rb +3 -0
  148. data/lib/mumuki/laboratory.rb +1 -1
  149. data/lib/mumuki/laboratory/extensions.rb +1 -0
  150. data/lib/mumuki/laboratory/extensions/date_and_time.rb +11 -0
  151. data/lib/mumuki/laboratory/locales/en.yml +28 -2
  152. data/lib/mumuki/laboratory/locales/es-CL.yml +33 -4
  153. data/lib/mumuki/laboratory/locales/es.yml +33 -4
  154. data/lib/mumuki/laboratory/locales/pt.yml +34 -3
  155. data/lib/mumuki/laboratory/version.rb +1 -1
  156. data/spec/capybara_helper.rb +1 -0
  157. data/spec/controllers/discussions_messages_controller_spec.rb +84 -3
  158. data/spec/dummy/db/schema.rb +23 -3
  159. data/spec/features/discussion_flow_spec.rb +22 -2
  160. data/spec/features/exercise_flow_spec.rb +1 -1
  161. data/spec/features/guide_reset_spec.rb +1 -1
  162. data/spec/features/terms_flow_spec.rb +1 -2
  163. data/spec/features/user_activity_flow_spec.rb +65 -0
  164. data/spec/helpers/breadcrumbs_helper_spec.rb +2 -2
  165. data/spec/helpers/user_activity_helper_spec.rb +32 -0
  166. data/spec/helpers/with_navigation_spec.rb +36 -13
  167. data/spec/javascripts/editors-spec.js +3 -3
  168. data/spec/javascripts/kids-button-spec.js +2 -2
  169. data/spec/javascripts/upload-spec.js +8 -8
  170. metadata +133 -123
  171. data/app/assets/stylesheets/mumuki_laboratory/application/hovers.scss +0 -12
  172. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_checkboxes.scss +0 -34
  173. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_guide_corollary.scss +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bfbac4c5667f84f0ef0365430b3b8b22bb421d0149a906bff69f7ad8116200a
4
- data.tar.gz: b3a2468082c345db35724748e1e1d992e1a7fd0e4688a480040e873ac5d94650
3
+ metadata.gz: 42ddcb38b3d3ff241bc81dd9b18c22afaf7a2078d3064e5e9e888155b3e16226
4
+ data.tar.gz: 0b244643dd954e25ca038c79d71fb79cf58a5bffd915d8824ac72ccaf49a920d
5
5
  SHA512:
6
- metadata.gz: 228622d76f975543bac60f7b62f3f1ff28fb831934b1841e2fe1e4faaf6ed31b4301d30815c160c1aaa0b0751df34b056eec22ae0e56fc660261949deb40dd34
7
- data.tar.gz: a5e86b47de449d68553f162bafa77a69c7dc850bbb65efa3ab1c1401c3091da5979453b50d306a1d8a95973ffc29a66ce6f6b9bd2c29e29192c83c0a68d887e3
6
+ metadata.gz: 52ec0f9e2703a88efe4949706020b6bb83516252ab389faecd8c838ce6094faa40149bdb7d5573d95b9ad9e6d7909bd0b3f03cd0f3787925f6e37eebfd5bed6b
7
+ data.tar.gz: 6b7412a1b79947d6426f43edb5f5c50163671658227281aa94676b77abf870f1695925310a64dfa5a9d37f13f797dd4f96587c19922c28f8d043dd6c7982d708
@@ -20,12 +20,20 @@ mumuki.page.editors = [];
20
20
  $("#exercise_language_id").change(updateCodeMirrorLanguage);
21
21
  }
22
22
 
23
- function resetEditor() {
23
+ function resetSimpleEditor() {
24
24
  mumuki.page.dynamicEditors.forEach(function (e) {
25
25
  setDefaultContent(e, $('#default_content').val());
26
26
  });
27
27
  }
28
28
 
29
+ function resetEditor(isMultipleFiles) {
30
+ if (!isMultipleFiles) {
31
+ resetSimpleEditor();
32
+ } else {
33
+ mumuki.multipleFileEditor.resetEditor();
34
+ }
35
+ }
36
+
29
37
  function formatContent() {
30
38
  mumuki.page.editors.each(function (_, editor) {
31
39
  editor.setSelection({line: 0, ch: 0}, {line: editor.lineCount()});
@@ -87,7 +95,7 @@ mumuki.page.editors = [];
87
95
  $('.editor-reset').click(function (event) {
88
96
  event.stopPropagation();
89
97
  const selection = confirm(this.getAttribute('data-confirm'));
90
- if(selection) resetEditor();
98
+ if (selection) resetEditor($(event.target).parent().data('multiple-files'));
91
99
  });
92
100
 
93
101
  $('.editor-resize').click(function () {
@@ -1,9 +1,13 @@
1
1
  mumuki.load(() => {
2
- var $subscriptionSpans = $('.discussion-subscription > span');
3
- var $upvoteSpans = $('.discussion-upvote > span');
2
+ var $subscriptionButtons = $('.discussion-subscription > button');
3
+ var $upvoteButtons = $('.discussion-upvote > button');
4
+ let $messagePreviewButton = $('.discussion-new-message-preview-button.preview');
5
+ let $messageEditButton = $('.discussion-new-message-preview-button.edit');
6
+ let $newMessageContent = $('.discussion-new-message-content');
7
+ let $newMessagePreview = $('#discussion-new-message-preview');
4
8
 
5
9
  function createNewMessageEditor() {
6
- var $textarea = $("#new-discussion-message");
10
+ var $textarea = $("#discussion-new-message");
7
11
  var textarea = $textarea[0];
8
12
  if (!textarea) return;
9
13
 
@@ -26,11 +30,11 @@ mumuki.load(() => {
26
30
  }
27
31
 
28
32
  createReadOnlyEditors();
29
- createNewMessageEditor();
33
+ let editor = createNewMessageEditor();
30
34
 
31
35
  var Forum = {
32
- toggleButton: function (spans) {
33
- spans.toggleClass('hidden');
36
+ toggleButton: function (elements) {
37
+ elements.toggleClass('d-none');
34
38
  },
35
39
  token: new mumuki.CsrfToken(),
36
40
  tokenRequest: function (data) {
@@ -44,10 +48,10 @@ mumuki.load(() => {
44
48
  });
45
49
  },
46
50
  discussionSubscription: function (url) {
47
- Forum.discussionPostAndToggle(url, $subscriptionSpans);
51
+ Forum.discussionPostAndToggle(url, $subscriptionButtons);
48
52
  },
49
53
  discussionUpvote: function (url) {
50
- Forum.discussionPostAndToggle(url, $upvoteSpans);
54
+ Forum.discussionPostAndToggle(url, $upvoteButtons);
51
55
  },
52
56
  discussionPostAndToggle: function (url, elem) {
53
57
  Forum.discussionPost(url).done(Forum.toggleButton(elem));
@@ -67,9 +71,46 @@ mumuki.load(() => {
67
71
  const params = new URLSearchParams(location.search);
68
72
  elem.is(':checked') ? params.set(key, elem.val()) : params.delete(key);
69
73
  location.search = params.toString();
74
+ },
75
+ discussionMessagePreview: function (url) {
76
+ return Forum.tokenRequest({
77
+ url: url,
78
+ method: 'GET',
79
+ processData: false,
80
+ dataType: 'json',
81
+ data: new URLSearchParams({ content: editor.getValue() } ),
82
+ success: function (response) {
83
+ showPreview(response.preview);
84
+ },
85
+ error: function (e) {
86
+ error = $messagePreviewButton.attr('error-text');
87
+ showPreview(error);
88
+ },
89
+ xhrFields: {withCredentials: true}
90
+ });
91
+ },
92
+ hidePreviewAndShowEditor: function(elem) {
93
+ togglePreviewAndEditButtons();
94
+ togglePreviewAndContentMessage();
70
95
  }
71
96
  };
72
97
 
98
+ function showPreview(preview) {
99
+ $newMessagePreview.html($.parseHTML(preview));
100
+ togglePreviewAndEditButtons();
101
+ togglePreviewAndContentMessage();
102
+ }
103
+
104
+ function togglePreviewAndEditButtons() {
105
+ $messagePreviewButton.toggleClass('d-none');
106
+ $messageEditButton.toggleClass('d-none');
107
+ }
108
+
109
+ function togglePreviewAndContentMessage() {
110
+ $newMessagePreview.toggleClass('d-none');
111
+ $newMessageContent.toggleClass('d-none');
112
+ }
113
+
73
114
  mumuki.Forum = Forum;
74
115
 
75
116
  });
@@ -32,9 +32,8 @@ mumuki.faqs = class {
32
32
  }
33
33
 
34
34
  _createNavbarItem($faqsNavbar, faqGroup) {
35
- const $newLink = $('<a></a>').attr("href",`#${faqGroup.id}`)
36
- .html(`${faqGroup.children[0].textContent}`);
37
- const $navItem = $('<li></li>').html($newLink);
35
+ const $navItem = $(`<li><a href="#${faqGroup.id}">`)
36
+ .html(`${faqGroup.querySelector('h2').textContent}`);
38
37
  $faqsNavbar.append($navItem);
39
38
  return $navItem;
40
39
  }
@@ -51,8 +50,19 @@ mumuki.faqs = class {
51
50
  _createFaqsGroups() {
52
51
  const elemsGroups = this._buildFaqsGroups();
53
52
  elemsGroups.forEach((group, index) => {
54
- $(group).wrapAll(`<div class='mu-faqs-group' id='mu-faqs-group-${index}'>`)
53
+ $(group).wrapAll(`<div class='mu-faqs-group' id='mu-faqs-group-${index}'>`);
55
54
  });
55
+ this._createFaqsIcons();
56
+ }
57
+
58
+ _createFaqsIcons() {
59
+ const $faqIcon = $('<i class="mu-faqs-group-icon fa fa-plus">');
60
+ $faqIcon.click(function(e){
61
+ const $elem = $(this);
62
+ $elem.toggleClass('fa-plus fa-minus');
63
+ $elem.closest('.mu-faqs-group').toggleClass('active');
64
+ })
65
+ $('.mu-faqs-group').prepend($faqIcon);
56
66
  }
57
67
 
58
68
  _buildFaqsGroups() {
@@ -82,11 +82,11 @@ mumuki.gamification = (() => {
82
82
 
83
83
  defaultGainedExperienceAction() {
84
84
  $('#mu-exp-points').html(this.lastEarnedExp);
85
- $('#mu-exp-earned-message').removeClass('hidden');
85
+ $('#mu-exp-earned-message').removeClass('d-none');
86
86
  }
87
87
 
88
88
  defaultLevelUpAction(_levelUpHtml) {
89
- $('#mu-level-up').modal();
89
+ new bootstrap.Modal('#mu-level-up').show();
90
90
  }
91
91
 
92
92
  registerLevelUpAction(action) {
@@ -118,7 +118,7 @@ mumuki.gamification = (() => {
118
118
  updateTooltip() {
119
119
  const $muLevelTooltip = $('.mu-level-tooltip');
120
120
 
121
- $muLevelTooltip.attr("data-original-title", `${$muLevelTooltip.attr("level")} ${this.currentLevel()}`);
121
+ $muLevelTooltip.attr("data-bs-original-title", `${$muLevelTooltip.attr("level")} ${this.currentLevel()}`);
122
122
  $muLevelTooltip.attr("title", "");
123
123
  }
124
124
 
@@ -51,10 +51,13 @@ mumuki.Kids = class {
51
51
  }
52
52
 
53
53
  showContext() {
54
- this.$contextModal.modal({
55
- backdrop: 'static',
56
- keyboard: false
57
- });
54
+ let context = document.getElementById('mu-kids-context');
55
+ if (context) {
56
+ new bootstrap.Modal(context, {
57
+ backdrop: 'static',
58
+ keyboard: false
59
+ }).show();
60
+ }
58
61
  }
59
62
 
60
63
  showNonAbortedPopup(data, animation_name, open_modal_delay_ms = 0) {
@@ -66,7 +69,7 @@ mumuki.Kids = class {
66
69
 
67
70
  showAbortedPopup(_data) {
68
71
  this.submitButton.disable();
69
- this.$resultsAbortedModal.modal();
72
+ new bootstrap.Modal(document.getElementById('kids-results-aborted')).show();
70
73
  }
71
74
 
72
75
  showOverlay() {
@@ -114,11 +117,12 @@ mumuki.Kids = class {
114
117
  // =================
115
118
 
116
119
  _openSubmissionResultModal(data) {
117
- this.$resultsModal.modal({ backdrop: 'static', keyboard: false });
120
+ let modal = new bootstrap.Modal(document.getElementById('kids-results'), { backdrop: 'static', keyboard: false });
121
+ modal.show();
118
122
  this.$resultsModal.find('.modal-header').first().html(data.title_html);
119
123
  mumuki.gamification.currentLevelProgression.setExpMessage(data);
120
124
  this.$resultsModal.find('.modal-footer').first().html(data.button_html);
121
- $('.mu-close-modal').click(() => this.$resultsModal.modal('hide'));
125
+ $('.mu-close-modal').click(() => modal.hide());
122
126
  this.onSubmissionResultModalOpen(data);
123
127
  }
124
128
 
@@ -116,8 +116,8 @@ mumuki.load(() => {
116
116
  _action(add, remove, isPlaying, callback) {
117
117
  callback(window.speechSynthesis);
118
118
  const $button = $('.mu-kindergarten-play-description');
119
- $button.find(`.mu-kindergarten-${add}`).addClass('hidden');
120
- $button.find(`.mu-kindergarten-${remove}`).removeClass('hidden');
119
+ $button.find(`.mu-kindergarten-${add}`).addClass('d-none');
120
+ $button.find(`.mu-kindergarten-${remove}`).removeClass('d-none');
121
121
  this._isPlaying = isPlaying;
122
122
  },
123
123
  verifyBrowserSupport() {
@@ -146,7 +146,7 @@ mumuki.load(() => {
146
146
  showOrHideExpandHintButton() {
147
147
  const $button = $('.expand-or-collapse-hint-media');
148
148
  const $hintMedia = $('.mu-kindergarten-hint-media');
149
- if (!$hintMedia.get(0)) $button.addClass('hidden');
149
+ if (!$hintMedia.get(0)) $button.addClass('d-none');
150
150
  },
151
151
  };
152
152
  }
@@ -10,12 +10,12 @@ mumuki.load(() => {
10
10
  return Chat.$newMessageModal().find('.modal-body, .modal-footer');
11
11
  },
12
12
  collapseNewMessageModal: function () {
13
- Chat.$newMessageModalComponents().toggleClass('hidden');
13
+ Chat.$newMessageModalComponents().toggleClass('d-none');
14
14
  },
15
15
  token: new mumuki.CsrfToken(),
16
16
  setMessages: function (data) {
17
17
  $('.badge-notifications').html(data.messages_count);
18
- $('.notifications-box').toggleClass('notifications-box-empty', !data.has_messages);
18
+ $('.notifications-box').toggleClass('d-none', !data.has_messages);
19
19
  $('.pending-messages-filter').removeClass('pending-messages-filter');
20
20
  $('button.btn-submit').removeClass('disabled');
21
21
  $('.pending-messages-text').remove();
@@ -53,7 +53,7 @@ mumuki.load(() => {
53
53
  function renderHTML(data) {
54
54
  $container.empty();
55
55
  $container.html(data);
56
- $("a[data-target='#messages']").click();
56
+ $("a[data-bs-target='#messages']").click();
57
57
  }
58
58
 
59
59
  function success(data) {
@@ -34,14 +34,14 @@ mumuki.ModalCarrousel = (() => {
34
34
  const $close = $('.mu-kids-modal-button.mu-close');
35
35
  const $footer = $('.modal-footer');
36
36
  const isLastChild = this._activeSlide().is(':last-child');
37
- this._addClassIf($next, 'hidden', () => isLastChild);
38
- this._addClassIf($close, 'hidden', () => !isLastChild);
39
- this._addClassIf($footer, 'hidden', () => !isLastChild);
37
+ this._addClassIf($next, 'd-none', () => isLastChild);
38
+ this._addClassIf($close, 'd-none', () => !isLastChild);
39
+ this._addClassIf($footer, 'd-none', () => !isLastChild);
40
40
  }
41
41
 
42
42
  _hidePreviousButtonIfFirstSlide() {
43
43
  const $prev = $('.mu-kids-modal-button.mu-previous');
44
- this._addClassIf($prev, 'hidden', () => this._activeSlide().is(':first-child'));
44
+ this._addClassIf($prev, 'd-none', () => this._activeSlide().is(':first-child'));
45
45
  }
46
46
 
47
47
  _showFirstSlide() {
@@ -28,7 +28,7 @@ mumuki.load(() => {
28
28
  }
29
29
 
30
30
  get isSelected() {
31
- return this.tab.hasClass("active");
31
+ return this.tab.children().first().hasClass("active");
32
32
  }
33
33
 
34
34
  setUpOnRemove(handler) {
@@ -58,12 +58,12 @@ mumuki.load(() => {
58
58
 
59
59
  _selectElement(element) {
60
60
  element.addClass('active');
61
- element.addClass('in');
61
+ element.addClass('show');
62
62
  }
63
63
 
64
64
  _unselectElement(element) {
65
65
  element.removeClass('active');
66
- element.removeClass('in');
66
+ element.removeClass('show');
67
67
  }
68
68
  }
69
69
 
@@ -135,6 +135,13 @@ mumuki.load(() => {
135
135
  });
136
136
  }
137
137
 
138
+ resetEditor() {
139
+ const defaultContents = this._getDataFromHiddenInput('#multifile-default-content');
140
+ mumuki.page.editors.each(function (i, editor) {
141
+ editor.getDoc().setValue(defaultContents[i] ? defaultContents[i].content : '');
142
+ });
143
+ }
144
+
138
145
  _addFile() {
139
146
  let name = prompt(this.locales.insert_file_name);
140
147
  const alreadyExists = this.files.toArray().some(it => it.name === name);
@@ -157,14 +164,18 @@ mumuki.load(() => {
157
164
  const previousIndex = Math.max(index - 1, 0);
158
165
 
159
166
  const wasSelected = file.remove();
160
- if (wasSelected) this.files[previousIndex].select();
167
+ if (wasSelected) {
168
+ this.tabs.children()[previousIndex].click();
169
+ }
161
170
 
162
171
  this.updateButtonsVisibility();
163
172
  }
164
173
 
165
174
  _createTab(name, id) {
166
175
  const tab = this.tabs.last().clone();
167
- tab.attr('data-target', `#${id}`);
176
+ let link = tab.children().first();
177
+ link.attr('data-bs-target', `#${id}`);
178
+ link.removeClass('active');
168
179
 
169
180
  return tab;
170
181
  }
@@ -184,6 +195,8 @@ mumuki.load(() => {
184
195
  .setupLanguage(highlightMode)
185
196
  .build();
186
197
 
198
+ mumuki.page.editors.push(codeMirrorEditor);
199
+
187
200
  codeMirrorEditor.on("change", (event) => {
188
201
  textarea.val(event.getValue());
189
202
  });
@@ -60,7 +60,7 @@ mumuki.MultipleScenarios = (() => {
60
60
  this.createControls();
61
61
  this.createIndicators();
62
62
  this.setActiveIndex(0);
63
- $('.mu-scenario-control').removeClass('hidden');
63
+ $('.mu-scenario-control').removeClass('d-none');
64
64
  }
65
65
 
66
66
  validScenarioIndex (index) {
@@ -0,0 +1,32 @@
1
+ mumuki.organization = {
2
+
3
+ /**
4
+ * The current organization's id
5
+ *
6
+ * @type {number?}
7
+ * */
8
+ _id: null,
9
+
10
+ /**
11
+ * The current organization's id
12
+ *
13
+ * @type {number?}
14
+ * */
15
+ get id() {
16
+ return this._id;
17
+ },
18
+
19
+ /**
20
+ * Set global current organization information
21
+ */
22
+ load() {
23
+ const $muOrganizationId = $('#mu-organization-id');
24
+ if ($muOrganizationId.length) {
25
+ this._id = $muOrganizationId.val();
26
+ } else {
27
+ this._id = null;
28
+ }
29
+ }
30
+ };
31
+
32
+ mumuki.load(() => mumuki.organization.load());
@@ -79,12 +79,12 @@ mumuki.load(() => {
79
79
 
80
80
  this._$speechTabs.each((i) => {
81
81
  const $tab = $(this._$speechTabs[i]);
82
- if ($tab.data('target')) {
82
+ if ($tab.data('bs-target')) {
83
83
  $tab.click(() => {
84
84
  this._$speechTabs.removeClass('active');
85
85
  $tab.addClass('active');
86
86
  this._$texts.hide();
87
- this.$characterSpeechBubbleNormal.children('.' + $tab.data('target')).show();
87
+ this.$characterSpeechBubbleNormal.children('.' + $tab.data('bs-target')).show();
88
88
  this._updateSpeechParagraphs();
89
89
  });
90
90
  }
@@ -151,7 +151,7 @@ mumuki.load(() => {
151
151
  const $bubble = this.$characterSpeechBubble;
152
152
  $bubble.find('.mu-kids-character-speech-bubble-tabs').show();
153
153
  $bubble.find('.mu-kids-character-speech-bubble-normal').show();
154
- $bubble.find('.mu-kids-character-speech-bubble-failed').hide();
154
+ $bubble.find('.mu-kids-character-speech-bubble-failed').addClass('d-none').removeClass('d-block');
155
155
  $bubble.find('.mu-kids-discussion-link').remove();
156
156
  Object.keys(this.resultActions).forEach($bubble.removeClass.bind($bubble));
157
157
  }
@@ -225,7 +225,7 @@ mumuki.load(() => {
225
225
  }
226
226
 
227
227
  _getSelectedTabName() {
228
- return this._$speechTabs.filter('.active').data('target') || 'description';
228
+ return this._$speechTabs.filter('.active').data('bs-target') || 'description';
229
229
  }
230
230
 
231
231
  }
@@ -72,12 +72,6 @@ mumuki.load(function() {
72
72
  form.append(`<input type="hidden" name="user[avatar_type]" value="${type}"/>`);
73
73
  }
74
74
 
75
- $("#mu-edit-avatar-icon").on('keypress click', function(e) {
76
- onClickOrSpacebarOrEnter($(this), e, function() {
77
- $avatarPicker.modal();
78
- });
79
- });
80
-
81
75
  function onClickOrSpacebarOrEnter(element, e, func) {
82
76
  if (e.which === 13 || e.which === 32 || e.type === 'click') {
83
77
  func.apply(element);