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
acb89377
Commit
acb89377
authored
Jul 31, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
form service spof olacak sekilde guncellendi
formsetler icin template olusturuldu. angular ui bootstrap eklendi
parent
05d91c00
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
56 deletions
+64
-56
auth_controller.js
app/components/auth/auth_controller.js
+3
-15
staff_controller.js
app/components/staff/staff_controller.js
+16
-25
index.html
app/index.html
+4
-8
add.html
app/shared/templates/add.html
+5
-0
form_service.js
app/zetalib/forms/form_service.js
+35
-8
bower.json
bower.json
+1
-0
No files found.
app/components/auth/auth_controller.js
View file @
acb89377
...
...
@@ -10,22 +10,10 @@
var
auth
=
angular
.
module
(
'ulakbus.auth'
,
[
'ngRoute'
,
'schemaForm'
,
'ngCookies'
,
'general'
]);
auth
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
$q
,
$timeout
,
$routeParams
,
Generator
,
LoginService
)
{
$scope
.
url
=
'simple_login'
;
var
form_params
=
{};
form_params
[
'clear_wf'
]
=
1
;
$scope
.
form_params
=
{};
$scope
.
form_params
[
'clear_wf'
]
=
1
;
// todo: change simple login when api ready
Generator
.
get_form
(
$scope
.
url
,
form_params
).
then
(
function
(
data
){
var
d
=
data
.
data
.
forms
;
for
(
var
key
in
d
)
$scope
[
key
]
=
d
[
key
];
// for email validation add asyncvalidator
//$scope.form[0].$asyncValidators = Generator.asyncValidators;
// add submit button to the form todo: move this to form service
//$scope.form.push(
// {
// type: "submit",
// title: "Save"
// }
//);
Generator
.
get_form
(
$scope
).
then
(
function
(
data
){
$scope
.
form
=
[
"*"
,
{
key
:
"password"
,
type
:
"password"
},
...
...
app/components/staff/staff_controller.js
View file @
acb89377
...
...
@@ -18,31 +18,20 @@ var staff = angular.module('ulakbus.staff', ['ngRoute', 'schemaForm', 'formServi
staff
.
controller
(
'StaffAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
var
form_params
=
{};
$scope
.
form_params
=
{};
if
(
$routeParams
.
id
)
{
form_params
[
'object_id'
]
=
$routeParams
.
id
;
form_params
[
'cmd'
]
=
'edit_object'
;
$scope
.
form_params
[
'object_id'
]
=
$routeParams
.
id
;
$scope
.
form_params
[
'cmd'
]
=
'edit_object'
;
}
else
{
form_params
[
'cmd'
]
=
'add_object'
;
$scope
.
form_params
[
'cmd'
]
=
'add_object'
;
}
// to start in certain part of the workflow use clear_wf=1
form_params
[
'clear_wf'
]
=
1
;
$scope
.
form_params
[
'clear_wf'
]
=
1
;
// get form with generator
Generator
.
get_form
(
$scope
);
Generator
.
get_form
(
$scope
.
url
,
form_params
).
then
(
function
(
object
)
{
var
d
=
object
.
data
.
forms
;
// add form, schema and model to scope object
for
(
var
key
in
d
)
$scope
[
key
]
=
d
[
key
];
$scope
.
initialModel
=
angular
.
copy
(
$scope
.
model
);
$scope
.
form
.
push
(
{
type
:
"submit"
,
title
:
"Save"
}
);
});
$scope
.
object_id
=
$routeParams
.
id
;
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
...
...
@@ -65,11 +54,12 @@ staff.controller('StaffAddEditCtrl', function ($scope, $rootScope, $location, $h
*/
staff
.
controller
(
'StaffListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
)
{
var
form_params
=
{
"clear_wf"
:
1
};
Generator
.
get_form
(
'personel_duzenle_basitlestirilmis'
,
form_params
)
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
$scope
.
form_params
=
{
"clear_wf"
:
1
};
// call generator's get_list func
Generator
.
get_list
(
$scope
)
.
then
(
function
(
res
)
{
var
data
=
res
.
data
.
employees
;
//debugger;
for
(
var
item
in
data
){
delete
data
[
item
].
data
[
'deleted'
];
delete
data
[
item
].
data
[
'timestamp'
];
...
...
@@ -82,9 +72,10 @@ staff.controller('StaffListCtrl', function ($scope, $rootScope, Generator) {
* Staff Show Controller
*/
staff
.
controller
(
'StaffShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
var
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"clear_wf"
:
1
};
Generator
.
get_form
(
'personel_duzenle_basitlestirilmis'
,
form_params
).
then
(
function
(
res
)
{
// todo: get this line below more clear way
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"clear_wf"
:
1
};
// call generator's get_single_itemfunc
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
$scope
.
staff
=
res
.
data
.
employees
[
0
].
data
;
})
});
\ No newline at end of file
app/index.html
View file @
acb89377
...
...
@@ -87,15 +87,11 @@
<script
src=
"bower_components/angular-bootstrap/ui-bootstrap.js"
></script>
<script
src=
"bower_components/angular-bootstrap/ui-bootstrap-tpls.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/angular-sanitize/angular-sanitize.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/angular-sanitize/angular-sanitize.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/tv4/tv4.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/objectpath/lib/ObjectPath.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/angular-schema-form/dist/schema-form.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/angular-schema-form/dist/bootstrap-decorator.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/objectpath/lib/ObjectPath.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/angular-schema-form/dist/schema-form.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/angular-schema-form/dist/bootstrap-decorator.js"
></script>
<!--<script type="text/javascript"-->
<!--src="bower_components/angular-schema-form-datepicker/"></script>-->
<script
type=
"text/javascript"
src=
"bower_components/angular-schema-form-datepicker/bootstrap-datepicker.js"
></script>
...
...
app/shared/templates/add.html
0 → 100644
View file @
acb89377
<div
class=
"col-md-6"
>
<h1>
{{ schema.title }}
</h1>
<form
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
ng-submit=
"onSubmit(formgenerated)"
></form>
</div>
\ No newline at end of file
app/zetalib/forms/form_service.js
View file @
acb89377
...
...
@@ -12,17 +12,44 @@ form_generator.factory('Generator', function ($http, $q, $log, $timeout, RESTURL
generator
.
makeUrl
=
function
(
url
)
{
return
RESTURL
.
url
+
url
;
};
generator
.
generate
=
function
(
modelObject
)
{
return
generator
.
group
(
modelObject
);
generator
.
generate
=
function
(
scope
,
forms
)
{
for
(
var
key
in
forms
)
scope
[
key
]
=
forms
[
key
];
scope
.
initialModel
=
angular
.
copy
(
scope
.
model
);
scope
.
form
.
push
(
{
type
:
"submit"
,
title
:
"Save"
}
);
scope
.
isCollapsed
=
false
;
scope
.
object_id
=
scope
.
form_params
[
'object_id'
];
return
generator
.
group
(
scope
);
};
generator
.
group
=
function
(
form
_items
)
{
return
form
_items
;
generator
.
group
=
function
(
form
Object
)
{
return
form
Object
;
};
generator
.
get_form
=
function
(
url
,
getParams
)
{
generator
.
get_form
=
function
(
scope
)
{
return
$http
.
post
(
generator
.
makeUrl
(
url
),
getParams
)
.
success
(
function
(
res
)
{
return
generator
.
generate
(
res
.
data
);
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
then
(
function
(
res
)
{
return
generator
.
generate
(
scope
,
res
.
data
.
forms
);
// todo: cover all other exceptions (4xx, 5xx)
});
};
generator
.
get_list
=
function
(
scope
)
{
return
$http
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
then
(
function
(
res
)
{
return
res
;
// todo: cover all other exceptions (4xx, 5xx)
});
};
generator
.
get_single_item
=
function
(
scope
)
{
return
$http
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
then
(
function
(
res
)
{
return
res
;
// todo: cover all other exceptions (4xx, 5xx)
});
};
...
...
bower.json
View file @
acb89377
...
...
@@ -11,6 +11,7 @@
"angular-route"
:
"1.3.x"
,
"angular-resource"
:
"1.3.x"
,
"angular-cookies"
:
"1.3.x"
,
"angular-bootstrap"
:
"0.13.1"
,
"bootstrap"
:
"3.3.4"
,
"angular-schema-form"
:
"0.8.3"
,
"angular-schema-form-datepicker"
:
"0.4.0"
,
...
...
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