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
bae33140
Commit
bae33140
authored
Jun 30, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement student functions for staff,
add routes, change fake api server
parent
ca6e98f8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
292 additions
and
57 deletions
+292
-57
app_routes.js
app/app_routes.js
+44
-20
staff_add_template.html
app/components/staff/staff_add_template.html
+7
-0
staff_controller.js
app/components/staff/staff_controller.js
+36
-0
types_controller.js
app/components/types/types_controller.js
+39
-0
types_template.html
app/components/types/types_template.html
+6
-0
index.html
app/index.html
+3
-15
fake_rest_server.js
fake_rest_server.js
+157
-22
No files found.
app/app_routes.js
View file @
bae33140
...
...
@@ -21,7 +21,7 @@ app.config(['$routeProvider', function ($routeProvider) {
}]
}
})
.
when
(
'/s/add'
,
{
.
when
(
'/s
tudent
/add'
,
{
templateUrl
:
'components/student/student_add_template.html'
,
controller
:
'StudentAddEditCtrl'
,
resolve
:
{
...
...
@@ -36,7 +36,7 @@ app.config(['$routeProvider', function ($routeProvider) {
}]
}
})
.
when
(
'/s/edit/:id'
,
{
.
when
(
'/s
tudent
/edit/:id'
,
{
templateUrl
:
'components/student/student_add_template.html'
,
controller
:
'StudentAddEditCtrl'
,
resolve
:
{
...
...
@@ -66,25 +66,49 @@ app.config(['$routeProvider', function ($routeProvider) {
}]
}
})
.
when
(
'/staff/add'
,
{
templateUrl
:
'components/staff/staff_add_template.html'
,
controller
:
'StaffCtrl'
,
resolve
:
{
loadMyCtrl
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
return
$ocLazyLoad
.
load
(
'components/staff/staff_controller.js'
);
}],
loadMyService
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
return
$ocLazyLoad
.
load
(
'zetalib/forms/form_service.js'
);
}]
}
})
.
when
(
'/input_types'
,
{
templateUrl
:
'components/types/types_template.html'
,
controller
:
'TypeCtrl'
,
resolve
:
{
loadMyCtrl
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
return
$ocLazyLoad
.
load
(
'components/types/types_controller.js'
);
}],
loadMyService
:
[
'$ocLazyLoad'
,
function
(
$ocLazyLoad
)
{
return
$ocLazyLoad
.
load
(
'zetalib/forms/form_service.js'
);
}]
}
})
.
otherwise
({
redirectTo
:
'/dashboard'
});
}]).
run
(
function
(
$rootScope
,
$location
,
$cookies
)
{
/**
* todo: below session id is temporary session_id
* the login logic will be finished when backend complete
*
*/
/**
* todo: below session id is temporary session_id
* the login logic will be finished when backend complete
*
*/
var
sessionId
=
$cookies
.
get
(
'session'
);
$rootScope
.
loggedInUser
=
sessionId
?
true
:
false
;
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
)
{
if
(
$rootScope
.
loggedInUser
==
null
)
{
// no logged user, redirect to /login
if
(
next
.
templateUrl
===
"login/login.html"
)
{
console
.
log
(
"test log to login"
);
}
else
{
console
.
log
(
"test log logged"
);
$location
.
path
(
"/login"
);
}
var
sessionId
=
$cookies
.
get
(
'session'
);
$rootScope
.
loggedInUser
=
sessionId
?
true
:
false
;
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
)
{
if
(
$rootScope
.
loggedInUser
==
null
)
{
// no logged user, redirect to /login
if
(
next
.
templateUrl
===
"login/login.html"
)
{
console
.
log
(
"test log to login"
);
}
else
{
console
.
log
(
"test log logged"
);
$location
.
path
(
"/login"
);
}
});
});
\ No newline at end of file
}
});
});
\ No newline at end of file
app/components/staff/staff_add_template.html
0 → 100644
View file @
bae33140
<div
ng-app=
"zaerp.staff.add"
>
<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>
</div>
\ No newline at end of file
app/components/staff/staff_controller.js
0 → 100644
View file @
bae33140
/**
* Created by erkanderon on 18.06.2015.
*/
'use strict'
;
var
staff
=
angular
.
module
(
'zaerp.staff.add'
,[
'ngRoute'
,
'schemaForm'
,
'formService'
]);
/* StaffCtrl is a controller
which provide a form with form generator.
*/
staff
.
controller
(
'StaffCtrl'
,
function
(
$scope
,
$http
,
$log
,
Generator
,
$routeParams
){
Generator
.
get_form
(
'add_staff'
,
$routeParams
).
then
(
function
(
d
){
$scope
.
schema
=
d
.
schema
;
$scope
.
form
=
d
.
form
;
$scope
.
model
=
d
.
model
?
d
.
model
:
{};
$scope
.
form
[
0
].
$asyncValidators
=
Generator
.
asyncValidators
;
$scope
.
form
.
push
(
{
type
:
"submit"
,
title
:
"Save"
}
);
});
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
// todo: implement form diff here
$log
.
info
(
$scope
);
}
}
});
\ No newline at end of file
app/components/types/types_controller.js
0 → 100644
View file @
bae33140
/**
* Created by erkanderon on 19.06.2015.
*/
'use strict'
;
var
staff
=
angular
.
module
(
'zaerp.types'
,[
'ngRoute'
,
'schemaForm'
,
'formService'
]);
staff
.
controller
(
'TypeCtrl'
,
function
(
$scope
,
$http
,
$log
,
Generator
,
$routeParams
){
Generator
.
get_form
(
'input_types'
,
$routeParams
).
then
(
function
(
d
){
$scope
.
congressFilter
=
"Choice"
;
$scope
.
schema
=
d
.
schema
;
$scope
.
form
=
d
.
form
;
// model is the init data of the form or in edit templates
$scope
.
model
=
{};
// 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
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
// todo: implement form diff here
$log
.
info
(
$scope
);
}
}
});
\ No newline at end of file
app/components/types/types_template.html
0 → 100644
View file @
bae33140
<div
ng-app=
"zaerp.types"
>
<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>
</div>
\ No newline at end of file
app/index.html
View file @
bae33140
...
...
@@ -51,21 +51,9 @@
<div
class=
"col-sm-3 col-md-2 sidebar"
>
<ul
class=
"nav nav-sidebar"
>
<li
class=
"active"
><a
href=
"#"
>
Overview
<span
class=
"sr-only"
>
(current)
</span></a></li>
<li><a
href=
"#/student_add"
>
New Student
</a></li>
<li><a
href=
"#"
>
Analytics
</a></li>
<li><a
href=
"#"
>
Export
</a></li>
</ul>
<ul
class=
"nav nav-sidebar"
>
<li><a
href=
""
>
Nav item
</a></li>
<li><a
href=
""
>
Nav item again
</a></li>
<li><a
href=
""
>
One more nav
</a></li>
<li><a
href=
""
>
Another nav item
</a></li>
<li><a
href=
""
>
More navigation
</a></li>
</ul>
<ul
class=
"nav nav-sidebar"
>
<li><a
href=
""
>
Nav item again
</a></li>
<li><a
href=
""
>
One more nav
</a></li>
<li><a
href=
""
>
Another nav item
</a></li>
<li><a
href=
"#/student/add"
>
New Student
</a></li>
<li><a
href=
"#/staff/add"
>
New Staff
</a></li>
<li><a
href=
"#/input_types"
>
Types
</a></li>
</ul>
</div>
...
...
fake_rest_server.js
View file @
bae33140
...
...
@@ -43,48 +43,183 @@ var form = new fake.Resource("add_student")
}
});
var
form2
=
new
fake
.
Resource
(
"add_staff"
)
.
add
({
schema
:
{
title
:
"Add Staff"
,
type
:
"object"
,
properties
:
{
name
:
{
type
:
"string"
,
title
:
"Name"
},
email
:
{
type
:
"email"
,
title
:
"Email"
}
},
required
:
[
"email"
,
"name"
]
},
form
:
[
{
key
:
"email"
,
type
:
"email"
,
validationMessages
:
{
'emailNotValid'
:
'Email is not valid!'
}
},
"name"
]
});
var
student
=
new
fake
.
Resource
(
"list_student"
)
.
add
({
'deleted'
:
false
,
.
add
({
'deleted'
:
false
,
'archived'
:
false
,
'auth_info'
:
{
'email'
:
'suuper@suup.com'
,
'auth_info'
:
{
'email'
:
'suuper@suup.com'
,
'password'
:
'123'
,
'username'
:
'foo_user'
},
'username'
:
'foo_user'
},
'bio'
:
'Lorem impsum dolar sit amet falan filan'
,
'join_date'
:
'2015-05-16T00:00:00Z'
,
'lectures'
:
[{
'attendance'
:
[{
'attended'
:
false
,
'date'
:
'2015-05-09T00:00:00Z'
,
'hour'
:
2
},
{
'attended'
:
true
,
'date'
:
'2015-05-10T00:00:00Z'
,
'hour'
:
4
}],
'lectures'
:
[{
'attendance'
:
[{
'attended'
:
false
,
'date'
:
'2015-05-09T00:00:00Z'
,
'hour'
:
2
},
{
'attended'
:
true
,
'date'
:
'2015-05-10T00:00:00Z'
,
'hour'
:
4
}],
'code'
:
'math101'
,
'credit'
:
4
,
'exams'
:
[
{
'date'
:
'2015-05-11T00:00:00Z'
,
'point'
:
65
,
'type'
:
'Q'
}],
{
'date'
:
'2015-05-11T00:00:00Z'
,
'point'
:
65
,
'type'
:
'Q'
}],
'name'
:
'Introduction to Math'
,
'node_in_list_node'
:
{
'foo'
:
'FOOOO'
}},
{
'attendance'
:
[{
'attended'
:
false
,
'date'
:
'2015-05-13T00:00:00Z'
,
'hour'
:
2
},
{
'attended'
:
true
,
'date'
:
'2015-05-14T00:00:00Z'
,
'hour'
:
4
}],
'node_in_list_node'
:
{
'foo'
:
'FOOOO'
}
},
{
'attendance'
:
[{
'attended'
:
false
,
'date'
:
'2015-05-13T00:00:00Z'
,
'hour'
:
2
},
{
'attended'
:
true
,
'date'
:
'2015-05-14T00:00:00Z'
,
'hour'
:
4
}],
'code'
:
'rock101'
,
'credit'
:
10
,
'exams'
:
[
{
'date'
:
'2015-05-15T00:00:00Z'
,
'point'
:
65
,
'type'
:
'Q'
}],
{
'date'
:
'2015-05-15T00:00:00Z'
,
'point'
:
65
,
'type'
:
'Q'
}],
'name'
:
'Introduction to Rocking'
,
'node_in_list_node'
:
{
'foo'
:
'FOOOO'
}}],
'node_in_list_node'
:
{
'foo'
:
'FOOOO'
}
}],
'name'
:
'Jack'
,
'number'
:
'20300344'
,
'pno'
:
'2343243433'
,
'surname'
:
'Black'
,
'timestamp'
:
null
});
'timestamp'
:
null
});
var
types
=
new
fake
.
Resource
(
"input_types"
)
.
add
({
schema
:
{
title
:
"Input Types"
,
type
:
"object"
,
properties
:
{
name
:
{
type
:
"string"
,
title
:
"Name"
},
email
:
{
type
:
"email"
,
title
:
"Email"
}
},
required
:
[
"email"
,
"name"
,
"select"
]
},
form
:
[
{
key
:
"email"
,
type
:
"email"
,
validationMessages
:
{
'emailNotValid'
:
'Email is not valid!'
}
},
{
key
:
"comment"
,
type
:
"textarea"
,
placeholder
:
"Make a Comment"
},
{
type
:
"submit"
,
title
:
"OK"
},
{
type
:
"select"
,
titleMap
:
[
{
value
:
"yes"
,
name
:
"Choice 1"
},
{
value
:
"no"
,
name
:
"Choice 2"
}
]
},
{
key
:
"textarea"
,
type
:
"password"
,
title
:
"Password"
},
{
key
:
"choice"
,
type
:
"radiobuttons"
,
titleMap
:
[
{
value
:
"one"
,
name
:
"One"
},
{
value
:
"two"
,
name
:
"More..."
}
]
},
{
key
:
"checkbox"
,
type
:
"checkboxes"
,
"titleMap"
:
[
{
"value"
:
"a"
,
"name"
:
"A"
},
{
"value"
:
"b"
,
"name"
:
"B"
},
{
"value"
:
"c"
,
"name"
:
"C"
}
]
},
"checkbox"
,
"name"
]
});
var
server
=
new
fake
.
Server
()
.
register
(
login
)
.
register
(
form
)
.
register
(
student
)
.
register
(
form2
)
.
register
(
types
)
.
listen
(
3000
);
\ 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