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
f5640829
Commit
f5640829
authored
Nov 06, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolves #31
parent
fde1e977
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
59 deletions
+78
-59
app.js
app/app.js
+35
-29
main.js
app/main.js
+35
-29
form_service.js
app/zetalib/forms/form_service.js
+8
-1
No files found.
app/app.js
View file @
f5640829
...
@@ -32,39 +32,45 @@ var app = angular.module(
...
@@ -32,39 +32,45 @@ var app = angular.module(
* 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
()
{
// todo: below backendurl definition is for development purpose and will be deleted
// todo: below backendurl definition is for development purpose and will be deleted
var
backendurl
=
"http://api.ulakbus.net/"
;
var
backendurl
=
"http://api.ulakbus.net/"
;
if
(
document
.
cookie
.
indexOf
(
"backendurl"
)
>
-
1
)
{
if
(
document
.
cookie
.
indexOf
(
"backendurl"
)
>
-
1
)
{
var
cookiearray
=
document
.
cookie
.
split
(
';'
);
var
cookiearray
=
document
.
cookie
.
split
(
';'
);
angular
.
forEach
(
cookiearray
,
function
(
item
)
{
angular
.
forEach
(
cookiearray
,
function
(
item
)
{
if
(
item
.
indexOf
(
"backendurl"
)
>
-
1
)
{
if
(
item
.
indexOf
(
"backendurl"
)
>
-
1
)
{
backendurl
=
item
.
split
(
'='
)[
1
];
backendurl
=
item
.
split
(
'='
)[
1
];
}
}
});
});
}
}
if
(
location
.
href
.
indexOf
(
"backendurl"
)
>
-
1
)
{
var
urlfromqstr
=
location
.
href
.
split
(
'?'
)[
1
].
split
(
'='
)[
1
];
backendurl
=
decodeURIComponent
(
urlfromqstr
.
replace
(
/
\+
/g
,
" "
));
document
.
cookie
=
"backendurl="
+
backendurl
;
window
.
location
.
href
=
window
.
location
.
href
.
split
(
'?'
)[
0
];
}
return
{
url
:
backendurl
};
return
{
url
:
backendurl
};
})()).
})()).
/**
/**
* USER_ROLES and AUTH_EVENTS are constant for auth functions
* USER_ROLES and AUTH_EVENTS are constant for auth functions
*/
*/
constant
(
"USER_ROLES"
,
{
constant
(
"USER_ROLES"
,
{
all
:
"*"
,
all
:
"*"
,
admin
:
"admin"
,
admin
:
"admin"
,
student
:
"student"
,
student
:
"student"
,
staff
:
"staff"
,
staff
:
"staff"
,
dean
:
"dean"
dean
:
"dean"
}).
}).
constant
(
'AUTH_EVENTS'
,
{
constant
(
'AUTH_EVENTS'
,
{
loginSuccess
:
'auth-login-success'
,
loginSuccess
:
'auth-login-success'
,
loginFailed
:
'auth-login-failed'
,
loginFailed
:
'auth-login-failed'
,
logoutSuccess
:
'auth-logout-success'
,
logoutSuccess
:
'auth-logout-success'
,
sessionTimeout
:
'auth-session-timeout'
,
sessionTimeout
:
'auth-session-timeout'
,
notAuthenticated
:
'auth-not-authenticated'
,
notAuthenticated
:
'auth-not-authenticated'
,
notAuthorized
:
'auth-not-authorized'
notAuthorized
:
'auth-not-authorized'
});
});
// 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
...
...
app/main.js
View file @
f5640829
...
@@ -37,39 +37,45 @@ var app = angular.module(
...
@@ -37,39 +37,45 @@ var app = angular.module(
* 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
()
{
// todo: below backendurl definition is for development purpose and will be deleted
// todo: below backendurl definition is for development purpose and will be deleted
var
backendurl
=
"http://api.ulakbus.net/"
;
var
backendurl
=
"http://api.ulakbus.net/"
;
if
(
document
.
cookie
.
indexOf
(
"backendurl"
)
>
-
1
)
{
if
(
document
.
cookie
.
indexOf
(
"backendurl"
)
>
-
1
)
{
var
cookiearray
=
document
.
cookie
.
split
(
';'
);
var
cookiearray
=
document
.
cookie
.
split
(
';'
);
angular
.
forEach
(
cookiearray
,
function
(
item
)
{
angular
.
forEach
(
cookiearray
,
function
(
item
)
{
if
(
item
.
indexOf
(
"backendurl"
)
>
-
1
)
{
if
(
item
.
indexOf
(
"backendurl"
)
>
-
1
)
{
backendurl
=
item
.
split
(
'='
)[
1
];
backendurl
=
item
.
split
(
'='
)[
1
];
}
}
});
});
}
}
if
(
location
.
href
.
indexOf
(
"backendurl"
)
>
-
1
)
{
var
urlfromqstr
=
location
.
href
.
split
(
'?'
)[
1
].
split
(
'='
)[
1
];
backendurl
=
decodeURIComponent
(
urlfromqstr
.
replace
(
/
\+
/g
,
" "
));
document
.
cookie
=
"backendurl="
+
backendurl
;
window
.
location
.
href
=
window
.
location
.
href
.
split
(
'?'
)[
0
];
}
return
{
url
:
backendurl
};
return
{
url
:
backendurl
};
})()).
})()).
/**
/**
* USER_ROLES and AUTH_EVENTS are constant for auth functions
* USER_ROLES and AUTH_EVENTS are constant for auth functions
*/
*/
constant
(
"USER_ROLES"
,
{
constant
(
"USER_ROLES"
,
{
all
:
"*"
,
all
:
"*"
,
admin
:
"admin"
,
admin
:
"admin"
,
student
:
"student"
,
student
:
"student"
,
staff
:
"staff"
,
staff
:
"staff"
,
dean
:
"dean"
dean
:
"dean"
}).
}).
constant
(
'AUTH_EVENTS'
,
{
constant
(
'AUTH_EVENTS'
,
{
loginSuccess
:
'auth-login-success'
,
loginSuccess
:
'auth-login-success'
,
loginFailed
:
'auth-login-failed'
,
loginFailed
:
'auth-login-failed'
,
logoutSuccess
:
'auth-logout-success'
,
logoutSuccess
:
'auth-logout-success'
,
sessionTimeout
:
'auth-session-timeout'
,
sessionTimeout
:
'auth-session-timeout'
,
notAuthenticated
:
'auth-not-authenticated'
,
notAuthenticated
:
'auth-not-authenticated'
,
notAuthorized
:
'auth-not-authorized'
notAuthorized
:
'auth-not-authorized'
});
});
// 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
...
...
app/zetalib/forms/form_service.js
View file @
f5640829
...
@@ -66,7 +66,14 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -66,7 +66,14 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
v
.
type
,
type
:
v
.
type
,
title
:
v
.
title
,
title
:
v
.
title
,
onClick
:
function
(){
scope
.
model
[
v
]
=
1
;
generator
.
submit
(
scope
);}
onClick
:
function
(){
if
(
v
.
cmd
)
{
scope
.
model
[
"cmd"
]
=
v
.
cmd
;
}
else
{
scope
.
model
[
k
]
=
1
;
}
generator
.
submit
(
scope
);
}
};
};
}
}
...
...
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