File tree Expand file tree Collapse file tree 4 files changed +298
-144
lines changed
Expand file tree Collapse file tree 4 files changed +298
-144
lines changed Original file line number Diff line number Diff line change 202202 </v-tabs-items >
203203 </v-content >
204204 </v-app >
205+ <v-snackbar v-model =" snackbar" >
206+ {{ snackbarText }}
207+ </v-snackbar >
205208 </div >
206209</template >
207210<script >
@@ -256,6 +259,9 @@ export default {
256259 },
257260 data () {
258261 return {
262+ CB : process .env .CB_ENDPOINT + process .env .APIv2 ,
263+ snackbar: false ,
264+ snackbarText: " " ,
259265 activity: {
260266 name: null ,
261267 drawerEnabled: true ,
@@ -334,6 +340,20 @@ export default {
334340 methods: {
335341 save : function () {
336342 console .log (JSON .stringify (this .activity ))
343+ if (this .activity .name ) {
344+ let axios = this .$axios
345+ let CB = this .CB
346+ axios .post (CB + ' /saveActivity' , {
347+ activity: this .activity
348+ })
349+ .then (function (data ) {
350+ this .snackbarText = " Attività salvata" ;
351+ this .snackbar = true ;
352+ }.bind (this ))
353+ } else {
354+ this .snackbarText = " Salvataggio non riuscito: inserisci un nome all'attività!" ;
355+ this .snackbar = true ;
356+ }
337357 },
338358 toggleSidebar : function () {
339359 let currentStatus = this .$store .getters .drawerStatus
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ <v-app id =" inspire" >
4+ <sidebar ></sidebar >
5+ <v-toolbar color =" indigo" dark fixed app >
6+ <v-toolbar-side-icon @click.stop =" toggleSidebar()" ></v-toolbar-side-icon >
7+ <v-toolbar-title >CoderBot</v-toolbar-title >
8+ </v-toolbar >
9+ <v-content >
10+ <v-list >
11+ <span v-if =" activityList == null" >
12+ Nessuna Attività, perchè non ne <a href =" #/activity/new" >crei</a > una nuova?
13+ </span >
14+ <v-list-tile v-for =" activity in activityList" :key =" activity.el" avatar @click =" " >
15+ <v-list-tile-title ripple @click =" loadProgram(activity.name)" >
16+ {{ activity.name }}
17+ </v-list-tile-title >
18+ <v-btn flat icon color =" grey darken-1" ripple @click =" deleteActivityDlg(activity.name)" >
19+ <v-icon >delete</v-icon >
20+ </v-btn >
21+ </v-list-tile >
22+ </v-list >
23+ </v-content >
24+ </v-app >
25+ </div >
26+ </template >
27+ <script >
28+ import sidebar from " ../components/Sidebar"
29+
30+ export default {
31+ components: { sidebar },
32+ name: ' CoderBot' ,
33+ mounted () {
34+ let axios = this .$axios
35+ let CB = this .$data .CB
36+ // let programList = this.$data.programList
37+ axios .get (CB + ' /listActivities' )
38+ .then (function (response ) {
39+ this .$data .activityList = response .data ;
40+ }.bind (this ))
41+ },
42+ methods: {
43+ toggleSidebar : function () {
44+ let currentStatus = this .$store .getters .drawerStatus
45+ this .$store .commit (' toggleDrawer' , ! currentStatus)
46+ }
47+ },
48+ data () {
49+ return {
50+ CB : process .env .CB_ENDPOINT + process .env .APIv2 ,
51+ activityList: null ,
52+ drawer: null ,
53+ source: null ,
54+ };
55+ },
56+ };
57+
58+ </script >
59+ <!-- Add "scoped" attribute to limit CSS to this component only -->
60+ <style scoped>
61+ </style >
You can’t perform that action at this time.
0 commit comments