Skip to content

Commit b674c89

Browse files
committed
Avoid wrapping in template when not necessary, comments
1 parent 1e20a49 commit b674c89

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

src/components/Activity.vue

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<template>
2+
<!-- Use computed CSS rules -->
23
<div :style="cssProps">
34
<v-app id="inspire">
5+
<!-- the mobile draw animation doesn't play well with how Blockly is draw -->
46
<sidebar mobileDrawAnim=0></sidebar>
57
<v-toolbar color="indigo" dark fixed app>
6-
<template v-if="activity.drawerEnabled">
7-
<v-toolbar-side-icon @click.stop="toggleSidebar()"></v-toolbar-side-icon>
8-
</template>
9-
<template v-if="activity.showName">
10-
<v-toolbar-title>
8+
<v-toolbar-side-icon @click.stop="toggleSidebar()" v-if="activity.drawerEnabled"></v-toolbar-side-icon>
9+
<v-toolbar-title v-if="activity.showName">
1110
{{ activity.name }}
1211
</v-toolbar-title>
13-
</template>
1412
<v-spacer></v-spacer>
1513
<v-toolbar-items>
14+
<!-- If the API is available, show the desired buttons -->
1615
<template v-if="status == 200">
1716
<template v-for="button, i in activity.buttons">
1817
<v-btn @click="_self[button.action]()" style="height: 70%" :color="button.colorBtn" :class="button.colorText">
@@ -22,17 +21,15 @@
2221
&nbsp;&nbsp;
2322
</template>
2423
</template>
25-
<!--
26-
<v-btn @click="dialog = true" icon v-if="status == 200">
27-
<v-icon>check_circle</v-icon>
28-
</v-btn>
29-
-->
24+
<!-- If the API is not responding, show an error icon -->
3025
<v-btn @click="dialog = true" icon v-if="status != 200">
3126
<v-icon>error</v-icon>
3227
</v-btn>
3328
</v-toolbar-items>
3429
</v-toolbar>
30+
<!-- Page content -->
3531
<v-content>
32+
<!-- Blockly -->
3633
<div style="height: 480px; width: 600px;">
3734
<div ref="blocklyTotal" style="height: 100%; width: 100%;" class="blocklyTotal">
3835
<div ref="blocklyArea" style="height: 100%; width: 100%;" class="blocklyArea">
@@ -42,7 +39,11 @@
4239
</div>
4340
</div>
4441
</v-content>
45-
<!-- Runtime modal -->
42+
<!-- Hidden file input. Its file dialog it's event-click triggered by the "pickFile" method -->
43+
<input type="file" style="display: none" ref="file" @change="importProgram">
44+
<!-- When the selection is completed, the result is then handled by importProgram -->
45+
<!-- Dialogs -->
46+
<!-- Runtime -->
4647
<v-dialog v-model="runtimeDialog" width="500">
4748
<v-card>
4849
<v-card-title class="headline grey lighten-2" primary-title>
@@ -65,10 +66,7 @@
6566
</v-card-actions>
6667
</v-card>
6768
</v-dialog>
68-
<!-- Hidden file input. Its file dialog it's event-click triggered by the "pickFile" method -->
69-
<input type="file" style="display: none" ref="file" @change="importProgram">
70-
<!-- When the selection is completed, the result is then handled by importProgram -->
71-
<!-- Dialogs -->
69+
<!-- Load Program -->
7270
<v-dialog v-model="carica" max-width="290">
7371
<v-card>
7472
<v-card-title class="headline">
@@ -92,7 +90,7 @@
9290
</v-card-actions>
9391
</v-card>
9492
</v-dialog>
95-
<!-- -->
93+
<!-- Save Program -->
9694
<v-dialog v-model="salva" max-width="430">
9795
<v-card>
9896
<v-card-title class="headline">
@@ -112,12 +110,12 @@
112110
</v-card-actions>
113111
</v-card>
114112
</v-dialog>
115-
<!-- -->
113+
<!-- Name error -->
116114
<v-dialog v-model="unvalidName" max-width="290">
117115
<v-card>
118-
<v-card-title class="headline">ERRORE</v-card-title>
116+
<v-card-title class="headline">Error</v-card-title>
119117
<v-card-text>
120-
Il nome del programma non deve essere vuoto
118+
Il nome del programma non può essere vuoto.
121119
</v-card-text>
122120
<v-card-actions>
123121
<v-btn color="green darken-1" flat="flat" @click="unvalidName = false, salva = true">
@@ -126,10 +124,10 @@
126124
</v-card-actions>
127125
</v-card>
128126
</v-dialog>
129-
<!-- -->
127+
<!-- Overwrite error -->
130128
<v-dialog v-model="CannotOverwrite" max-width="290">
131129
<v-card>
132-
<v-card-title class="headline">ERRORE</v-card-title>
130+
<v-card-title class="headline">Error</v-card-title>
133131
<v-card-text>
134132
Impossibile sovrascrivere un programma di default, cambiare il nome.
135133
</v-card-text>
@@ -140,7 +138,7 @@
140138
</v-card-actions>
141139
</v-card>
142140
</v-dialog>
143-
<!-- -->
141+
<!-- Ask for overwrite -->
144142
<v-dialog v-model="overwriteDialog" max-width="500">
145143
<v-card>
146144
<v-card-title class="headline">
@@ -159,7 +157,7 @@
159157
</v-card-actions>
160158
</v-card>
161159
</v-dialog>
162-
<!-- -->
160+
<!-- Delete Program -->
163161
<v-dialog v-model="del" max-width="500">
164162
<v-card>
165163
<v-card-title class="headline">
@@ -178,7 +176,7 @@
178176
</v-card-actions>
179177
</v-card>
180178
</v-dialog>
181-
<!-- -->
179+
<!-- Show Code -->
182180
<v-dialog v-model="dialogCode">
183181
<v-card>
184182
<v-card-title class="headline">Codice</v-card-title>
@@ -194,7 +192,7 @@
194192
</v-card-actions>
195193
</v-card>
196194
</v-dialog>
197-
<!-- -->
195+
<!-- Status -->
198196
<v-dialog v-model="dialog" max-width="290">
199197
<v-card>
200198
<v-card-title class="headline">Stato del Coderbot</v-card-title>
@@ -209,7 +207,7 @@
209207
</v-card-actions>
210208
</v-card>
211209
</v-dialog>
212-
<!-- -->
210+
<!-- Generic dialog -->
213211
<v-dialog v-model="generalDialog" max-width="290">
214212
<v-card>
215213
<v-card-title class="headline">{{ generalDialogTitle }}</v-card-title>
@@ -366,7 +364,7 @@ export default {
366364
console.log("Computed CSS props:", this.cssProps)
367365
},
368366
369-
initBlockly(settings){
367+
initBlockly(settings) {
370368
// Extend the default blocks set
371369
this.blocksExtensions(settings);
372370
@@ -385,7 +383,7 @@ export default {
385383
// Options
386384
{
387385
toolbox: serializedToolbox,
388-
path : 'static/js/blockly/',
386+
path: 'static/js/blockly/',
389387
// TODO: Use values from fetched configuration!
390388
scrollbars: true,
391389
//MaxBlocks : -1, // -1 as infinite not working FIXME

0 commit comments

Comments
 (0)