Commit 46246123 authored by Evren Kutar's avatar Evren Kutar

async work & structure design

parent 235c56fc
......@@ -57,6 +57,15 @@ angular.module(
}]
}
})
.when('/test', {
templateUrl: 'test_view_for_generator/test_template.html',
controller: 'TestCtrl',
resolve: {
loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load('test_view_for_generator/testfile.js');
}]
}
})
.otherwise({redirectTo: '/dashboard'});
}]).
run(function ($rootScope, $location, $cookies) {
......
<div ng-app="zaerp.dashboard">
<div class="starter-template" ng-controller="DashCtrl">
<div class="starter-template">
<h1>Main Dashboard</h1>
{{ testData }}
</div>
......
......@@ -11,12 +11,7 @@
angular.module('zaerp.dashboard', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
//$routeProvider.when('/dashboard', {
// templateUrl: 'dashboard/dashboard.html',
// controller: 'DashCtrl'
//});
}])
.controller('DashCtrl', function ($scope) {
$scope.testData = "<h1>This is main Dashboard</h1>";
console.log(22);
});
\ 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.
*/
var form_generator = angular.module('formGenerator', []);
form_generator.factory('Generator', function ($http, RESTURL) {
var generator = {};
generator.generate = function (modelObject) {
return generator.group(modelObject);
};
generator.group = function (form_items) {
return form_items;
};
generator.get_form = function (url, getParams) {
return $http
.get(RESTURL.url + url + getParams)
.then(function (res) {
if (res.data) {
return res.data;
}
});
};
return generator;
});
\ 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';
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
<div ng-app="FormGenerator">
<div class="col-md-6" ng-controller="">
<h1>{{ form.name }}</h1>
<form name="{{ form.formname }}" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit()"></form>
</div>
</div>
\ No newline at end of file
......@@ -36,7 +36,7 @@
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#/dashboard">Dashboard</a></li>
<li><a href="#/settings">Settings</a></li>
<li><a href="#/test">Test</a></li>
<li><a href="#/profile">Profile</a></li>
<li><a href="#/login">Login</a></li>
</ul>
......
<div ng-app="zaerp.dashboard">
<div class="starter-template" ng-controller="TestCtrl">
<h1>Main Dashboard</h1>
<div ng-include=" '' "></div>
<div ng-app="zaerp.test">
<div class="starter-template">
<h1>Add Student</h1>
<div>{{ form }}</div>
</div>
</div>
\ No newline at end of file
'use strict';
var testform = angular.module('zaerp.test', ['ngRoute', 'schemaForm']);
testform.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/test', {
templateUrl: 'test_view_for_generator/test_template.html',
controller: 'TestCtrl'
});
}]);
var testform = angular.module('zaerp.', ['ngRoute', 'schemaForm', 'formGenerator']);
testform.controller('TestCtrl', function($scope, $q, $timeout, Generator){
testform.controller('RecordCtrl', function($scope, $http, $timeout, $log, Generator, RESTURL){
$scope.form = Generator.generate('add_student', '');
$log.info($scope.form);
$http.get(RESTURL.url + 'add_student').then(function(res){
$log.info(res.data);
});
});
\ No newline at end of file
......@@ -6,10 +6,11 @@
"license": "MIT",
"private": true,
"dependencies": {
"angular": "1.3.x",
"angular-mocks": "1.3.x",
"angular-route": "1.3.x",
"angular-resource": "1.3.x",
"angular": "1.4.x",
"angular-mocks": "1.4.x",
"angular-route": "1.4.x",
"angular-resource": "1.4.x",
"angular-cookies": "1.4.x",
"bootstrap": "3.3.4",
"angular-schema-form": "*",
"oclazyload": "*"
......
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