Commit 2320c175 authored by Evren Kutar's avatar Evren Kutar

deep copy to use form diff, load general.js

parent 9afb4586
......@@ -30,6 +30,9 @@ app.config(['$routeProvider', function ($routeProvider) {
}],
loadMyService: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load('zetalib/forms/form_service.js');
}],
loadMyService2: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load('zetalib/general.js');
}]
}
})
......
......@@ -11,7 +11,7 @@
* student module is base module object for student operations
*/
var student = angular.module('zaerp.student.add', ['ngRoute', 'schemaForm', 'formService']);
var student = angular.module('zaerp.student.add', ['ngRoute', 'schemaForm', 'formService', 'general']);
/**
* StudentAddCtrl
......@@ -23,7 +23,8 @@ student.controller('StudentAddEditCtrl', function($scope, $http, $log, Generator
$scope.schema = d.schema;
$scope.form = d.form;
// model is the init data of the form or in edit templates
$scope.model = {};
$scope.model = d.model;
$scope.initialModel = angular.copy(d.model);
// for email validation add asyncvalidator
$scope.form[0].$asyncValidators = Generator.asyncValidators;
// add submit button to the form todo: move this to form service
......@@ -38,7 +39,7 @@ student.controller('StudentAddEditCtrl', function($scope, $http, $log, Generator
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
// todo: implement form diff here
$log.info($scope);
$log.info($scope.initialModel, $scope.model);
}
}
});
\ No newline at end of file
......@@ -34,6 +34,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL) {
// todo: remove 0 index with real api
return generator.generate(res.data[0]);
}
// todo: cover all other exceptions (4xx, 5xx)
});
};
generator.isValidEmail = function(email){
......
......@@ -5,6 +5,8 @@
* (GPLv3). See LICENSE.txt for details.
*/
// todo: move to form
//angular.module('FormDiff', [])
/**
* this file contains general functions of app.
......
......@@ -36,7 +36,11 @@ var form = new fake.Resource("add_student")
}
},
"name"
]
],
model: {
name: "evren kutar",
email: "a@a.com"
}
});
var server = new fake.Server()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment