Commit 0e302e32 authored by Evren Kutar's avatar Evren Kutar

copyright text changed

parent fd284d7a
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'; 'use strict';
// Declare app level module which depends on views, and components // Declare app level module which depends on views, and components
......
/** /**
* Created by evren kutar on 12/05/15. * Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/ */
'use strict'; 'use strict';
......
/** /**
* Created by evren kutar on 12/05/15. * Copyright (C) 2015 ZetaOps Inc.
*/ *
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
\ No newline at end of file
/** /**
* Created by Evren Kutar on 09/06/15. * Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/ */
var form_generator = angular.module('FormGenerator', []); var form_generator = angular.module('FormGenerator', []);
...@@ -7,8 +10,10 @@ var form_generator = angular.module('FormGenerator', []); ...@@ -7,8 +10,10 @@ var form_generator = angular.module('FormGenerator', []);
form_generator.factory('Generator', function(){ form_generator.factory('Generator', function(){
var generator ={}; var generator ={};
generator.generate = function(modelObject){ generator.generate = function(modelObject){
var form = modelObject; return generator.group(modelObject);
return form; };
generator.group = function(form_items){
return form_items;
}; };
return generator; return generator;
}); });
\ No newline at end of file
/** /**
* Created by Evren Kutar on 09/06/15. * Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/ */
'use strict';
describe('general module', function () {
beforeEach(module('general'));
describe('form diff factory', function () {
it('should return diff object', inject(['FormDiff',
function (FormDiff) {
expect(FormDiff.get_diff).not.toBe(null);
// test cases - testing for success
var same_json = [
{email:'test@test.com', id:2, name:'travolta'},
{email:'test@test.com', id:2, name:'travolta'}
];
// test cases - testing for failure
var different_json = [
{email:'test@test.com', id:2, name:'travolta'},
{email:'test1@test.com', id:2, name:'john'}
];
var diff = {email:'test1@test.com', name:'john'};
var nodiff = {};
var same = FormDiff.get_diff(same_json[0], same_json[1]);
expect(same).toEqual(nodiff);
var different = FormDiff.get_diff(different_json[0], different_json[1]);
expect(different).toEqual(diff);
}])
);
});
});
\ No newline at end of file
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'; 'use strict';
// TODO: clean console log items // TODO: clean console log items
...@@ -6,81 +13,81 @@ ...@@ -6,81 +13,81 @@
var login = angular.module('zaerp.login', ['ngRoute', 'schemaForm']); var login = angular.module('zaerp.login', ['ngRoute', 'schemaForm']);
login.config(['$routeProvider', function ($routeProvider) { login.config(['$routeProvider', function ($routeProvider) {
//$routeProvider.when('/login', { //$routeProvider.when('/login', {
// templateUrl: 'login/login.html', // templateUrl: 'login/login.html',
// controller: 'LoginCtrl' // controller: 'LoginCtrl'
//}); //});
}]); }]);
login.controller('LoginCtrl', function ($scope, $q, $timeout, $http, $location, $rootScope, AUTH_EVENTS, LoginService, FormDiff) { login.controller('LoginCtrl', function ($scope, $q, $timeout, $http, $location, $rootScope, AUTH_EVENTS, LoginService, FormDiff) {
$scope.schema = $scope.schema =
{ {
title: "Login", title: "Login",
type: "object", type: "object",
properties: { properties: {
email: { email: {
type: "email",
title: "Email"
},
password: {
type: "string",
title: "Password"
},
remember: {
type: "boolean",
title: "Remember me?"
},
who: {
title: "Who are you?",
type: "string",
enum: ["student", "stuff", "dean"]
}
},
required: ["email", "password", "who"]
};
$scope.model = {
email: "user@example.com",
remember: false
};
$scope.form = [
{
key: "email",
type: "email", type: "email",
validationMessages: { title: "Email"
'emailNotValid': 'Email is not valid!'
},
$asyncValidators: {
emailNotValid: function(value){
var deferred = $q.defer();
$timeout(function(){
if (LoginService.isValidEmail(value)) {
deferred.resolve();
} else {
deferred.reject();
}
}, 500);
return deferred.promise;
}
}
}, },
{ password: {
key: "password", type: "string",
type: "password" title: "Password"
}, },
"remember", remember: {
"who", type: "boolean",
{ title: "Remember me?"
type: "submit", },
title: "Save" who: {
} title: "Who are you?",
]; type: "string",
$scope.onSubmit = function(form){ enum: ["student", "stuff", "dean"]
$scope.$broadcast('schemaFormValidate');
if (form.$valid){
var credentials = {email: form.email.$modelValue, password: form.password.$modelValue};
LoginService.login(credentials);
} }
else { },
console.log("not valid"); required: ["email", "password", "who"]
};
$scope.model = {
email: "user@example.com",
remember: false
};
$scope.form = [
{
key: "email",
type: "email",
validationMessages: {
'emailNotValid': 'Email is not valid!'
},
$asyncValidators: {
emailNotValid: function (value) {
var deferred = $q.defer();
$timeout(function () {
if (LoginService.isValidEmail(value)) {
deferred.resolve();
} else {
deferred.reject();
}
}, 500);
return deferred.promise;
}
} }
},
{
key: "password",
type: "password"
},
"remember",
"who",
{
type: "submit",
title: "Save"
}
];
$scope.onSubmit = function (form) {
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
var credentials = {email: form.email.$modelValue, password: form.password.$modelValue};
LoginService.login(credentials);
}
else {
console.log("not valid");
} }
}); }
\ No newline at end of file });
\ No newline at end of file
/** /**
* Created by evren kutar on 12/05/15. * Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/ */
"use strict"; "use strict";
......
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'; 'use strict';
// TODO: fill up the test cases correctly // TODO: fill up the test cases correctly
......
/** /**
* Created by Evren Kutar on 09/06/15. * Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/ */
//angular.module('FormDiff', []) //angular.module('FormDiff', [])
......
/** /**
* Created by Evren Kutar on 09/06/15. * Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/ */
'use strict'; 'use strict';
describe('general module', function () { describe('general module', function () {
......
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
...@@ -34,10 +41,11 @@ module.exports = function (config) { ...@@ -34,10 +41,11 @@ module.exports = function (config) {
frameworks: ['jasmine'], frameworks: ['jasmine'],
browsers: ['Chrome'], browsers: ['Opera'],
plugins: [ plugins: [
'karma-chrome-launcher', 'karma-chrome-launcher',
'karma-opera-launcher',
'karma-firefox-launcher', 'karma-firefox-launcher',
'karma-jasmine', 'karma-jasmine',
'karma-junit-reporter', 'karma-junit-reporter',
......
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