Move preventDefault from service to controller

This commit is contained in:
Rohan Mitchell
2013-01-08 17:51:08 +11:00
parent f705926c72
commit 6a666dd7ec
2 changed files with 32 additions and 36 deletions

View File

@@ -4,11 +4,13 @@ function AdminCreateOrderCycleCtrl($scope, OrderCycle, Enterprise) {
$scope.order_cycle = OrderCycle.order_cycle;
$scope.toggleProducts = function($event, exchange) {
OrderCycle.toggleProducts($event, exchange);
$event.preventDefault();
OrderCycle.toggleProducts(exchange);
};
$scope.addSupplier = function($event) {
OrderCycle.addSupplier($event, $scope.new_supplier_id);
$event.preventDefault();
OrderCycle.addSupplier($scope.new_supplier_id);
};
$scope.submit = function() {
@@ -24,11 +26,13 @@ function AdminEditOrderCycleCtrl($scope, $location, OrderCycle, Enterprise) {
$scope.order_cycle = OrderCycle.load(order_cycle_id);
$scope.toggleProducts = function($event, exchange) {
OrderCycle.toggleProducts($event, exchange);
$event.preventDefault();
OrderCycle.toggleProducts(exchange);
};
$scope.addSupplier = function($event) {
OrderCycle.addSupplier($event, $scope.new_supplier_id);
$event.preventDefault();
OrderCycle.addSupplier($scope.new_supplier_id);
};
$scope.submit = function() {
@@ -52,13 +56,11 @@ angular.module('order_cycle', ['ngResource']).
order_cycle: {incoming_exchanges: [],
outgoing_exchanges: []},
toggleProducts: function(event, exchange) {
event.preventDefault();
toggleProducts: function(exchange) {
exchange.showProducts = !exchange.showProducts
},
addSupplier: function(event, new_supplier_id) {
event.preventDefault();
addSupplier: function(new_supplier_id) {
this.order_cycle.incoming_exchanges.push({enterprise_id: new_supplier_id, active: true, exchange_variants: {}});
},