From fb532f25a30353e1d3ee36d967b6bde4cfaafc87 Mon Sep 17 00:00:00 2001 From: nicolas Date: Sun, 13 Sep 2015 02:10:57 -0400 Subject: [PATCH 01/11] Added edit button and appropriate functionality --- todo-src/index.html | 19 +++++++++++++++---- todo-src/script.js | 6 ++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 89203ad..ea0fa19 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -31,10 +31,21 @@

stuff i gotta do asap

  • {{do}} - - + +
    + + +
    + +
    + + + +
  • diff --git a/todo-src/script.js b/todo-src/script.js index fe21743..2cd90f6 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -21,6 +21,12 @@ myApp.controller('MainCtrl', function ($scope){ } + $scope.editItem = function(item, uInput){ + console.log("in edit"); + var index = $scope.todos.indexOf(item); + $scope.todos[index] = uInput; + } + }); /************************* From bbfdf235e6ee8340a2a0f54b40c4de5497ef8007 Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Mon, 14 Sep 2015 13:09:57 -0400 Subject: [PATCH 02/11] Adds ability to select priority --- todo-src/index.html | 125 +++++++++++++++++++++++----------------- todo-src/script.js | 135 ++++++++++++++++++++++++++++++-------------- todo-src/style.css | 23 ++++++-- 3 files changed, 186 insertions(+), 97 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index ea0fa19..b878ab0 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -1,55 +1,76 @@ - - + + - - - - - - - - -

    My little to do app!

    - -
    - -
    - - - - -
    - -

    stuff i gotta do asap

    - -
      - -
    • - - {{do}} - -
      - - -
      - -
      - - - -
      -
    • -
    -
    - - + + + + + + + + - + +

    My little to do app!

    +
    +
    + + +
    + + +
    +
    +
    +

    stuff i gotta do asap

    +
      + +
    • + {{do}} + + + +
    • + +
    • + {{do}} + + + +
    • + +
    • + {{do}} + + + +
    • +
    +
    + + diff --git a/todo-src/script.js b/todo-src/script.js index 2cd90f6..391f609 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -1,42 +1,95 @@ -// Code goes here - -var myApp = angular.module('app', []); - -myApp.controller('MainCtrl', function ($scope){ - $scope.todos = ["Learn Angular", "Learn node"]; - $scope.newItem = ""; - - $scope.addItem = function(){ - console.log("in add"); - if ($scope.newItem !== ""){ - $scope.todos.push($scope.newItem); - $scope.newItem = ""; - } - } +// Code goes here + + +var myApp = angular.module('app', []); + + +myApp.controller('MainCtrl', function ($scope){ + $scope.high = []; + $scope.medium = []; + $scope.low = []; + $scope.newItem = ""; - $scope.deleteItem = function(item){ - console.log("in delete"); - var index = $scope.todos.indexOf(item); - $scope.todos.splice(index, 1); - } - - - $scope.editItem = function(item, uInput){ - console.log("in edit"); - var index = $scope.todos.indexOf(item); - $scope.todos[index] = uInput; - } - -}); - -/************************* - * Homework (not rly): - * - "enter" button functionality instead of clicking button - * - edit button functionality - * - button to mark item as "complete" - * - have a total number of items at the top - * - make it prettier - * - add a due date - * - add reminder (setInterval) - * - * *********************/ \ No newline at end of file + $scope.highaddItem = function(){ + console.log("high add"); + if ($scope.newItem !== ""){ + $scope.high.push($scope.newItem); + $scope.newItem = ""; + } + } + + + $scope.highcheckItem = function(item){ + console.log("high check"); + var index = $scope.high.indexOf(item); + //need implementation + } + + + $scope.highdeleteItem = function(item){ + console.log("high delete"); + var index = $scope.high.indexOf(item); + $scope.high.splice(index, 1); + } + + + $scope.medaddItem = function(){ + console.log("med add"); + if ($scope.newItem !== ""){ + $scope.medium.push($scope.newItem); + $scope.newItem = ""; + } + } + + + $scope.medcheckItem = function(item){ + console.log("medium check"); + var index = $scope.medium.indexOf(item); + //need implementation + } + + + $scope.meddeleteItem = function(item){ + console.log("med delete"); + var index = $scope.medium.indexOf(item); + $scope.medium.splice(index, 1); + } + + + $scope.lowaddItem = function(){ + console.log("low add"); + if ($scope.newItem !== ""){ + $scope.low.push($scope.newItem); + $scope.newItem = ""; + } + } + + + $scope.highcheckItem = function(item){ + console.log("low check"); + var index = $scope.low.indexOf(item); + //Need implementation + } + + + $scope.lowdeleteItem = function(item){ + console.log("low delete"); + var index = $scope.low.indexOf(item); + $scope.low.splice(index, 1); + } + + +}); + + + /************************* + * Homework (not rly): + * - "enter" button functionality instead of clicking button + * - edit button functionality + * - button to mark item as "complete" + * - have a total number of items at the top + * - make it prettier + * - add a due date + * - add reminder (setInterval) + * + * *********************/ diff --git a/todo-src/style.css b/todo-src/style.css index eb51b03..16dae78 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -1,4 +1,19 @@ -/* Styles go here */ -body { - background: green; -} +/* Styles go here */ +body { + background: green; +} + + +#highpriority { + color: red; +} + + +#medpriority { + color: orange; +} + + +#lowpriority { + color: black; +} From 0f834c916d2fd7631152ad70441d134f0a25078c Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Mon, 14 Sep 2015 13:45:02 -0400 Subject: [PATCH 03/11] Priority task altered to have a single submit button and seperate priority selection --- todo-src/index.html | 22 ++++++++++------------ todo-src/script.js | 28 ++++++---------------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index b878ab0..30b2c46 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -15,18 +15,16 @@

    My little to do app!

    - - -
    - - -
    + + + +

    stuff i gotta do asap

    diff --git a/todo-src/script.js b/todo-src/script.js index 391f609..6f02c5a 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -10,10 +10,12 @@ myApp.controller('MainCtrl', function ($scope){ $scope.low = []; $scope.newItem = ""; - $scope.highaddItem = function(){ - console.log("high add"); - if ($scope.newItem !== ""){ - $scope.high.push($scope.newItem); + $scope.addItem = function(){ + console.log("add"); + if ($scope.newItem !== ""){ + if ($scope.priority == "high") {$scope.high.push($scope.newItem);} + if ($scope.priority == "med") {$scope.medium.push($scope.newItem);} + if ($scope.priority == "low") {$scope.low.push($scope.newItem);} $scope.newItem = ""; } } @@ -33,15 +35,6 @@ myApp.controller('MainCtrl', function ($scope){ } - $scope.medaddItem = function(){ - console.log("med add"); - if ($scope.newItem !== ""){ - $scope.medium.push($scope.newItem); - $scope.newItem = ""; - } - } - - $scope.medcheckItem = function(item){ console.log("medium check"); var index = $scope.medium.indexOf(item); @@ -56,15 +49,6 @@ myApp.controller('MainCtrl', function ($scope){ } - $scope.lowaddItem = function(){ - console.log("low add"); - if ($scope.newItem !== ""){ - $scope.low.push($scope.newItem); - $scope.newItem = ""; - } - } - - $scope.highcheckItem = function(item){ console.log("low check"); var index = $scope.low.indexOf(item); From 7fc5c28ad48f11fd5d8dac53c6310f44586b5fba Mon Sep 17 00:00:00 2001 From: KevinKrames Date: Mon, 14 Sep 2015 16:21:33 -0400 Subject: [PATCH 04/11] Add complete button, reconstructed how we store the data so that each todo item has several variables. Cleaned up how the buttons look on the right side of the todo item. --- todo-src/index.html | 19 ++++++++++++++----- todo-src/script.js | 19 +++++++++++++++---- todo-src/style.css | 2 +- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 89203ad..1ce0c8d 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -28,12 +28,21 @@

    stuff i gotta do asap

      -
    • +
    • - {{do}} - + {{do.name}} + + + + + + + + + +
    diff --git a/todo-src/script.js b/todo-src/script.js index fe21743..cd12946 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -3,22 +3,33 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ - $scope.todos = ["Learn Angular", "Learn node"]; + $scope.todos = [{name: "Learn Angular", done:false}, {name: "Learn node", done:false}]; $scope.newItem = ""; $scope.addItem = function(){ console.log("in add"); if ($scope.newItem !== ""){ - $scope.todos.push($scope.newItem); + var addItem = {name:$scope.newItem, done:false}; + $scope.todos.push(addItem); $scope.newItem = ""; + } } - $scope.deleteItem = function(item){ + $scope.deleteItem = function(index){ console.log("in delete"); - var index = $scope.todos.indexOf(item); $scope.todos.splice(index, 1); } + + $scope.completeItem = function(index){ + console.log("completed item"); + $scope.todos[index].done = true; + } + + $scope.uncompleteItem = function(index) { + console.log("uncompleted item"); + $scope.todos[index].done = false; + } }); diff --git a/todo-src/style.css b/todo-src/style.css index eb51b03..0458267 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -1,4 +1,4 @@ /* Styles go here */ body { background: green; -} +} \ No newline at end of file From 74f0a49f31d30d0ea1e6732274baba91e3d72bda Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Mon, 14 Sep 2015 19:58:17 -0400 Subject: [PATCH 05/11] work in progress --- todo-src/index.html | 39 +++--------------------------- todo-src/script.js | 58 +++++++-------------------------------------- todo-src/style.css | 23 ++++++++---------- 3 files changed, 21 insertions(+), 99 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 30b2c46..73118ae 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -29,44 +29,11 @@

    My little to do app!

    stuff i gotta do asap

      - -
    • - {{do}} - - - -
    • - -
    • - {{do}} - - - -
    • - -
    • - {{do}} - - -
    diff --git a/todo-src/script.js b/todo-src/script.js index 6f02c5a..c6a2215 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -5,63 +5,21 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ - $scope.high = []; - $scope.medium = []; - $scope.low = []; + $scope.todos = []; $scope.newItem = ""; $scope.addItem = function(){ console.log("add"); if ($scope.newItem !== ""){ - if ($scope.priority == "high") {$scope.high.push($scope.newItem);} - if ($scope.priority == "med") {$scope.medium.push($scope.newItem);} - if ($scope.priority == "low") {$scope.low.push($scope.newItem);} - $scope.newItem = ""; - } - } - - - $scope.highcheckItem = function(item){ - console.log("high check"); - var index = $scope.high.indexOf(item); - //need implementation - } - - - $scope.highdeleteItem = function(item){ - console.log("high delete"); - var index = $scope.high.indexOf(item); - $scope.high.splice(index, 1); - } - - - $scope.medcheckItem = function(item){ - console.log("medium check"); - var index = $scope.medium.indexOf(item); - //need implementation - } - - - $scope.meddeleteItem = function(item){ - console.log("med delete"); - var index = $scope.medium.indexOf(item); - $scope.medium.splice(index, 1); - } - - - $scope.highcheckItem = function(item){ - console.log("low check"); - var index = $scope.low.indexOf(item); - //Need implementation - } - - - $scope.lowdeleteItem = function(item){ - console.log("low delete"); - var index = $scope.low.indexOf(item); - $scope.low.splice(index, 1); + $scope.todos.push($scope.newItem);} + $scope.newItem = ""; } + $scope.deleteItem = function(item){ + console.log("delete"); + var index = $scope.todos.indexOf(item); + $scope.todos.splice(index, 1); + } }); diff --git a/todo-src/style.css b/todo-src/style.css index 16dae78..af9696e 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -3,17 +3,14 @@ body { background: green; } - -#highpriority { - color: red; -} +.high { + color: red; +} - -#medpriority { - color: orange; -} - - -#lowpriority { - color: black; -} +.med { + color: orange; +} + +.low { + color: black; +} \ No newline at end of file From c713cb41d82756a8d82eaf88fe4c7ab042e6c0d5 Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Mon, 14 Sep 2015 20:03:15 -0400 Subject: [PATCH 06/11] Revert "work in progress" This reverts commit 74f0a49f31d30d0ea1e6732274baba91e3d72bda. Conflicts: todo-src/style.css --- todo-src/index.html | 39 +++++++++++++++++++++++++++--- todo-src/script.js | 58 ++++++++++++++++++++++++++++++++++++++------- todo-src/style.css | 25 ++++++++++++------- 3 files changed, 103 insertions(+), 19 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 7ef7fe8..7e55423 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -66,11 +66,44 @@

    My little to do app!

    stuff i gotta do asap

      -
    • - {{do}} - + + +
    • + +
    • + {{do}} + + + +
    • + +
    • + {{do}} + + +
    diff --git a/todo-src/script.js b/todo-src/script.js index b2ed5a0..a12d5ea 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -6,21 +6,63 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ - $scope.todos = []; + $scope.high = []; + $scope.medium = []; + $scope.low = []; $scope.newItem = ""; $scope.addItem = function(){ console.log("add"); if ($scope.newItem !== ""){ - $scope.todos.push($scope.newItem);} - $scope.newItem = ""; + if ($scope.priority == "high") {$scope.high.push($scope.newItem);} + if ($scope.priority == "med") {$scope.medium.push($scope.newItem);} + if ($scope.priority == "low") {$scope.low.push($scope.newItem);} + $scope.newItem = ""; + } + } + + + $scope.highcheckItem = function(item){ + console.log("high check"); + var index = $scope.high.indexOf(item); + //need implementation + } + + + $scope.highdeleteItem = function(item){ + console.log("high delete"); + var index = $scope.high.indexOf(item); + $scope.high.splice(index, 1); + } + + + $scope.medcheckItem = function(item){ + console.log("medium check"); + var index = $scope.medium.indexOf(item); + //need implementation + } + + + $scope.meddeleteItem = function(item){ + console.log("med delete"); + var index = $scope.medium.indexOf(item); + $scope.medium.splice(index, 1); + } + + + $scope.highcheckItem = function(item){ + console.log("low check"); + var index = $scope.low.indexOf(item); + //Need implementation + } + + + $scope.lowdeleteItem = function(item){ + console.log("low delete"); + var index = $scope.low.indexOf(item); + $scope.low.splice(index, 1); } - $scope.deleteItem = function(item){ - console.log("delete"); - var index = $scope.todos.indexOf(item); - $scope.todos.splice(index, 1); - } }); diff --git a/todo-src/style.css b/todo-src/style.css index 7f34a39..62149c9 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -4,14 +4,12 @@ body { background: green; } -.high { - color: red; -} - -.med { - color: orange; -} + +#highpriority { + color: red; +} +<<<<<<< HEAD .low { color: black; ======= @@ -19,4 +17,15 @@ body { body { background: green; >>>>>>> 7fc5c28ad48f11fd5d8dac53c6310f44586b5fba -} \ No newline at end of file +} +======= + +#medpriority { + color: orange; +} + + +#lowpriority { + color: black; +} +>>>>>>> parent of 74f0a49... work in progress From dfda1f4dcb30f6c86e2e78bc87afec8b157dc289 Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Mon, 14 Sep 2015 20:07:15 -0400 Subject: [PATCH 07/11] Revert "Revert "work in progress"" This reverts commit c713cb41d82756a8d82eaf88fe4c7ab042e6c0d5. --- todo-src/index.html | 39 +++--------------------------- todo-src/script.js | 58 +++++++-------------------------------------- todo-src/style.css | 25 +++++++------------ 3 files changed, 19 insertions(+), 103 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 7e55423..7ef7fe8 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -66,44 +66,11 @@

    My little to do app!

    stuff i gotta do asap

      - -
    • - {{do}} - - - -
    • - -
    • - {{do}} - - - -
    • - -
    • - {{do}} - - -
    diff --git a/todo-src/script.js b/todo-src/script.js index a12d5ea..b2ed5a0 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -6,63 +6,21 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ - $scope.high = []; - $scope.medium = []; - $scope.low = []; + $scope.todos = []; $scope.newItem = ""; $scope.addItem = function(){ console.log("add"); if ($scope.newItem !== ""){ - if ($scope.priority == "high") {$scope.high.push($scope.newItem);} - if ($scope.priority == "med") {$scope.medium.push($scope.newItem);} - if ($scope.priority == "low") {$scope.low.push($scope.newItem);} - $scope.newItem = ""; - } - } - - - $scope.highcheckItem = function(item){ - console.log("high check"); - var index = $scope.high.indexOf(item); - //need implementation - } - - - $scope.highdeleteItem = function(item){ - console.log("high delete"); - var index = $scope.high.indexOf(item); - $scope.high.splice(index, 1); - } - - - $scope.medcheckItem = function(item){ - console.log("medium check"); - var index = $scope.medium.indexOf(item); - //need implementation - } - - - $scope.meddeleteItem = function(item){ - console.log("med delete"); - var index = $scope.medium.indexOf(item); - $scope.medium.splice(index, 1); - } - - - $scope.highcheckItem = function(item){ - console.log("low check"); - var index = $scope.low.indexOf(item); - //Need implementation - } - - - $scope.lowdeleteItem = function(item){ - console.log("low delete"); - var index = $scope.low.indexOf(item); - $scope.low.splice(index, 1); + $scope.todos.push($scope.newItem);} + $scope.newItem = ""; } + $scope.deleteItem = function(item){ + console.log("delete"); + var index = $scope.todos.indexOf(item); + $scope.todos.splice(index, 1); + } }); diff --git a/todo-src/style.css b/todo-src/style.css index 62149c9..7f34a39 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -4,12 +4,14 @@ body { background: green; } - -#highpriority { - color: red; -} +.high { + color: red; +} + +.med { + color: orange; +} -<<<<<<< HEAD .low { color: black; ======= @@ -17,15 +19,4 @@ body { body { background: green; >>>>>>> 7fc5c28ad48f11fd5d8dac53c6310f44586b5fba -} -======= - -#medpriority { - color: orange; -} - - -#lowpriority { - color: black; -} ->>>>>>> parent of 74f0a49... work in progress +} \ No newline at end of file From 46daebf5e579879c3eac16338da238e21f72a271 Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Mon, 14 Sep 2015 20:09:44 -0400 Subject: [PATCH 08/11] revert merge with complete-button branch --- todo-src/index.html | 39 ----------------------------------- todo-src/script.js | 50 --------------------------------------------- todo-src/style.css | 7 ------- 3 files changed, 96 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 7ef7fe8..42668a5 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -1,8 +1,6 @@ - -<<<<<<< HEAD @@ -11,43 +9,6 @@ -======= - -

    My little to do app!

    - -
    - -
    - - - - -
    - -

    stuff i gotta do asap

    - -
      - -
    • - - {{do.name}} - - - - - - - - - - ->>>>>>> 7fc5c28ad48f11fd5d8dac53c6310f44586b5fba -

      My little to do app!

      diff --git a/todo-src/script.js b/todo-src/script.js index b2ed5a0..c6a2215 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -1,4 +1,3 @@ -<<<<<<< HEAD // Code goes here @@ -36,52 +35,3 @@ myApp.controller('MainCtrl', function ($scope){ * - add reminder (setInterval) * * *********************/ -======= -// Code goes here - -var myApp = angular.module('app', []); - -myApp.controller('MainCtrl', function ($scope){ - $scope.todos = [{name: "Learn Angular", done:false}, {name: "Learn node", done:false}]; - $scope.newItem = ""; - - $scope.addItem = function(){ - console.log("in add"); - if ($scope.newItem !== ""){ - var addItem = {name:$scope.newItem, done:false}; - $scope.todos.push(addItem); - $scope.newItem = ""; - - } - } - - $scope.deleteItem = function(index){ - console.log("in delete"); - $scope.todos.splice(index, 1); - } - - $scope.completeItem = function(index){ - console.log("completed item"); - $scope.todos[index].done = true; - } - - $scope.uncompleteItem = function(index) { - console.log("uncompleted item"); - $scope.todos[index].done = false; - } - - -}); - -/************************* - * Homework (not rly): - * - "enter" button functionality instead of clicking button - * - edit button functionality - * - button to mark item as "complete" - * - have a total number of items at the top - * - make it prettier - * - add a due date - * - add reminder (setInterval) - * - * *********************/ ->>>>>>> 7fc5c28ad48f11fd5d8dac53c6310f44586b5fba diff --git a/todo-src/style.css b/todo-src/style.css index 7f34a39..e61f059 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* Styles go here */ body { background: green; @@ -14,9 +13,3 @@ body { .low { color: black; -======= -/* Styles go here */ -body { - background: green; ->>>>>>> 7fc5c28ad48f11fd5d8dac53c6310f44586b5fba -} \ No newline at end of file From 7824439c776ee7754c1f6cad686676dc32b2e319 Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Mon, 14 Sep 2015 22:24:45 -0400 Subject: [PATCH 09/11] Priority finished version-1 Managed to give priority coloring and sort from High to low priority all within a single list. However I had to alter the array storage from just an item to an item and priority. I believe someone else also altered to add a done boolean. --- todo-src/index.html | 38 +++++++++++++++++++++++++------------- todo-src/script.js | 16 +++++++++++----- todo-src/style.css | 9 +++++---- 3 files changed, 41 insertions(+), 22 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 42668a5..187ccd9 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -1,7 +1,8 @@ - + + @@ -10,26 +11,37 @@ -

      My little to do app!

      -
      -
      +

      My little to do app!

      + +
      +
      - + + + - +
      +
      + + -
      +
      + +
      +

      stuff i gotta do asap

        -
      • - {{do}} -
      • diff --git a/todo-src/script.js b/todo-src/script.js index c6a2215..36fe995 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -6,18 +6,24 @@ var myApp = angular.module('app', []); myApp.controller('MainCtrl', function ($scope){ $scope.todos = []; - $scope.newItem = ""; + $scope.newItem = ""; + //used to safeguard against undefined + var un_defined; $scope.addItem = function(){ console.log("add"); - if ($scope.newItem !== ""){ - $scope.todos.push($scope.newItem);} + if ($scope.newItem !== "" && $scope.priority !== un_defined){ + $scope.todos.push({name:$scope.newItem, priority:$scope.priority});} + $scope.todos.sort(function(a,b) { + if(a.priority > b.priority) {return 1;} + if(a.priority < b.priority) {return -1;} + return 0; + }); $scope.newItem = ""; } - $scope.deleteItem = function(item){ + $scope.deleteItem = function(index){ console.log("delete"); - var index = $scope.todos.indexOf(item); $scope.todos.splice(index, 1); } diff --git a/todo-src/style.css b/todo-src/style.css index e61f059..d694848 100644 --- a/todo-src/style.css +++ b/todo-src/style.css @@ -2,14 +2,15 @@ body { background: green; } - -.high { +/*Priority coloring*/ +.High { color: red; } -.med { +.Med { color: orange; } - +/*must be lower case to enforce sorting order of High, Medium, low....i.e. capital M comes before lower case l but after uppercase L*/ .low { color: black; +} \ No newline at end of file From 6c04ef3d2703445a4bc7b879fbc4a313125f681d Mon Sep 17 00:00:00 2001 From: csturco0331 Date: Tue, 15 Sep 2015 11:53:48 -0400 Subject: [PATCH 10/11] Added feature to submit task just by hitting the enter key. The input field must be in focus for this to work. --- todo-src/index.html | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index 187ccd9..f397eb4 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -12,24 +12,27 @@

        My little to do app!

        + +
        -
        -
        - -
        +
        + +
        - + + - @@ -37,7 +40,7 @@

        My little to do app!



        -

        stuff i gotta do asap

        +

        stuff i gotta do asap

        • {{do.name}} @@ -46,6 +49,6 @@

          stuff i gotta do asap

        -
        + From f7a327eafdb511ef46b53241960f31ed28737a01 Mon Sep 17 00:00:00 2001 From: nicolas Date: Tue, 15 Sep 2015 16:43:09 -0400 Subject: [PATCH 11/11] Added edit feature with ability to edit prioirity --- todo-src/index.html | 95 +++++++++++++++++++++++++++++++-------------- todo-src/script.js | 23 +++++++++++ 2 files changed, 89 insertions(+), 29 deletions(-) diff --git a/todo-src/index.html b/todo-src/index.html index f397eb4..99e0032 100644 --- a/todo-src/index.html +++ b/todo-src/index.html @@ -13,42 +13,79 @@

        My little to do app!

        -
        - -
        - - -
        -
        - -
        -
        - - - - - -
        +
        + + +
        + + +
        +
        + +
        +
        + + + + + +
        +

        stuff i gotta do asap

        • - {{do.name}} - + + + {{do.name}} + +
          + + +
          + + +
          + + + + + + +
          + +
          + + + +
          + +
        - +
        diff --git a/todo-src/script.js b/todo-src/script.js index 36fe995..702175e 100644 --- a/todo-src/script.js +++ b/todo-src/script.js @@ -26,6 +26,29 @@ myApp.controller('MainCtrl', function ($scope){ console.log("delete"); $scope.todos.splice(index, 1); } + + $scope.editItem = function(item, uInput, priority){ + console.log("in edit"); + var index = $scope.todos.indexOf(item); + if (uInput) { + $scope.todos[index].name = uInput; + } + else{ + $scope.todos[index].name = $scope.todos[index].name; + } + $scope.uInput = ""; + + $scope.todos[index].priority = priority; + //if (1){ + //$scope.todos.splice(index, 1); + //$scope.todos.push({name:uInput, priority:priority});} + $scope.todos.sort(function(a,b) { + if(a.priority > b.priority) {return 1;} + if(a.priority < b.priority) {return -1;} + return 0; + }); + + } });