Skip to content

Commit f125870

Browse files
committed
fix numBlocks, blockly media
1 parent cfac537 commit f125870

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/components/Activity.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{ activity.name }}
1111
</v-app-bar-title>
1212
<v-spacer></v-spacer>
13-
<v-chip class="ma-2" v-if="activity.maxBlocks > 0" label>{{ $t("message.activity_program_remaining_blocks") }}: {{ workspace.remainingCapacity() }}</v-chip>
13+
<v-chip class="ma-2" v-if="activity.maxBlocks > 0" label>{{ $t("message.activity_program_remaining_blocks") }}: {{ remainingCapacity }}</v-chip>
1414
<!-- If the API is available, show the desired buttons -->
1515
<template v-if="status == 200">
1616
<template v-for="button in activity.buttons">
@@ -366,6 +366,9 @@ export default {
366366
}
367367
return this.$i18n.t('message.coderbot_status_offline');
368368
},
369+
remainingCapacity() {
370+
return this.$refs.workspace.remainingCapacity();
371+
}
369372
},
370373
mounted() {
371374
this.loadMusicPackages();
@@ -452,6 +455,7 @@ export default {
452455
}).then((response) => {
453456
console.log('Activity loaded', response.data);
454457
this.activity = response.data;
458+
this.settings.activity = response.data;
455459
this.updateCssProps();
456460
457461
let toolboxJSON = null;

src/components/BlocklyWorkspace.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ export default {
9292
// Options
9393
{
9494
toolbox: this.toolbox,
95-
// path: 'static/js/blockly/',
95+
media: 'media/',
9696
// TODO: Use values from fetched configuration!
9797
scrollbars: true,
98-
maxBlocks: null, // this.activity.maxBlocks,
98+
maxBlocks: settings.activity.maxBlocks,
9999
zoom: {
100100
controls: true,
101101
wheel: false,
@@ -220,6 +220,14 @@ export default {
220220
221221
clear() {
222222
this.workspace.clear();
223+
},
224+
225+
remainingCapacity() {
226+
let capacity = null;
227+
if (this.workspace) {
228+
capacity = this.workspace.remainingCapacity();
229+
}
230+
return capacity;
223231
}
224232
},
225233
};

0 commit comments

Comments
 (0)