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
c6f2bda3
Commit
c6f2bda3
authored
Aug 19, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/#143/Formsets'
parents
5804a4a9
92c1269e
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
78 additions
and
62 deletions
+78
-62
app.js
app/app.js
+27
-6
auth_controller.js
app/components/auth/auth_controller.js
+3
-15
staff_controller.js
app/components/staff/staff_controller.js
+18
-27
index.html
app/index.html
+6
-11
add.html
app/shared/templates/add.html
+5
-0
fieldset.html
app/shared/templates/fieldset.html
+9
-0
listnodeModalContent.html
app/shared/templates/listnodeModalContent.html
+7
-0
modalContent.html
app/shared/templates/modalContent.html
+0
-0
form_service.js
app/zetalib/forms/form_service.js
+1
-1
bower.json
bower.json
+1
-0
index.html
index.html
+0
-1
package.json
package.json
+1
-1
No files found.
app/app.js
View file @
c6f2bda3
...
@@ -20,14 +20,14 @@ var app = angular.module(
...
@@ -20,14 +20,14 @@ var app = angular.module(
'ulakbus.student'
,
'ulakbus.student'
,
'schemaForm'
,
'schemaForm'
,
'gettext'
,
'gettext'
,
'templates-prod'
//
'templates-prod'
]).
]).
/**
/**
* RESTURL is the url of rest api to talk
* RESTURL is the url of rest api to talk
* Based on the environment it changes from dev to prod
* Based on the environment it changes from dev to prod
*/
*/
constant
(
"RESTURL"
,
(
function
()
{
constant
(
"RESTURL"
,
(
function
()
{
return
{
url
:
"http://"
+
window
.
location
.
hostname
+
":9001/"
};
return
{
url
:
"http://"
+
window
.
location
.
hostname
+
":9001/"
};
})()).
})()).
/**
/**
* USER_ROLES and AUTH_EVENTS are constant for auth functions
* USER_ROLES and AUTH_EVENTS are constant for auth functions
...
@@ -77,11 +77,11 @@ var app = angular.module(
...
@@ -77,11 +77,11 @@ var app = angular.module(
/**
/**
* logout directive
* logout directive
*/
*/
directive
(
'logout'
,
function
(
$http
,
$location
)
{
directive
(
'logout'
,
function
(
$http
,
$location
)
{
return
{
return
{
link
:
function
(
$scope
,
$element
,
$rootScope
)
{
link
:
function
(
$scope
,
$element
,
$rootScope
)
{
$element
.
on
(
'click'
,
function
()
{
$element
.
on
(
'click'
,
function
()
{
$http
.
post
(
'http://'
+
window
.
location
.
hostname
+
':9001/logout'
,
{}).
then
(
function
()
{
$http
.
post
(
'http://'
+
window
.
location
.
hostname
+
':9001/logout'
,
{}).
then
(
function
()
{
$rootScope
.
loggedInUser
=
false
;
$rootScope
.
loggedInUser
=
false
;
console
.
log
(
$rootScope
.
loggedInUser
);
console
.
log
(
$rootScope
.
loggedInUser
);
$location
.
path
(
"/login"
);
$location
.
path
(
"/login"
);
...
@@ -92,6 +92,27 @@ var app = angular.module(
...
@@ -92,6 +92,27 @@ var app = angular.module(
}
}
});
});
/**
* listnode add directive
*/
//directive('addlistnode', function () {
// return {
// link: function ($scope, $modal, $element) {
// debugger;
//$element.on('click', function () {
// var nodename = $element[0].firstElementChild.innerHTML;
// var newitem = angular.copy($scope.listnodeform[nodename+'_1']);
// console.log($scope.form);
// $scope.form.splice(7, 0, newitem);
// console.log($scope.form);
// $scope.$broadcast('schemaFormRedraw');
// $scope.$apply();
//});
// }
// }
//});
// test the code with strict di mode to see if it works when minified
// test the code with strict di mode to see if it works when minified
//angular.bootstrap(document, ['ulakbus'], {
//angular.bootstrap(document, ['ulakbus'], {
// strictDi: true
// strictDi: true
...
...
app/components/auth/auth_controller.js
View file @
c6f2bda3
...
@@ -10,22 +10,10 @@
...
@@ -10,22 +10,10 @@
var
auth
=
angular
.
module
(
'ulakbus.auth'
,
[
'ngRoute'
,
'schemaForm'
,
'ngCookies'
,
'general'
]);
var
auth
=
angular
.
module
(
'ulakbus.auth'
,
[
'ngRoute'
,
'schemaForm'
,
'ngCookies'
,
'general'
]);
auth
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
$q
,
$timeout
,
$routeParams
,
Generator
,
LoginService
)
{
auth
.
controller
(
'LoginCtrl'
,
function
(
$scope
,
$q
,
$timeout
,
$routeParams
,
Generator
,
LoginService
)
{
$scope
.
url
=
'simple_login'
;
$scope
.
url
=
'simple_login'
;
var
form_params
=
{};
$scope
.
form_params
=
{};
form_params
[
'clear_wf'
]
=
1
;
$scope
.
form_params
[
'clear_wf'
]
=
1
;
// todo: change simple login when api ready
// todo: change simple login when api ready
Generator
.
get_form
(
$scope
.
url
,
form_params
).
then
(
function
(
data
){
Generator
.
get_form
(
$scope
).
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"
// }
//);
$scope
.
form
=
[
$scope
.
form
=
[
"*"
,
"*"
,
{
key
:
"password"
,
type
:
"password"
},
{
key
:
"password"
,
type
:
"password"
},
...
...
app/components/staff/staff_controller.js
View file @
c6f2bda3
...
@@ -16,33 +16,22 @@ var staff = angular.module('ulakbus.staff', ['ngRoute', 'schemaForm', 'formServi
...
@@ -16,33 +16,22 @@ var staff = angular.module('ulakbus.staff', ['ngRoute', 'schemaForm', 'formServi
* which provide a form with form generator.
* which provide a form with form generator.
*/
*/
staff
.
controller
(
'StaffAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
Generator
,
$routeParams
)
{
staff
.
controller
(
'StaffAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
var
form_params
=
{};
$scope
.
form_params
=
{};
if
(
$routeParams
.
id
)
{
if
(
$routeParams
.
id
)
{
form_params
[
'object_id'
]
=
$routeParams
.
id
;
$scope
.
form_params
[
'object_id'
]
=
$routeParams
.
id
;
form_params
[
'cmd'
]
=
'edit_object'
;
$scope
.
form_params
[
'cmd'
]
=
'edit_object'
;
}
}
else
{
else
{
form_params
[
'cmd'
]
=
'add_object'
;
$scope
.
form_params
[
'cmd'
]
=
'add_object'
;
}
}
// to start in certain part of the workflow use clear_wf=1
// 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
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
if
(
form
.
$valid
)
{
...
@@ -54,7 +43,7 @@ staff.controller('StaffAddEditCtrl', function ($scope, $rootScope, $location, $h
...
@@ -54,7 +43,7 @@ staff.controller('StaffAddEditCtrl', function ($scope, $rootScope, $location, $h
$scope
.
message
=
data
.
title
;
$scope
.
message
=
data
.
title
;
});
});
}
}
}
}
;
});
});
// todo: for single point of failure code a "get item" service and use it to
// todo: for single point of failure code a "get item" service and use it to
...
@@ -65,11 +54,12 @@ staff.controller('StaffAddEditCtrl', function ($scope, $rootScope, $location, $h
...
@@ -65,11 +54,12 @@ staff.controller('StaffAddEditCtrl', function ($scope, $rootScope, $location, $h
*/
*/
staff
.
controller
(
'StaffListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
)
{
staff
.
controller
(
'StaffListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
)
{
var
form_params
=
{
"clear_wf"
:
1
};
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
Generator
.
get_form
(
'personel_duzenle_basitlestirilmis'
,
form_params
)
$scope
.
form_params
=
{
"clear_wf"
:
1
};
// call generator's get_list func
Generator
.
get_list
(
$scope
)
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
var
data
=
res
.
data
.
employees
;
var
data
=
res
.
data
.
employees
;
//debugger;
for
(
var
item
in
data
){
for
(
var
item
in
data
){
delete
data
[
item
].
data
[
'deleted'
];
delete
data
[
item
].
data
[
'deleted'
];
delete
data
[
item
].
data
[
'timestamp'
];
delete
data
[
item
].
data
[
'timestamp'
];
...
@@ -82,9 +72,10 @@ staff.controller('StaffListCtrl', function ($scope, $rootScope, Generator) {
...
@@ -82,9 +72,10 @@ staff.controller('StaffListCtrl', function ($scope, $rootScope, Generator) {
* Staff Show Controller
* Staff Show Controller
*/
*/
staff
.
controller
(
'StaffShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
staff
.
controller
(
'StaffShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
var
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"clear_wf"
:
1
};
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
Generator
.
get_form
(
'personel_duzenle_basitlestirilmis'
,
form_params
).
then
(
function
(
res
)
{
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"clear_wf"
:
1
};
// todo: get this line below more clear way
// call generator's get_single_itemfunc
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
$scope
.
staff
=
res
.
data
.
employees
[
0
].
data
;
$scope
.
staff
=
res
.
data
.
employees
[
0
].
data
;
})
})
});
});
\ No newline at end of file
app/index.html
View file @
c6f2bda3
...
@@ -87,18 +87,14 @@
...
@@ -87,18 +87,14 @@
<script
src=
"bower_components/angular-bootstrap/ui-bootstrap.js"
></script>
<script
src=
"bower_components/angular-bootstrap/ui-bootstrap.js"
></script>
<script
src=
"bower_components/angular-bootstrap/ui-bootstrap-tpls.js"
></script>
<script
src=
"bower_components/angular-bootstrap/ui-bootstrap-tpls.js"
></script>
<script
type=
"text/javascript"
<script
src=
"bower_components/angular-sanitize/angular-sanitize.js"
></script>
src=
"bower_components/angular-sanitize/angular-sanitize.js"
></script>
<script
src=
"bower_components/tv4/tv4.js"
></script>
<script
type=
"text/javascript"
src=
"bower_components/tv4/tv4.js"
></script>
<script
src=
"bower_components/objectpath/lib/ObjectPath.js"
></script>
<script
type=
"text/javascript"
<script
src=
"bower_components/angular-schema-form/dist/schema-form.js"
></script>
src=
"bower_components/objectpath/lib/ObjectPath.js"
></script>
<script
src=
"bower_components/angular-schema-form/dist/bootstrap-decorator.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"-->
<!--<script type="text/javascript"-->
<!--src="bower_components/angular-schema-form-datepicker/"></script>-->
<!--src="bower_components/angular-schema-form-datepicker/"></script>-->
<script
type=
"text/javascript"
src=
"bower_components/angular-schema-form-datepicker/bootstrap-datepicker.js"
></script>
<script
src=
"bower_components/angular-schema-form-datepicker/bootstrap-datepicker.js"
></script>
<script
src=
"bower_components/angular-gettext/dist/angular-gettext.min.js"
></script>
<script
src=
"bower_components/angular-gettext/dist/angular-gettext.min.js"
></script>
<script
src=
"shared/translations.js"
></script>
<script
src=
"shared/translations.js"
></script>
...
@@ -115,7 +111,6 @@
...
@@ -115,7 +111,6 @@
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/staff/staff_controller.js"
></script>
<script
src=
"components/staff/staff_controller.js"
></script>
<script
src=
"components/student/student_controller.js"
></script>
<script
src=
"components/student/student_controller.js"
></script>
<script
src=
"components/dashboard/dashboard.js"
></script>
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
</body>
</body>
...
...
app/shared/templates/add.html
0 → 100644
View file @
c6f2bda3
<div
class=
"col-md-12"
>
<h1>
{{ schema.title }}
</h1>
<button
type=
"button"
ng-repeat=
"node in listnodes"
ng-click=
"openmodal(node)"
>
Add
<span>
{{node}}
</span></button>
<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/shared/templates/fieldset.html
0 → 100644
View file @
c6f2bda3
<fieldset
ng-disabled=
"form.readonly"
class=
"schema-form-fieldset {{form.htmlClass}}"
>
<legend
ng-class=
"{'sr-only': !showTitle() }"
>
<span
ng-click=
"isCollapsed = !isCollapsed"
>
{{ form.title }}
</span>
</legend>
<div
collapse=
"isCollapsed"
name=
"{{form.title}}"
>
<div
class=
"help-block"
ng-show=
"form.description"
ng-bind-html=
"form.description"
></div>
<sf-decorator
class=
"col-md-4"
ng-repeat=
"item in form.items"
ng-if=
"item.name!='idx'"
form=
"item"
></sf-decorator>
</div>
</fieldset>
app/shared/templates/listnodeModalContent.html
0 → 100644
View file @
c6f2bda3
<div
class=
"modal-body"
>
<form
name=
"listnodeform"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
></form>
</div>
<div
class=
"modal-footer"
>
<button
type=
"submit"
class=
"btn btn-primary"
ng-click=
"onSubmit(listnodeform)"
>
OK
</button>
<button
type=
"button"
class=
"btn btn-warning"
ng-click=
"cancel()"
>
Cancel
</button>
</div>
\ No newline at end of file
app/shared/templates/modalContent.html
0 → 100644
View file @
c6f2bda3
app/zetalib/forms/form_service.js
View file @
c6f2bda3
...
@@ -25,7 +25,7 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
...
@@ -25,7 +25,7 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
);
);
// if fieldset in form, make it collapsable with template
// if fieldset in form, make it collapsable with template
scope
.
listnodeform
=
{};
scope
.
listnodeform
=
{};
if
((
scope
.
listnode
&&
scope
.
listnodes
[
0
])
||
(
scope
.
listnode
&&
scope
.
nodes
[
0
]))
{
if
((
scope
.
listnode
&&
scope
.
listnodes
[
0
])
||
(
scope
.
nodes
&&
scope
.
nodes
[
0
]))
{
angular
.
forEach
(
scope
.
form
,
function
(
key
,
val
)
{
angular
.
forEach
(
scope
.
form
,
function
(
key
,
val
)
{
if
(
typeof
key
==
"object"
&&
key
.
type
==
"fieldset"
)
{
if
(
typeof
key
==
"object"
&&
key
.
type
==
"fieldset"
)
{
// change type to use shared template for form
// change type to use shared template for form
...
...
bower.json
View file @
c6f2bda3
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
"angular-route"
:
"1.3.x"
,
"angular-route"
:
"1.3.x"
,
"angular-resource"
:
"1.3.x"
,
"angular-resource"
:
"1.3.x"
,
"angular-cookies"
:
"1.3.x"
,
"angular-cookies"
:
"1.3.x"
,
"angular-bootstrap"
:
"0.13.1"
,
"bootstrap"
:
"3.3.4"
,
"bootstrap"
:
"3.3.4"
,
"angular-schema-form"
:
"0.8.3"
,
"angular-schema-form"
:
"0.8.3"
,
"angular-schema-form-datepicker"
:
"0.4.0"
,
"angular-schema-form-datepicker"
:
"0.4.0"
,
...
...
index.html
View file @
c6f2bda3
...
@@ -118,7 +118,6 @@
...
@@ -118,7 +118,6 @@
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/staff/staff_controller.js"
></script>
<script
src=
"components/staff/staff_controller.js"
></script>
<script
src=
"components/student/student_controller.js"
></script>
<script
src=
"components/student/student_controller.js"
></script>
<script
src=
"components/dashboard/dashboard.js"
></script>
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
<!--<script src="bower_components/quantumui/dist/js/quantumui-nojq.js"></script>-->
<!-- @endif -->
<!-- @endif -->
...
...
package.json
View file @
c6f2bda3
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
"scripts"
:
{
"scripts"
:
{
"postinstall"
:
"bower install"
,
"postinstall"
:
"bower install"
,
"prestart"
:
"npm install"
,
"prestart"
:
"npm install"
,
"start"
:
"http-server -a localhost -p 8000 -c-1"
,
"start"
:
"http-server
app/
-a localhost -p 8000 -c-1"
,
"pretest"
:
"npm install"
,
"pretest"
:
"npm install"
,
"test"
:
"karma start karma.conf.js"
,
"test"
:
"karma start karma.conf.js"
,
"test-single-run"
:
"karma start karma.conf.js --single-run"
,
"test-single-run"
:
"karma start karma.conf.js --single-run"
,
...
...
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