Skip to content
Open

Yu #51

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5183906
Added option to assign a priority to a to-do item
Sep 10, 2015
86996a4
Made instruction for adding/choosing priority clearer
Sep 10, 2015
d59661d
added delete all function
mr-ditters Sep 10, 2015
565285c
fixed bug in original code
mr-ditters Sep 14, 2015
7d2f124
Display total number of things to do
Sep 14, 2015
9eb99cf
Add comment to test push permission
Sep 14, 2015
cba7e08
Merge remote-tracking branch 'CEN3031/master'
mr-ditters Sep 14, 2015
f016cd3
Added Mark as Complete
mielliott Sep 14, 2015
9b6422c
Merge pull request #1 from CEN3031Group5B/victor
mr-ditters Sep 14, 2015
1af3864
Merge remote-tracking branch 'CEN3031/master' into brandon-total_num_…
victorh3 Sep 14, 2015
0a6a300
change color
jthakore Sep 14, 2015
9058791
Merge branch 'master' into brandon-total_num_items
victorh3 Sep 14, 2015
ae4e77e
Merge pull request #2 from CEN3031Group5B/brandon-total_num_items
mr-ditters Sep 14, 2015
7da332a
Merge pull request #3 from CEN3031Group5B/master
mr-ditters Sep 14, 2015
cf496d1
Merge branch 'master' into kevin-delete_all
mr-ditters Sep 14, 2015
13e1a71
fixed merge conflict style.css
mr-ditters Sep 14, 2015
8e69452
Fixed merge conflicts
victorh3 Sep 14, 2015
406134e
Merge branch 'master' into kevin-delete_all
victorh3 Sep 14, 2015
250869a
Merge pull request #4 from CEN3031Group5B/kevin-delete_all
mr-ditters Sep 14, 2015
d26f5a8
added red background
Sep 9, 2015
de79db8
testing background
Sep 9, 2015
2a91f22
Update README.md
spuleri Sep 9, 2015
9ce6001
Merge remote-tracking branch 'CEN3031/master' into michael-mark-as-co…
victorh3 Sep 14, 2015
006e59e
Merge branch 'master' into michael-mark-as-complete
victorh3 Sep 14, 2015
e94bdb4
Merge pull request #5 from CEN3031Group5B/michael-mark-as-complete
mr-ditters Sep 14, 2015
e9270fc
Merge branch 'master' into MyBranch
victorh3 Sep 14, 2015
09579a4
Merge pull request #6 from CEN3031Group5B/MyBranch
mr-ditters Sep 14, 2015
ed7a01b
Merge pull request #7 from CEN3031Group5B/master
mr-ditters Sep 14, 2015
0d37cee
Added Edit Button
victorh3 Sep 14, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 43 additions & 17 deletions todo-src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,55 @@ <h1 class="text-center">My little to do app!</h1>

<div id="todo" class="col-xs-6 col-xs-offset-3" ng-controller="MainCtrl">

<div class="input-group">
<input type="text" class="form-control" placeholder="Item to add to todo list" ng-model="newItem">
<span class="input-group-btn">
<button class="btn btn-default" type="button" ng-click="addItem()">
Add
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</button>
</span>
<div class="form-group">
<input type="text" class="form-control" placeholder="Item to add to todo list. Choose priority and add by selecting button." ng-model="newItem">
</div><!-- /input-group -->

<div class="btn-group btn-group-justified">
<a class="btn btn-danger" type="button" ng-click="addItemHigh()">Priority: Now <span class="glyphicon glyphicon-ok" aria-hidden="true"></span></a>
<a class="btn btn-warning" type="button" ng-click="addItemMedium()">Priority: Tomorrow <span class="glyphicon glyphicon-ok" aria-hidden="true"></span></a>
<a class="btn btn-success" type="button" ng-click="addItemLow()">Priority: Someday <span class="glyphicon glyphicon-ok" aria-hidden="true"></span></a>
</div>

<h2>stuff i gotta do asap</h2>
<!-- display total number of things to do -->
<h2>stuff i gotta do asap: <small ng-bind="get_len()"></small><small> total things to do</small></h2>


<ul class="list-group">
<!-- http://www.w3schools.com/css/css_float.asp -->
<li class="list-group-item clearfix" ng-repeat="do in todos">

<span>{{do}}</span>
<button class="btn btn-danger pull-right" type="button" ng-click="deleteItem(do)">
<span class="glyphicon glyphicon-trash " aria-hidden="true"></span>
<li class="list-group-item clearfix" ng-repeat="do in todos" ng-style="!getActive(do) && {'text-decoration':'line-through'}">

<span ng-hide="editingMode(do)">{{do}}</span>
<input ng-model="editor.text" ng-show="editingMode(do)">
<span class="pull-right">
<div class="btn-group" role="group" aria-label="editButton" ng-hide="editingMode(do)">
<button ng-show="getActive(do)" class="btn btn-success pull-right" type="button" ng-click="toggleItem(do)" id="checkButton">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</button>

<button class="btn btn-primary btn-sm" type="button" ng-click="editItem(do)">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
</button>
</div>
<div class="btn-group" role="group" aria-label="saveButton" ng-show="editingMode(do)">
<button class="btn btn-primary btn-sm" type="button" ng-click="saveItem(do)">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</button>
</div>
<div class="btn-group" role="group" aria-label="cancelButton" ng-show="editingMode(do)">
<button class="btn btn-primary btn-sm" type="button" ng-click="cancelItem(do)">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
</div>
<div class="btn-group" role="group" aria-label="deleteButton" ng-hide="editingMode(do)">
<button class="btn btn-danger btn-sm" type="button" ng-click="deleteItem(do)">
<span class="glyphicon glyphicon-trash " aria-hidden="true"></span>
</button>
</div>
</span>
</li>

</li>
</ul>
<!--Button will only be shown if there are items in list-->
<button type="button" id="DeleteAll" class="btn btn-primary btn-lg btn-block ng-hide" ng-show="todos.length" ng-click="deleteAll()"><h2>Delete Completed Items!</h2></button>
</div>

</body>
Expand Down
92 changes: 90 additions & 2 deletions todo-src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,111 @@ var myApp = angular.module('app', []);

myApp.controller('MainCtrl', function ($scope){
$scope.todos = ["Learn Angular", "Learn node"];
$scope.dones = [false, false];
$scope.editor = { text : null, index : null };
$scope.newItem = "";

$scope.addItem = function(){

console.log("in add");
if ($scope.newItem !== ""){
if($scope.todos.indexOf($scope.newItem) === -1){
$scope.todos.push($scope.newItem);
}
$scope.newItem = "";
}
}

$scope.addItemHigh = function(){
console.log("in add");
if ($scope.newItem !== ""){
$scope.todos.push($scope.newItem);
$scope.todos.push("NOW: " + $scope.newItem);
$scope.newItem = "";
}
}

$scope.addItemMedium = function(){
console.log("in add");
if ($scope.newItem !== ""){
$scope.todos.push("TOMORROW: " + $scope.newItem);
$scope.newItem = "";
}
}

$scope.addItemLow = function(){
console.log("in add");
if ($scope.newItem !== ""){
$scope.todos.push("SOMEDAY: " + $scope.newItem);
$scope.newItem = "";
}
}

$scope.editItem = function(item){
console.log("in edit");
var index = $scope.todos.indexOf(item);
$scope.editor.index = index;
$scope.editor.text = item;
}

$scope.saveItem = function(item){
console.log("in save");
$scope.todos[$scope.editor.index] = $scope.editor.text;
$scope.editor.index = null;
}

$scope.cancelItem = function(item){
console.log("in cancel");
$scope.editor.index = null;
}

$scope.editingMode = function(item){
var index = $scope.todos.indexOf(item);
return $scope.editor.index === index;
}


$scope.deleteItem = function(item){
console.log("in delete");
var index = $scope.todos.indexOf(item);
$scope.todos.splice(index, 1);
$scope.dones.splice(index, 1);
}


$scope.toggleItem = function(item){
console.log("in toggle");
var index = $scope.todos.indexOf(item);
$scope.dones[index] = !$scope.dones[index];
}

$scope.getActive = function(item){
console.log("in toggle");
var index = $scope.todos.indexOf(item);
return !$scope.dones[index];
}


$scope.deleteAll = function(){
var length = $scope.dones.length; //get all the todos in the list
if(length !== 0){
var a = confirm("Are you really sure you want to do this?");
if(a){
console.log("deleted All");
for(i = 0; i < length; i++){
if($scope.dones[i]){
$scope.todos.splice(i,0); //delete all them from the list
$scope.dones.splice(i,0);
}
}
}
}
}

$scope.get_len = function() {
return $scope.todos.length;
}


});

/*************************
Expand Down
12 changes: 10 additions & 2 deletions todo-src/style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
/* Styles go here */
body {
background: green;

/*1.Change the background color of the to-do app*/
body{
background-color: #e7e7f6;
}

#DeleteAll {
background-color: red;
color: white;

}