diff --git a/app/app.js b/app/app.js index 2d93e56..e0a49b4 100644 --- a/app/app.js +++ b/app/app.js @@ -17,11 +17,11 @@ app.factory('FoodDetail', function($resource) { }); app.factory('Categories', function($resource) { - return $resource('api/index.php/category/all'); + return $resource('http://foodbank.develop.digitalmediauconn.org/api/index.php/category/all'); }); app.factory('Nutrients', function($resource) { - return $resource('api/index.php/nutrient/all'); + return $resource('http://foodbank.develop.digitalmediauconn.org/api/index.php/nutrient/all'); }); // Just does a PUT request when u call Food.update diff --git a/app/app.route.js b/app/app.route.js index 766974d..b3155bb 100644 --- a/app/app.route.js +++ b/app/app.route.js @@ -2,7 +2,7 @@ app.config( function ($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: 'app/pages/categories/view.html', - controller: 'FoodCtrl' + controller: 'CategoryCtrl' }) .when('/login', { diff --git a/app/root/_nav.kit b/app/root/_nav.kit index 2e60990..64c2603 100644 --- a/app/root/_nav.kit +++ b/app/root/_nav.kit @@ -6,6 +6,7 @@ + diff --git a/assets/js/bundle.js b/assets/js/bundle.js index 39c8741..9b7e0d5 100644 --- a/assets/js/bundle.js +++ b/assets/js/bundle.js @@ -17,11 +17,11 @@ app.factory('FoodDetail', function($resource) { }); app.factory('Categories', function($resource) { - return $resource('api/index.php/category/all'); + return $resource('http://foodbank.develop.digitalmediauconn.org/api/index.php/category/all'); }); app.factory('Nutrients', function($resource) { - return $resource('api/index.php/nutrient/all'); + return $resource('http://foodbank.develop.digitalmediauconn.org/api/index.php/nutrient/all'); }); // Just does a PUT request when u call Food.update @@ -44,7 +44,7 @@ app.config( function ($routeProvider, $locationProvider) { $routeProvider .when('/', { templateUrl: 'app/pages/categories/view.html', - controller: 'FoodCtrl' + controller: 'CategoryCtrl' }) .when('/login', { @@ -362,50 +362,6 @@ app.controller('FoodCtrl', ['$scope', '$http', 'Foods', 'FoodDetail', 'Categorie }]); -app.controller('NutrientsCtrl', ['$scope', 'Nutrients', function ($scope, Nutrients) { - $scope.page.title = 'Nutrients'; - $scope.page.id = 'nutrients'; - - // Initialize CRUD modes - $scope.editMode = false; - $scope.createMode = false; - - // Initialize CRUD form - $scope.nutrientCRUD = {}; - - // GET nutrients - Nutrients.get({}, function (data) { - $scope.nutrients = data.data; - }); - - // CRUD: edit food - $scope.edit = function (nutrientToEdit) { - $scope.editMode = true; - $scope.nutrientCRUD = nutrientToEdit; - $scope.nutrientCRUD.action = "update"; - }; - - // CRUD: create food - $scope.create = function () { - $scope.createMode = true; - $scope.nutrientCRUD = {}; - $scope.nutrientCRUD.action = "create"; - }; - - // CRUD: cancel - $scope.cancel = function () { - $scope.editMode = false; - $scope.createMode = false; - }; - - // CRUD: POST - $scope.submit = function () { - if ($scope.editMode) {Nutrient.update($scope.nutrientCRUD);} - else if ($scope.createMode) {Nutrient.save($scope.nutrientCRUD);} - $scope.cancel(); // hide modal - }; -}]); - app.controller('LoginCtrl', ['$scope', 'loginService', function ($scope, loginService) { $scope.page.title = 'Login'; $scope.page.id = 'login'; @@ -457,4 +413,47 @@ app.factory('loginService', ['$http', function($http) { }); } }; -}]); \ No newline at end of file +}]); +app.controller('NutrientsCtrl', ['$scope', 'Nutrients', function ($scope, Nutrients) { + $scope.page.title = 'Nutrients'; + $scope.page.id = 'nutrients'; + + // Initialize CRUD modes + $scope.editMode = false; + $scope.createMode = false; + + // Initialize CRUD form + $scope.nutrientCRUD = {}; + + // GET nutrients + Nutrients.get({}, function (data) { + $scope.nutrients = data.data; + }); + + // CRUD: edit food + $scope.edit = function (nutrientToEdit) { + $scope.editMode = true; + $scope.nutrientCRUD = nutrientToEdit; + $scope.nutrientCRUD.action = "update"; + }; + + // CRUD: create food + $scope.create = function () { + $scope.createMode = true; + $scope.nutrientCRUD = {}; + $scope.nutrientCRUD.action = "create"; + }; + + // CRUD: cancel + $scope.cancel = function () { + $scope.editMode = false; + $scope.createMode = false; + }; + + // CRUD: POST + $scope.submit = function () { + if ($scope.editMode) {Nutrient.update($scope.nutrientCRUD);} + else if ($scope.createMode) {Nutrient.save($scope.nutrientCRUD);} + $scope.cancel(); // hide modal + }; +}]); diff --git a/index.html b/index.html index 995cd1d..fbf5d63 100644 --- a/index.html +++ b/index.html @@ -43,6 +43,7 @@ +