Latest tweaks

This commit is contained in:
Dobie Wollert
2015-08-10 01:42:48 -04:00
parent a8a63651ab
commit a228c2fde0
10 changed files with 37 additions and 35 deletions

View File

@ -75,7 +75,9 @@ function checkListsControllerFactory(isEdit) {
function save() {
if (isEdit) {
CheckLists.update({id: $scope.model._id}, $scope.model);
CheckLists.update({id: $scope.model._id}, $scope.model, function() {
$location.path("/checkLists/");
});
} else {
CheckLists.create($scope.model, function(result) {
$location.path("/checkLists/" + result._id);
@ -99,4 +101,4 @@ function checkListsControllerFactory(isEdit) {
$scope.model = CheckLists.get($routeParams);
}
}
}
}

View File

@ -152,18 +152,20 @@ angular.module('biomed')
.controller("DeviceTypeEditCtrl", function($scope, DeviceTypes, Devices, CheckLists, $location, $filter, $routeParams) {
var images = {};
$scope.model = DeviceTypes.get($routeParams, function() {
$scope.loading = false;
$scope.checkLists = CheckLists.index(function() {
$scope.model = DeviceTypes.get($routeParams, function() {
$scope.loading = false;
$scope.existingImages = $scope.model.images;
if ($scope.model.images) {
for (var i = 0; i < $scope.model.images.length; i++) {
images[$scope.model.images[i]] = 1;
$scope.existingImages = $scope.model.images;
if ($scope.model.images) {
for (var i = 0; i < $scope.model.images.length; i++) {
images[$scope.model.images[i]] = 1;
}
}
}
$scope.categoryPicker = {id: $scope.model.category, text: $scope.model.category};
$scope.makePicker = {id: $scope.model.make, text: $scope.model.make};
$scope.categoryPicker = {id: $scope.model.category, text: $scope.model.category};
$scope.makePicker = {id: $scope.model.make, text: $scope.model.make};
});
});
console.log($routeParams);
@ -173,8 +175,6 @@ angular.module('biomed')
$scope.categories = DeviceTypes.categories();
$scope.deviceMakes = DeviceTypes.makes();
$scope.checkLists = CheckLists.index();
$scope.categoryOpts = {
containerCssClass: 'input-xxlarge',
@ -257,4 +257,4 @@ angular.module('biomed')
$location.path("/deviceTypes/");
});
};
})
})

View File

@ -94,13 +94,14 @@ function devicesControllerFactory(isEdit) {
function create() {
Devices.create($scope.model, function(result) {
console.log('here');
$location.path("/devices/" + result._id);
$location.path("/clients/" + result.client);
});
}
function update() {
Devices.update({id: $scope.model._id}, $scope.model);
Devices.update({id: $scope.model._id}, $scope.model, function() {
$location.path("/clients/" + $scope.model.client);
});
}
var hashids = new Hashids("biomed");