donal
2018-04-16 78a403c450425ea86fad7df5737a4a53ed4c6714
commit | author | age
a34f1d 1 <template>
D 2   <div>
fbee7b 3     <div class="itemCardAndFlag">
78a403 4       <md-list-item
D 5         @click="markCompleted()"
b4180d 6         >
78a403 7         <checkbox v-model="todoItem.completed" class="checkbox-completed"/> 
D 8
9         <span class="md-list-item-text" :class="{'strike-through': todoItem.completed}">{{ todoItem.title }}</span>
10       </md-list-item>
11       <!-- TODO - SVG for use in Lab3 -->
12       <!-- <svg :class="{'red-flag': todoItem.important}"  height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" ><path d="M0 0h24v24H0z" fill="none"/><path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/></svg> -->
fbee7b 13     </div>
a34f1d 14   </div>
D 15 </template>
16 <script>
8acdfc 17 import Vue from "vue";
1f415e 18 import { Checkbox, Radio } from "vue-checkbox-radio";
A 19 Vue.component("checkbox", Checkbox);
20 Vue.component("radio", Radio);
8acdfc 21
a34f1d 22 export default {
D 23   name: "TodoItem",
24   props: {
25     // type any object ;)
26     todoItem: {}
27   },
28   methods: {
ba91cd 29     markCompleted() {
6191f0 30       this.$store.dispatch("updateTodo", {id :this.todoItem._id});
9e628c 31       console.info("INFO - Mark todo as completed ", this.todoItem.completed);
b4180d 32     },
A 33     markImportant() {
ba91cd 34       // TODO - FILL THIS OUT IN THE LAB EXERCISE
a34f1d 35     }
D 36   }
37 };
38 </script>
39
40 <!-- Add "scoped" attribute to limit CSS to this component only -->
41 <style scoped lang="scss">
637b4a 42 .md-list-item {
acdeac 43   width: 320px;
A 44   max-width: 100%;
637b4a 45   height: 50px;
acdeac 46   display: inline-block;
A 47   overflow: auto;
991fff 48 }
A 49
8acdfc 50 .md-list-item-text {
A 51   padding-left: 0.5em;
637b4a 52 }
A 53
54 .itemCardandFlag {
55   display: inline-block;
8acdfc 56 }
A 57
a34f1d 58 .strike-through {
D 59   text-decoration: line-through;
b4180d 60   font-style: italic;
A 61 }
62
8a2c1e 63 .important-flag {
637b4a 64   height: 50px;
A 65   margin: 0px;
66 }
b4180d 67 .red-flag {
A 68   fill: #cc0000;
a34f1d 69 }
D 70 </style>