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