Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidJDJ committed Oct 4, 2015
2 parents 4becbf9 + 0f6578c commit 97655ad
Show file tree
Hide file tree
Showing 127 changed files with 3,428 additions and 1,716 deletions.
1 change: 0 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<script src="routes.js"></script>
<script src="./js/homeController.js"></script>
<script src="./js/newKidController.js"></script>
<script src="./js/loginController.js"></script>

</head>
<body>
Expand Down
8 changes: 5 additions & 3 deletions client/js/homeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,17 @@ saburiKonnect.controller('homeController', function($scope, $location, NewOrgani

})

saburiKonnect.factory('NewOrganisationFactory',function($http){
saburiKonnect.factory('NewOrganisationFactory',function($http,$location){
var factory = {};
factory.login = function(info,callback){
$http.post('/login', info).success(function(output){
console.log(output);
// callback(output);
if (!output.error) {
$location.path ("/kids")
}
});
};
factory.add_Organisation = function(info,callback){
factory.addOrganisation = function(info,callback){
$http.post('/add_organisation', info).success(function(output){
callback(output);
});
Expand Down
18 changes: 0 additions & 18 deletions client/js/loginController.js

This file was deleted.

12 changes: 11 additions & 1 deletion client/js/newkidController.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
callback(output);
});
};
factory.getKids = function(callback){
$http.get('/get_kids').success(function(output){
callback(output);
});
};
return factory;
});

saburiKonnect.controller('newKidController', function($scope,$location,$routeParams, NewKidFactory){
$scope.addKid = function()
// console.log('hi');
$scope.addKid = function()
{
console.log("in controller");
NewKidFactory.addKid($scope.newkid);
Expand All @@ -25,6 +31,10 @@
{
$scope.organisations = data;
})

NewKidFactory.getKids(function(data){
$scope.kids = data;
})
});


Expand Down
18 changes: 18 additions & 0 deletions client/partials/kids.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<style type="text/css">
.kids{
display: inline-block;
vertical-align: top;
height: 250px;
width: 250px;
border:1px solid black;
}

</style>
<div ng-controller = "newKidController">
<h2> Meet the kids who need support </h2>
<div ng-repeat="kid in kids">
<div class="kids">
<p ng-bind="kid.first_name"></p>
<p ng-bind="kid.last_name"></p>
</div>
</div>
10 changes: 0 additions & 10 deletions client/partials/newkid.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ <h2>Add a new Kiddo</h2>
<select ng-repeat="organisation in organisations">
<option ng-model="newKid.organisation" ng-bind="organisation.id"></option>
</select><br>
<label>Upload Picture </label>
<input type='file' id="imgInp" name="imgInp"/>
<img id="image" src="" alt="your image" />

<div id="imgList"></div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

<script src="js/upload.js"></script>
</div>

<button ng-click="addKid()">Add Kiddo</button>


Expand Down
3 changes: 3 additions & 0 deletions client/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ saburiKonnect.config(function($routeProvider){
.when('/addKid',{
templateUrl: './partials/newKid.html'
})
.when('/kids',{
templateUrl: './partials/kids.html'
})
.otherwise('/', {
redirectTo: '/'
})
Expand Down
5 changes: 5 additions & 0 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ module.exports = function(app){
app.post('/login',function(req,res){
organisations.login(req,res)
});

app.get('/get_kids',function(req,res){
kids.get_kids(req,res)
});

}


28 changes: 24 additions & 4 deletions node_modules/body-parser/node_modules/bytes/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions node_modules/body-parser/node_modules/content-type/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 26 additions & 4 deletions node_modules/body-parser/node_modules/debug/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions node_modules/body-parser/node_modules/depd/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 97655ad

Please sign in to comment.