mumuki-gobstones-runner 1.5.2 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets_server.rb +18 -9
- data/lib/gobstones.rb +1 -0
- data/lib/gobstones/batch.rb +2 -1
- data/lib/gobstones_runner.rb +1 -1
- data/lib/{assets → public}/boom.png +0 -0
- data/lib/render/boards.html.erb +1 -1
- data/lib/render/editor/editor.css +21 -5
- data/lib/render/editor/editor.html +405 -0
- data/lib/render/editor/editor.js +11 -6
- data/lib/render/html_renderer.rb +0 -6
- data/lib/version_hook.rb +1 -1
- metadata +24 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9496d7c5a67e0f21e32ad029f1ea57d3e247d2a355fca98d9dedb8ce02e323ac
|
4
|
+
data.tar.gz: 0d42d8bf920dd649f54ac2705012f3ab4a23ffc1b07249fd1ad99efa8a07dce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8800718454321a1533216d96bc66df34ffed2e751385a9e387f867608a902a33ec67ca1630918e3df03b9e08182df621c48b0f9b3a4adcd3893166b420ef9371
|
7
|
+
data.tar.gz: 87a9e6c0001cf61fd910c59eca4dffb40858eb716f774aa21ef282dc71839fd7764879e6dcf6e9bc7141b95be6cc066fbd4f9a03368948099d0817a67d8239a3
|
data/lib/assets_server.rb
CHANGED
@@ -11,7 +11,7 @@ class Mumukit::Server::App < Sinatra::Base
|
|
11
11
|
|
12
12
|
def self.get_asset(route, absolute_path, type)
|
13
13
|
get "/assets/#{route}" do
|
14
|
-
send_file absolute_path,
|
14
|
+
send_file absolute_path, type: type
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -23,15 +23,24 @@ class Mumukit::Server::App < Sinatra::Base
|
|
23
23
|
get_asset route, Gobstones::Blockly.assets_path_for(path), type
|
24
24
|
end
|
25
25
|
|
26
|
+
def self.get_submit_asset(route, path, type)
|
27
|
+
get_asset route, Gobstones::CodeRunner.assets_path_for(path), type
|
28
|
+
end
|
29
|
+
|
26
30
|
def self.get_local_asset(route, path, type)
|
27
|
-
get_asset route, File.join(__dir__, '..'
|
31
|
+
get_asset route, File.join(__dir__, '..', path), type
|
28
32
|
end
|
29
33
|
|
30
|
-
|
31
|
-
get_board_asset
|
32
|
-
get_board_asset
|
33
|
-
get_board_asset
|
34
|
-
|
35
|
-
get_editor_asset 'editor/
|
36
|
-
|
34
|
+
get_board_asset 'polymer.html', 'htmls/vendor/polymer.html', 'text/html'
|
35
|
+
get_board_asset 'polymer-mini.html', 'htmls/vendor/polymer-mini.html', 'text/html'
|
36
|
+
get_board_asset 'polymer-micro.html', 'htmls/vendor/polymer-micro.html', 'text/html'
|
37
|
+
get_board_asset 'gs-board.html', 'htmls/gs-board.html', 'text/html'
|
38
|
+
|
39
|
+
get_editor_asset 'editor/gs-element-blockly.html', 'htmls/gs-element-blockly.html', 'text/html'
|
40
|
+
|
41
|
+
get_submit_asset 'editor/gobstones-code-runner.html', 'htmls/gobstones-code-runner.html', 'text/html'
|
42
|
+
|
43
|
+
get_local_asset 'editor/editor.js', 'lib/render/editor/editor.js', 'application/javascript'
|
44
|
+
get_local_asset 'editor/editor.css', 'lib/render/editor/editor.css', 'text/css'
|
45
|
+
get_local_asset 'editor/editor.html', 'lib/render/editor/editor.html', 'text/html'
|
37
46
|
end
|
data/lib/gobstones.rb
CHANGED
data/lib/gobstones/batch.rb
CHANGED
@@ -29,7 +29,8 @@ class Gobstones::Batch
|
|
29
29
|
def example_base_json(example)
|
30
30
|
{initialBoard: example[:preconditions][:initial_board],
|
31
31
|
originalCode: content,
|
32
|
-
code:
|
32
|
+
code: example_code(example),
|
33
|
+
extraCode: extra}
|
33
34
|
end
|
34
35
|
|
35
36
|
def example_code(example)
|
data/lib/gobstones_runner.rb
CHANGED
@@ -5,7 +5,7 @@ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
|
|
5
5
|
|
6
6
|
Mumukit.runner_name = 'gobstones'
|
7
7
|
Mumukit.configure do |config|
|
8
|
-
config.docker_image = 'mumuki/mumuki-gobstones-worker:1.
|
8
|
+
config.docker_image = 'mumuki/mumuki-gobstones-worker:1.8'
|
9
9
|
config.content_type = 'html'
|
10
10
|
config.structured = true
|
11
11
|
end
|
File without changes
|
data/lib/render/boards.html.erb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
#blocklyDiv {
|
2
|
-
height: 400px !important;
|
3
|
-
width: 555px !important;
|
4
|
-
}
|
5
|
-
|
6
1
|
.blocklyTrash {
|
7
2
|
display: none;
|
8
3
|
}
|
@@ -10,3 +5,24 @@
|
|
10
5
|
.blocklyZoom {
|
11
6
|
display: none;
|
12
7
|
}
|
8
|
+
|
9
|
+
.blocklyText {
|
10
|
+
fill: black !important;
|
11
|
+
stroke-width: 0.10px !important;
|
12
|
+
stroke: black !important;
|
13
|
+
}
|
14
|
+
|
15
|
+
.blocklyEditableText > rect {
|
16
|
+
fill-opacity: 0;
|
17
|
+
}
|
18
|
+
|
19
|
+
.blocklyEditableText > text > tspan {
|
20
|
+
fill: black !important;
|
21
|
+
}
|
22
|
+
|
23
|
+
.blocklyHighlightedConnectionPath,
|
24
|
+
.blocklySelected > .blocklyPath {
|
25
|
+
stroke: white;
|
26
|
+
stroke-width: 3px;
|
27
|
+
stroke-opacity: 0.5;
|
28
|
+
}
|
@@ -0,0 +1,405 @@
|
|
1
|
+
<link href="./gs-element-blockly.html" rel="import" />
|
2
|
+
<link href="./gobstones-code-runner.html" rel="import" />
|
3
|
+
|
4
|
+
<dom-module id="mu-gobstones-custom-editor">
|
5
|
+
<template>
|
6
|
+
<gs-element-blockly read-only="{{readOnly}}" id="blocklyElement" media="https://github.com/Program-AR/blockly-package/raw/v0.0.15/media/"></gs-element-blockly>
|
7
|
+
<gs-element-blockly id="blocklyTmp" style="display: none" media="https://github.com/Program-AR/blockly-package/raw/v0.0.15/media/"></gs-element-blockly>
|
8
|
+
</template>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
Polymer({
|
12
|
+
is: 'mu-gobstones-custom-editor',
|
13
|
+
properties: {
|
14
|
+
readOnly: {
|
15
|
+
type: Boolean,
|
16
|
+
value: false
|
17
|
+
}
|
18
|
+
},
|
19
|
+
|
20
|
+
attached: function() {
|
21
|
+
const setBlocklyColors = () => {
|
22
|
+
if (typeof Blockly === 'undefined' || !Blockly.GOBSTONES_COLORS) return setTimeout(setBlocklyColors, 50);
|
23
|
+
Blockly.HSV_SATURATION = 0.64;
|
24
|
+
Blockly.HSV_VALUE = 1;
|
25
|
+
|
26
|
+
Blockly.MUMUKI_COLORS = {
|
27
|
+
pink: 346,
|
28
|
+
blue: 204,
|
29
|
+
yellow: 40
|
30
|
+
};
|
31
|
+
|
32
|
+
Blockly.Msg.MATH_HUE = Blockly.MUMUKI_COLORS.blue;
|
33
|
+
Blockly.GOBSTONES_COLORS.literalExpression = Blockly.MUMUKI_COLORS.blue;
|
34
|
+
|
35
|
+
Blockly.GOBSTONES_COLORS.program = Blockly.MUMUKI_COLORS.pink;
|
36
|
+
Blockly.GOBSTONES_COLORS.interactiveProgram = Blockly.MUMUKI_COLORS.pink;
|
37
|
+
Blockly.GOBSTONES_COLORS.interactiveBinding = Blockly.MUMUKI_COLORS.pink;
|
38
|
+
|
39
|
+
Blockly.GOBSTONES_COLORS.controlStructure = Blockly.MUMUKI_COLORS.yellow;
|
40
|
+
Blockly.GOBSTONES_COLORS.primitiveCommand = Blockly.MUMUKI_COLORS.yellow;
|
41
|
+
Blockly.GOBSTONES_COLORS.complete = Blockly.MUMUKI_COLORS.yellow;
|
42
|
+
Blockly.GOBSTONES_COLORS.expression = Blockly.MUMUKI_COLORS.yellow;
|
43
|
+
Blockly.GOBSTONES_COLORS.assignation = Blockly.MUMUKI_COLORS.yellow;
|
44
|
+
}
|
45
|
+
|
46
|
+
const updateFields = () => {
|
47
|
+
const blockly = this.getBlockly();
|
48
|
+
const editorValue = $("#mu-custom-editor-value")[0];
|
49
|
+
if (editorValue) {
|
50
|
+
editorValue.value = blockly.workspaceXml;
|
51
|
+
}
|
52
|
+
if (typeof angular !== 'undefined'){
|
53
|
+
angular.element(editorValue).triggerHandler("change");
|
54
|
+
}
|
55
|
+
|
56
|
+
const submit = $("kids-submit-button")[0];
|
57
|
+
if (submit && submit.$.runner.isRunning) {
|
58
|
+
submit.$.runner.stop();
|
59
|
+
}
|
60
|
+
};
|
61
|
+
|
62
|
+
const initialize = () => {
|
63
|
+
setTimeout(() => {
|
64
|
+
const blockly = this.getBlockly();
|
65
|
+
|
66
|
+
if (!blockly || !blockly.workspace) return initialize();
|
67
|
+
|
68
|
+
const teacherCode = this.getTeacherCode();
|
69
|
+
if (teacherCode) {
|
70
|
+
setTimeout(() => {
|
71
|
+
const actions = new Parser().getActionsFromSource(teacherCode);
|
72
|
+
blockly.primitiveProcedures = actions.procedureDeclarations;
|
73
|
+
blockly.primitiveFunctions = actions.functionDeclarations;
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
var value = $("#mu-custom-editor-value")[0].value;
|
78
|
+
if (value) {
|
79
|
+
blockly.workspaceXml = value;
|
80
|
+
}
|
81
|
+
|
82
|
+
blockly.workspace.addChangeListener(updateFields);
|
83
|
+
updateFields();
|
84
|
+
}, 50);
|
85
|
+
};
|
86
|
+
|
87
|
+
setBlocklyColors();
|
88
|
+
initialize();
|
89
|
+
},
|
90
|
+
|
91
|
+
getBlockly: function() {
|
92
|
+
return this.$.blocklyElement;
|
93
|
+
},
|
94
|
+
|
95
|
+
getStudentCode: function() {
|
96
|
+
return this
|
97
|
+
.getBlockly()
|
98
|
+
.generateCode({ withRegions: true, clearErrors: false });
|
99
|
+
},
|
100
|
+
|
101
|
+
getStudentXml: function() {
|
102
|
+
return $("#mu-custom-editor-value")[0].value || "";
|
103
|
+
},
|
104
|
+
getTeacherCode: function() {
|
105
|
+
const teacherXml = $("#mu-custom-editor-extra")[0];
|
106
|
+
if (!teacherXml || !teacherXml.value) return;
|
107
|
+
this.$.blocklyTmp.workspaceXml = teacherXml.value;
|
108
|
+
return this.$.blocklyTmp.generateCode();
|
109
|
+
}
|
110
|
+
});
|
111
|
+
</script>
|
112
|
+
</dom-module>
|
113
|
+
|
114
|
+
<dom-module id="waiting-spinner">
|
115
|
+
<style>
|
116
|
+
.spinner {
|
117
|
+
width: 60px;
|
118
|
+
height: 60px;
|
119
|
+
}
|
120
|
+
|
121
|
+
.double-bounce1, .double-bounce2 {
|
122
|
+
width: 100%;
|
123
|
+
height: 100%;
|
124
|
+
border-radius: 50%;
|
125
|
+
background-color: #ff4081;
|
126
|
+
opacity: 0.6;
|
127
|
+
position: absolute;
|
128
|
+
top: 0;
|
129
|
+
left: 0;
|
130
|
+
|
131
|
+
-webkit-animation: sk-bounce 2.0s infinite ease-in-out;
|
132
|
+
animation: sk-bounce 2.0s infinite ease-in-out;
|
133
|
+
}
|
134
|
+
|
135
|
+
.double-bounce2 {
|
136
|
+
-webkit-animation-delay: -1.0s;
|
137
|
+
animation-delay: -1.0s;
|
138
|
+
}
|
139
|
+
|
140
|
+
@-webkit-keyframes sk-bounce {
|
141
|
+
0%, 100% { -webkit-transform: scale(0.0) }
|
142
|
+
50% { -webkit-transform: scale(1.0) }
|
143
|
+
}
|
144
|
+
|
145
|
+
@keyframes sk-bounce {
|
146
|
+
0%, 100% {
|
147
|
+
transform: scale(0.0);
|
148
|
+
-webkit-transform: scale(0.0);
|
149
|
+
} 50% {
|
150
|
+
transform: scale(1.0);
|
151
|
+
-webkit-transform: scale(1.0);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
</style>
|
155
|
+
|
156
|
+
<template>
|
157
|
+
<div class="spinner">
|
158
|
+
<div class="double-bounce1"></div>
|
159
|
+
<div class="double-bounce2"></div>
|
160
|
+
</div>
|
161
|
+
</template>
|
162
|
+
|
163
|
+
<script>
|
164
|
+
Polymer({
|
165
|
+
is: "waiting-spinner"
|
166
|
+
});
|
167
|
+
</script>
|
168
|
+
</dom-module>
|
169
|
+
|
170
|
+
<dom-module id="kids-submit-button">
|
171
|
+
<style>
|
172
|
+
.hidden { visibility: hidden; }
|
173
|
+
.visible { visibility: visible; }
|
174
|
+
.spinner {
|
175
|
+
position: absolute;
|
176
|
+
top: 0;
|
177
|
+
left: 0;
|
178
|
+
transform: translate(-2px, -2px);
|
179
|
+
}
|
180
|
+
</style>
|
181
|
+
|
182
|
+
<template>
|
183
|
+
<div style="position: relative">
|
184
|
+
<gobstones-code-runner id="runner" class$="{{_getSubmitCss(isWaiting)}}"></gobstones-code-runner>
|
185
|
+
<waiting-spinner class$="spinner {{_getSpinnerCss(isWaiting)}}"></waiting-spinner>
|
186
|
+
</div>
|
187
|
+
</template>
|
188
|
+
|
189
|
+
<script>
|
190
|
+
Polymer({
|
191
|
+
is: "kids-submit-button",
|
192
|
+
listeners: {
|
193
|
+
"gbs-run-request": "_onRunRequest",
|
194
|
+
"gbs-stop": "_onStop"
|
195
|
+
},
|
196
|
+
properties: {
|
197
|
+
serverPromise: Object,
|
198
|
+
serverResponse: Object,
|
199
|
+
isWaiting: {
|
200
|
+
type: Boolean,
|
201
|
+
value: false
|
202
|
+
}
|
203
|
+
},
|
204
|
+
|
205
|
+
ready: function() {
|
206
|
+
|
207
|
+
const setInitialState = () => {
|
208
|
+
const initialBoard = this._getTargetBoard();
|
209
|
+
if(!initialBoard.size) return setTimeout(setInitialState, 50);
|
210
|
+
|
211
|
+
this.initialState = {
|
212
|
+
size: initialBoard.size,
|
213
|
+
table: initialBoard.table,
|
214
|
+
header: initialBoard.header
|
215
|
+
};
|
216
|
+
|
217
|
+
this._resetBoardOnClose(this.initialState, initialBoard);
|
218
|
+
}
|
219
|
+
|
220
|
+
setInitialState();
|
221
|
+
},
|
222
|
+
|
223
|
+
_onRunRequest: function(event) {
|
224
|
+
const { detail: controller } = event;
|
225
|
+
|
226
|
+
const editor = this._getEditor();
|
227
|
+
const xml = editor.getStudentXml();
|
228
|
+
const code = editor.getStudentCode();
|
229
|
+
const teacherCode = editor.getTeacherCode() || "";
|
230
|
+
const finalBoard = this._getTargetBoard();
|
231
|
+
const solution = { content: xml };
|
232
|
+
|
233
|
+
this._cleanState();
|
234
|
+
this._cleanErrors(finalBoard);
|
235
|
+
|
236
|
+
const promise = new mumuki.bridge.Laboratory()
|
237
|
+
.runTests(solution)
|
238
|
+
.then((results) => {
|
239
|
+
if (promise !== this.serverPromise) return;
|
240
|
+
|
241
|
+
this._onRemoteExecutionStop(results)
|
242
|
+
});
|
243
|
+
this.serverPromise = promise;
|
244
|
+
|
245
|
+
controller.start({
|
246
|
+
initialState: this.initialState,
|
247
|
+
code: {
|
248
|
+
main: code,
|
249
|
+
library: "",
|
250
|
+
teacher: teacherCode
|
251
|
+
}
|
252
|
+
}, {
|
253
|
+
onResult: (state, fullState) => {
|
254
|
+
const region = this._getLastRegion(fullState);
|
255
|
+
if (region) this._highlight(region);
|
256
|
+
|
257
|
+
this._updateBoard(state, finalBoard);
|
258
|
+
},
|
259
|
+
onCompilationError: (error) => {
|
260
|
+
const { region } = error.on;
|
261
|
+
if (region) this._showError(region, error);
|
262
|
+
}
|
263
|
+
});
|
264
|
+
},
|
265
|
+
|
266
|
+
_onStop: function(event) {
|
267
|
+
const reason = event.detail;
|
268
|
+
|
269
|
+
if (reason === "end") this._onLocalExecutionStop();
|
270
|
+
else this.serverPromise = undefined;
|
271
|
+
},
|
272
|
+
|
273
|
+
_onLocalExecutionStop: function() {
|
274
|
+
if (!this.serverResponse) this.isWaiting = true;
|
275
|
+
else this._onExecutionStop(this.serverResponse);
|
276
|
+
},
|
277
|
+
|
278
|
+
_onRemoteExecutionStop: function(serverResponse) {
|
279
|
+
this.serverResponse = serverResponse;
|
280
|
+
|
281
|
+
if (!this.$.runner.isRunning) this._onExecutionStop(serverResponse);
|
282
|
+
},
|
283
|
+
|
284
|
+
_onExecutionStop: function(data) {
|
285
|
+
this._cleanState();
|
286
|
+
mumuki.showKidsResult(data);
|
287
|
+
},
|
288
|
+
|
289
|
+
_updateBoard: function(state, finalBoard) {
|
290
|
+
const { error, table, head } = state;
|
291
|
+
|
292
|
+
finalBoard.boom = error != null;
|
293
|
+
|
294
|
+
if (error) {
|
295
|
+
const region = this._getLastRegion(error.on);
|
296
|
+
if (region) this._showError(region, error);
|
297
|
+
} else {
|
298
|
+
finalBoard.update(table, head);
|
299
|
+
}
|
300
|
+
},
|
301
|
+
|
302
|
+
_highlight: function(region) {
|
303
|
+
this._getBlockly().highlightBlock(region);
|
304
|
+
},
|
305
|
+
|
306
|
+
_showError: function(region, error) {
|
307
|
+
this._getBlockly().showBlockError(region, error.message);
|
308
|
+
},
|
309
|
+
|
310
|
+
_cleanState: function() {
|
311
|
+
this.serverPromise = undefined;
|
312
|
+
this.serverResponse = undefined;
|
313
|
+
this.isWaiting = false;
|
314
|
+
},
|
315
|
+
|
316
|
+
_cleanErrors: function(finalBoard) {
|
317
|
+
this._getBlockly().workspace.removeBlockErrors();
|
318
|
+
finalBoard.boom = false;
|
319
|
+
},
|
320
|
+
|
321
|
+
_getLastRegion: function(context = {}) {
|
322
|
+
const { regionStack } = context;
|
323
|
+
return regionStack && regionStack.filter(it => it).slice(-1)[0];
|
324
|
+
},
|
325
|
+
|
326
|
+
_getBlockly: function() {
|
327
|
+
return this._getEditor().getBlockly();
|
328
|
+
},
|
329
|
+
|
330
|
+
_getEditor: function() {
|
331
|
+
return $("mu-gobstones-custom-editor")[0];
|
332
|
+
},
|
333
|
+
|
334
|
+
_getTargetBoard: function() {
|
335
|
+
return $(".mu-kids-gbs-board-initial gs-board")[0];
|
336
|
+
},
|
337
|
+
|
338
|
+
_getSubmitCss: function(isWaiting) {
|
339
|
+
return isWaiting ? "hidden" : "visible";
|
340
|
+
},
|
341
|
+
|
342
|
+
_getSpinnerCss: function(isWaiting) {
|
343
|
+
return isWaiting ? "visible" : "hidden";
|
344
|
+
},
|
345
|
+
|
346
|
+
_resetBoardOnClose: function(initialState, initialBoard){
|
347
|
+
const modal = mumuki.getKidsResultsModal();
|
348
|
+
|
349
|
+
modal.on("hidden.bs.modal", function () {
|
350
|
+
initialBoard.update(initialState.table, initialState.header);
|
351
|
+
initialBoard.boom = false;
|
352
|
+
});
|
353
|
+
}
|
354
|
+
});
|
355
|
+
</script>
|
356
|
+
</dom-module>
|
357
|
+
|
358
|
+
<dom-module id="gs-attire">
|
359
|
+
<script>
|
360
|
+
Polymer({
|
361
|
+
is: 'gs-attire',
|
362
|
+
properties: {
|
363
|
+
attireUrl: Object,
|
364
|
+
observer: '_attireChanged'
|
365
|
+
},
|
366
|
+
|
367
|
+
attached: function() {
|
368
|
+
this._setAttire();
|
369
|
+
},
|
370
|
+
_attireChanged: function() {
|
371
|
+
this._setAttire();
|
372
|
+
},
|
373
|
+
_setAttire: function() {
|
374
|
+
$.getJSON(this.attireUrl, function(attire) {
|
375
|
+
GobstonesBoard && GobstonesBoard.setDefaultAttire(attire);
|
376
|
+
});
|
377
|
+
}
|
378
|
+
});
|
379
|
+
</script>
|
380
|
+
</dom-module>
|
381
|
+
|
382
|
+
<dom-module id="gs-toolbox">
|
383
|
+
<script>
|
384
|
+
Polymer({
|
385
|
+
is: 'gs-toolbox',
|
386
|
+
properties: {
|
387
|
+
toolboxUrl: Object,
|
388
|
+
observer: '_toolboxChanged'
|
389
|
+
},
|
390
|
+
|
391
|
+
attached: function() {
|
392
|
+
this._setToolbox();
|
393
|
+
},
|
394
|
+
_toolboxChanged: function() {
|
395
|
+
this._setToolbox();
|
396
|
+
},
|
397
|
+
_setToolbox: function() {
|
398
|
+
$.get(this.toolboxUrl, function(toolboxXml) {
|
399
|
+
const blockly = $("mu-gobstones-custom-editor")[0].getBlockly();
|
400
|
+
blockly.setDefaultToolbox(toolboxXml);
|
401
|
+
});
|
402
|
+
}
|
403
|
+
});
|
404
|
+
</script>
|
405
|
+
</dom-module>
|
data/lib/render/editor/editor.js
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
$(document).ready(()
|
2
|
-
$("
|
1
|
+
$(document).ready(function () {
|
2
|
+
$(".mu-kids-submit-button").html("<kids-submit-button></kids-submit-button>");
|
3
3
|
|
4
|
-
|
4
|
+
Blockly.WorkspaceAudio.prototype.preload = function () {
|
5
|
+
for (var soundName in this.SOUNDS_) {
|
6
|
+
var sound = this.SOUNDS_[soundName];
|
7
|
+
sound.volume = 0.01;
|
8
|
+
var playPromise = sound.play();
|
9
|
+
playPromise && playPromise.then(sound.pause.bind(sound));
|
10
|
+
if (goog.userAgent.IPAD || goog.userAgent.IPHONE) break;
|
11
|
+
}
|
12
|
+
};
|
5
13
|
|
6
|
-
blockly.workspace.addChangeListener(() => {
|
7
|
-
$("#custom-editor-value")[0].value = blockly.generateCode();
|
8
|
-
});
|
9
14
|
});
|
data/lib/render/html_renderer.rb
CHANGED
@@ -4,7 +4,6 @@ module Gobstones
|
|
4
4
|
class HtmlRenderer
|
5
5
|
def initialize(options)
|
6
6
|
@options = options
|
7
|
-
@boom_image = encode_image_png 'boom'
|
8
7
|
end
|
9
8
|
|
10
9
|
def render_success(result)
|
@@ -80,11 +79,6 @@ module Gobstones
|
|
80
79
|
end
|
81
80
|
end
|
82
81
|
|
83
|
-
def encode_image_png(file_name)
|
84
|
-
base64 = Base64.strict_encode64 File.read(Gobstones::Board.assets_path_for("htmls/components/#{file_name}.png"))
|
85
|
-
"data:image/png;base64,#{base64}"
|
86
|
-
end
|
87
|
-
|
88
82
|
def bind_result(result)
|
89
83
|
@result = { boards: [] }.merge result
|
90
84
|
template_file.result binding
|
data/lib/version_hook.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-gobstones-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Alfonso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.21'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.21'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sinatra-cross_origin
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.14'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: gobstones-blockly
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.10'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gobstones-code-runner
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,7 +157,6 @@ executables: []
|
|
143
157
|
extensions: []
|
144
158
|
extra_rdoc_files: []
|
145
159
|
files:
|
146
|
-
- lib/assets/boom.png
|
147
160
|
- lib/assets_server.rb
|
148
161
|
- lib/checker.rb
|
149
162
|
- lib/expectations_hook.rb
|
@@ -160,8 +173,10 @@ files:
|
|
160
173
|
- lib/metadata_hook.rb
|
161
174
|
- lib/multiple_executions_runner.rb
|
162
175
|
- lib/precompile_hook.rb
|
176
|
+
- lib/public/boom.png
|
163
177
|
- lib/render/boards.html.erb
|
164
178
|
- lib/render/editor/editor.css
|
179
|
+
- lib/render/editor/editor.html
|
165
180
|
- lib/render/editor/editor.js
|
166
181
|
- lib/render/html_board.rb
|
167
182
|
- lib/render/html_renderer.rb
|