From 78a403c450425ea86fad7df5737a4a53ed4c6714 Mon Sep 17 00:00:00 2001
From: donal <donalspring@gmail.com>
Date: Mon, 16 Apr 2018 12:57:45 +0200
Subject: [PATCH] Template for TDD

---
 src/components/TodoItem.vue |   53 +++++++++++++++++++----------------------------------
 1 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/src/components/TodoItem.vue b/src/components/TodoItem.vue
index 4521b9e..6287bee 100644
--- a/src/components/TodoItem.vue
+++ b/src/components/TodoItem.vue
@@ -1,28 +1,15 @@
 <template>
   <div>
     <div class="itemCardAndFlag">
-
-    <md-list-item
-      @click="markCompleted"
-      >
-      <!-- TODO find a nice way of not calling markdone when clicking flag on card rather than calling "markDone" twice -->
-      
-      <!-- Material design checkbox not displaying, EDIT: Still can't figure out why it's not displaying -->
-      <!-- <md-checkbox :v-model="isActive">x</md-checkbox> -->
-      <!-- <input type="checkbox" v-model="todoItem.complete"/> -->
-      <checkbox v-model="todoItem.completed"/> 
-
-      <span class="md-list-item-text" :class="{'strike-through': todoItem.completed}">{{ todoItem.title }}</span>
-      <!-- find a nice way to utilise svg fill property without doing it inline -->
-      <md-button 
-        @click="markImportant"
+      <md-list-item
+        @click="markCompleted()"
         >
-        <svg :class="{'red-flag': todoItem.important}" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" @click="markCompleted">
-          <path d="M0 0h24v24H0z" fill="none"/>
-          <path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/>
-        </svg>
-      </md-button>
-    </md-list-item>
+        <checkbox v-model="todoItem.completed" class="checkbox-completed"/> 
+
+        <span class="md-list-item-text" :class="{'strike-through': todoItem.completed}">{{ todoItem.title }}</span>
+      </md-list-item>
+      <!-- TODO - SVG for use in Lab3 -->
+      <!-- <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> -->
     </div>
   </div>
 </template>
@@ -38,21 +25,13 @@
     // type any object ;)
     todoItem: {}
   },
-  data() {
-    return {
-      // isActive: false,
-      // isImportant: false
-    };
-  },
   methods: {
     markCompleted() {
-      this.$store.dispatch("markTodoCompleted", this.todoItem._id);
+      this.$store.dispatch("updateTodo", {id :this.todoItem._id});
       console.info("INFO - Mark todo as completed ", this.todoItem.completed);
     },
     markImportant() {
-      console.info("INFO - Mark todo as important ", this.todoItem.important);
       // TODO - FILL THIS OUT IN THE LAB EXERCISE
-
     }
   }
 };
@@ -60,18 +39,20 @@
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style scoped lang="scss">
-.md-list {
+.md-list-item {
   width: 320px;
   max-width: 100%;
-  height: 400px;
+  height: 50px;
   display: inline-block;
   overflow: auto;
-  border: 1px solid rgba(#000, 0.12);
-  vertical-align: top;
 }
 
 .md-list-item-text {
   padding-left: 0.5em;
+}
+
+.itemCardandFlag {
+  display: inline-block;
 }
 
 .strike-through {
@@ -79,6 +60,10 @@
   font-style: italic;
 }
 
+.important-flag {
+  height: 50px;
+  margin: 0px;
+}
 .red-flag {
   fill: #cc0000;
 }

--
Gitblit v1.9.3