mumuki-laboratory 9.14.1 → 9.15.0
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/codemirror-builder.js +6 -2
- data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +3 -2
- data/app/assets/javascripts/mumuki_laboratory/application/console.js +7 -1
- data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +8 -13
- data/app/assets/javascripts/mumuki_laboratory/application/exercise.js +20 -0
- data/app/assets/javascripts/mumuki_laboratory/application/i18n.js +4 -0
- data/app/helpers/editor_helper.rb +1 -1
- data/app/views/exercises/_read_only.html.erb +27 -35
- data/lib/mumuki/laboratory/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67dd086ce64c96505cea38bf9fdf857f304acd8322d91e4c139e0a847e89ce46
|
4
|
+
data.tar.gz: 48b771a27f10a159b4b10e38e88cee08f4f032969fbe7a533d188dd4f50cc0b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28dd46787bfb3b9fb50ab7ae7b6d1421e8abb5ec9b0f4f9c20bc4af62da0a5343c6a0973ebad6073af95f66178c49d0f4cccac36f11e1ce6245a23e4527143c
|
7
|
+
data.tar.gz: 3ba41f5eee2cdd908ecedbe5694de3738715f99a2c3e6c6e17d0049d2224f74be08fbbcf72b4910a4e4a7c440e05e2b87130466055919ba1b0b704d15ed29688
|
@@ -27,7 +27,11 @@
|
|
27
27
|
this.$textarea = $(textarea);
|
28
28
|
}
|
29
29
|
|
30
|
-
setupEditor() {
|
30
|
+
setupEditor(readonly = false) {
|
31
|
+
return readonly ? this._setupReadOnlyEditor() : this._setupCommonEditor();
|
32
|
+
}
|
33
|
+
|
34
|
+
_setupCommonEditor() {
|
31
35
|
this.editor = this.createEditor({
|
32
36
|
lineNumbers: true,
|
33
37
|
extraKeys: {
|
@@ -61,7 +65,7 @@
|
|
61
65
|
return this;
|
62
66
|
}
|
63
67
|
|
64
|
-
|
68
|
+
_setupReadOnlyEditor() {
|
65
69
|
this.editor = this.createEditor({
|
66
70
|
readOnly: true,
|
67
71
|
cursorBlinkRate: -1, //Hides the cursor
|
@@ -6,10 +6,11 @@ mumuki.page.editors = [];
|
|
6
6
|
(() => {
|
7
7
|
function createCodeMirrors() {
|
8
8
|
return $(".editor").map(function (index, textarea) {
|
9
|
-
|
9
|
+
const $textarea = $("#solution_content");
|
10
|
+
const readonly = $textarea.data('readonly');
|
10
11
|
|
11
12
|
return new mumuki.editor.CodeMirrorBuilder(textarea)
|
12
|
-
.setupEditor()
|
13
|
+
.setupEditor(readonly)
|
13
14
|
.setupMinLines($textarea.data('lines'))
|
14
15
|
.setupLanguage()
|
15
16
|
.build();
|
@@ -87,7 +87,7 @@
|
|
87
87
|
}
|
88
88
|
get content() {
|
89
89
|
var firstEditor = mumuki.page.editors[0];
|
90
|
-
if (firstEditor &&
|
90
|
+
if (firstEditor && this.includeSolution())
|
91
91
|
return firstEditor.getValue();
|
92
92
|
else
|
93
93
|
return '';
|
@@ -142,6 +142,12 @@
|
|
142
142
|
get _requestData() {
|
143
143
|
return {content: this.content, query: this.line, cookie: this.cookie};
|
144
144
|
}
|
145
|
+
includeSolution() {
|
146
|
+
return !this._includeSolutionCheckbox || this._includeSolutionCheckbox.checked;
|
147
|
+
}
|
148
|
+
get _includeSolutionCheckbox() {
|
149
|
+
return $("#include_solution")[0];
|
150
|
+
}
|
145
151
|
}
|
146
152
|
|
147
153
|
|
@@ -19,25 +19,18 @@ mumuki.load(() => {
|
|
19
19
|
.build();
|
20
20
|
}
|
21
21
|
|
22
|
-
function createReadOnlyEditors() {
|
23
|
-
return $(".read-only-editor").map(function (index, textarea) {
|
24
|
-
var $textarea = $("#solution_content");
|
25
|
-
|
26
|
-
return new mumuki.editor.CodeMirrorBuilder(textarea)
|
27
|
-
.setupReadOnlyEditor()
|
28
|
-
.setupMinLines($textarea.data('lines'))
|
29
|
-
.setupLanguage()
|
30
|
-
.build();
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
createReadOnlyEditors();
|
35
22
|
let editor = createNewMessageEditor();
|
36
23
|
|
37
24
|
var Forum = {
|
38
25
|
toggleButton: function (elements) {
|
39
26
|
elements.toggleClass('d-none');
|
40
27
|
},
|
28
|
+
disableButton: function (elements) {
|
29
|
+
elements.attr('disabled', true);
|
30
|
+
},
|
31
|
+
reenableButton: function (elements) {
|
32
|
+
elements.attr('disabled', false);
|
33
|
+
},
|
41
34
|
token: new mumuki.CsrfToken(),
|
42
35
|
tokenRequest: function (data) {
|
43
36
|
return $.ajax(Forum.token.newRequest(data));
|
@@ -56,6 +49,7 @@ mumuki.load(() => {
|
|
56
49
|
Forum.discussionPostAndToggle(url, $upvoteButtons);
|
57
50
|
},
|
58
51
|
discussionResponsible: function (url) {
|
52
|
+
Forum.disableButton($responsibleButton);
|
59
53
|
Forum.discussionPostToggleAndRenderToast(url, $responsibleButton);
|
60
54
|
$('.responsible-moderator-badge').toggleClass('d-none');
|
61
55
|
},
|
@@ -66,6 +60,7 @@ mumuki.load(() => {
|
|
66
60
|
Forum.discussionPost(url)
|
67
61
|
.done(function (response) {
|
68
62
|
Forum.toggleButton(elem);
|
63
|
+
Forum.reenableButton(elem);
|
69
64
|
mumuki.toast.addToast(response);
|
70
65
|
})
|
71
66
|
.fail(function (response) {
|
@@ -1,3 +1,23 @@
|
|
1
|
+
(() => {
|
2
|
+
function solutionChangedSinceLastSubmission() {
|
3
|
+
return mumuki.exercise.id &&
|
4
|
+
mumuki.SubmissionsStore.getLastSubmissionAndResult(mumuki.exercise.id) &&
|
5
|
+
!mumuki.SubmissionsStore.getSubmissionResultFor(mumuki.exercise.id, mumuki.editors.getSubmission());
|
6
|
+
}
|
7
|
+
|
8
|
+
window.addEventListener("beforeunload", (event) => {
|
9
|
+
if (solutionChangedSinceLastSubmission()) {
|
10
|
+
event.returnValue = 'unsaved_progress';
|
11
|
+
} else {
|
12
|
+
delete event['returnValue'];
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
window.addEventListener("turbolinks:before-visit", (event) => {
|
17
|
+
if (solutionChangedSinceLastSubmission() && !confirm(mumuki.I18n.t('unsaved_progress'))) event.preventDefault();
|
18
|
+
});
|
19
|
+
})();
|
20
|
+
|
1
21
|
/**
|
2
22
|
* @typedef {"input_right" | "input_bottom" | "input_primary" | "input_kindergarten"} Layout
|
3
23
|
* @typedef {{id: number, layout: Layout, settings: any}} Exercise
|
@@ -9,6 +9,7 @@ mumuki.I18n = (() => {
|
|
9
9
|
passed_with_warnings: () => "Tu solución funcionó, pero hay cosas que mejorar",
|
10
10
|
pending: () => "Pendiente",
|
11
11
|
skipped: () => "Venís aprendiendo muy bien, por lo que aprobaste este ejercicio",
|
12
|
+
unsaved_progress: () => "Tu solución tiene cambios sin guardar, ¿Querés salir de todos modos?",
|
12
13
|
},
|
13
14
|
'es-CL': {
|
14
15
|
aborted: () => "Ups, no pudimos evaluar tu solución",
|
@@ -18,6 +19,7 @@ mumuki.I18n = (() => {
|
|
18
19
|
passed_with_warnings: () => "Tu solución funcionó, pero hay cosas que mejorar",
|
19
20
|
pending: () => "Pendiente",
|
20
21
|
skipped: () => "Vienes aprendiendo muy bien, por lo que aprobaste este ejercicio",
|
22
|
+
unsaved_progress: () => "Tu solución tiene cambios sin guardar, ¿Quieres salir de todos modos?",
|
21
23
|
},
|
22
24
|
'en': {
|
23
25
|
aborted: () => "Oops, we couldn't evaluate your solution",
|
@@ -27,6 +29,7 @@ mumuki.I18n = (() => {
|
|
27
29
|
passed_with_warnings: () => "It worked, but you can do better",
|
28
30
|
pending: () => "Pending",
|
29
31
|
skipped: () => "You are doing very well, so you've passed this exercise",
|
32
|
+
unsaved_progress: () => "Your solution has unsaved changes, leave anyways?",
|
30
33
|
},
|
31
34
|
'pt': {
|
32
35
|
aborted: () => "Opa, não pudemos avaliar sua solução",
|
@@ -36,6 +39,7 @@ mumuki.I18n = (() => {
|
|
36
39
|
passed_with_warnings: () => "Sua solução funcionou, mas há coisas para melhorar",
|
37
40
|
pending: () => "Pendente",
|
38
41
|
skipped: () => "Você está aprendendo muito bem e passou neste exercício",
|
42
|
+
unsaved_progress: () => "Sua solução tem alterações não salvas. Deseja sair mesmo assim?",
|
39
43
|
}
|
40
44
|
}
|
41
45
|
|
@@ -7,7 +7,7 @@ module EditorHelper
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def read_only_editor(content, language, options = {})
|
10
|
-
editor_options = editor_defaults(language, options, '
|
10
|
+
editor_options = editor_defaults(language, options.deep_merge(data: { readonly: true }), 'editor')
|
11
11
|
text_area_tag :solution_content, content, editor_options
|
12
12
|
end
|
13
13
|
|
@@ -47,22 +47,18 @@
|
|
47
47
|
|
48
48
|
<% if should_render_read_only_exercise_tabs?(@discussion) %>
|
49
49
|
<ul class="nav nav-tabs discussion-tabs" role="tablist">
|
50
|
-
|
51
|
-
<% if @discussion.has_submission? %>
|
52
|
-
<li role="presentation">
|
53
|
-
<a class="editor-tab nav-link active" data-bs-target="#solution" aria-controls="solution" role="tab" data-bs-toggle="tab">
|
54
|
-
<%= t :solution %>
|
55
|
-
</a>
|
56
|
-
</li>
|
57
|
-
<li role="presentation">
|
58
|
-
<a class="editor-tab nav-link" data-bs-target="#results" aria-controls="results" role="tab" data-bs-toggle="tab">
|
59
|
-
<%= t :results %>
|
60
|
-
</a>
|
61
|
-
</li>
|
62
|
-
<% end %>
|
63
|
-
|
64
50
|
<li role="presentation">
|
65
|
-
<a class="editor-tab nav-link
|
51
|
+
<a class="editor-tab nav-link active" data-bs-target="#solution" aria-controls="solution" role="tab" data-bs-toggle="tab">
|
52
|
+
<%= t :solution %>
|
53
|
+
</a>
|
54
|
+
</li>
|
55
|
+
<li role="presentation">
|
56
|
+
<a class="editor-tab nav-link" data-bs-target="#results" aria-controls="results" role="tab" data-bs-toggle="tab">
|
57
|
+
<%= t :results %>
|
58
|
+
</a>
|
59
|
+
</li>
|
60
|
+
<li role="presentation">
|
61
|
+
<a class="editor-tab nav-link" data-bs-target="#content" aria-controls="content" role="tab" data-bs-toggle="tab">
|
66
62
|
<%= t :description %>
|
67
63
|
</a>
|
68
64
|
</li>
|
@@ -77,32 +73,28 @@
|
|
77
73
|
</ul>
|
78
74
|
|
79
75
|
<div class="tab-content">
|
80
|
-
|
81
|
-
<div
|
82
|
-
<div class="mu-
|
83
|
-
|
84
|
-
<div class="mu-read-only-editor">
|
85
|
-
<%= render_exercise_read_only_editor exercise, @discussion.solution %>
|
86
|
-
</div>
|
87
|
-
</div>
|
76
|
+
<div role="tabpanel" class="tab-pane mu-input-panel fade show active" id="solution">
|
77
|
+
<div class="mu-tab-body">
|
78
|
+
<div class="mu-read-only-editor">
|
79
|
+
<%= render_exercise_read_only_editor exercise, @discussion.solution %>
|
88
80
|
</div>
|
89
81
|
</div>
|
82
|
+
</div>
|
90
83
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
</div>
|
84
|
+
<div role="tabpanel" class="tab-pane fade" id="results">
|
85
|
+
<div class="mu-tab-body">
|
86
|
+
<%= render layout: 'exercise_solutions/contextualization_results_container', locals: { contextualization: @discussion } do %>
|
87
|
+
<div class="row">
|
88
|
+
<div class="col-md-12 submission-results">
|
89
|
+
<%= render partial: 'exercise_solutions/contextualization_results_body',
|
90
|
+
locals: { contextualization: @discussion, guide_finished_by_solution: false } %>
|
99
91
|
</div>
|
100
|
-
|
101
|
-
|
92
|
+
</div>
|
93
|
+
<% end %>
|
102
94
|
</div>
|
103
|
-
|
95
|
+
</div>
|
104
96
|
|
105
|
-
<div role="tabpanel" class="tab-pane
|
97
|
+
<div role="tabpanel" class="tab-pane fade" id="content">
|
106
98
|
<div class="mu-tab-body">
|
107
99
|
<div class="exercise-assignment">
|
108
100
|
<%= render partial: 'exercises/exercise_assignment', locals: { exercise: exercise } %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-laboratory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 9.
|
33
|
+
version: 9.15.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 9.
|
40
|
+
version: 9.15.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mumukit-bridge
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|