Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
7467aa92
Commit
7467aa92
authored
Jun 16, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
student add functions and form generator first use
parent
46246123
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
0 deletions
+97
-0
form_service.js
app/forms/form_service.js
+28
-0
form_service_template.html
app/forms/form_service_template.html
+6
-0
form_service_test.js
app/forms/form_service_test.js
+44
-0
student_add.js
app/student/student_add.js
+19
-0
No files found.
app/forms/form_service.js
0 → 100644
View file @
7467aa92
/**
* 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
app/forms/form_service_template.html
0 → 100644
View file @
7467aa92
<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
app/forms/form_service_test.js
0 → 100644
View file @
7467aa92
/**
* 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
app/student/student_add.js
0 → 100644
View file @
7467aa92
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'
;
var
studentAdd
=
angular
.
module
(
'zaerp.student.add'
,
[
'ngRoute'
,
'schemaForm'
,
'formGenerator'
]);
studentAdd
.
controller
(
'StudentAddCtrl'
,
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment