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
f9ce32e4
Commit
f9ce32e4
authored
Sep 18, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v0.0.3.1 login and logout to work properly fixes
parent
30f6961f
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
40 additions
and
43 deletions
+40
-43
app.js
app/app.js
+1
-1
app_routes.js
app/app_routes.js
+2
-14
auth_controller.js
app/components/auth/auth_controller.js
+1
-4
dashboard_controller.js
app/components/dashboard/dashboard_controller.js
+1
-1
index.html
app/index.html
+1
-1
main.html
app/main.html
+3
-3
main.js
app/main.js
+1
-1
directives.js
app/shared/directives.js
+14
-7
header-sub-menu.html
app/shared/templates/directives/header-sub-menu.html
+1
-1
sidebar.html
app/shared/templates/directives/sidebar.html
+1
-1
interceptors.js
app/zetalib/interceptors.js
+8
-3
app.js
dist/app.js
+1
-1
index.html
dist/index.html
+3
-3
templates.js
dist/templates.js
+2
-2
No files found.
app/app.js
View file @
f9ce32e4
...
@@ -36,7 +36,7 @@ var app = angular.module(
...
@@ -36,7 +36,7 @@ var app = angular.module(
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"
)){
if
(
item
.
indexOf
(
"backendurl"
)
>
-
1
){
backendurl
=
item
.
split
(
'='
)[
1
];
backendurl
=
item
.
split
(
'='
)[
1
];
}
}
});
});
...
...
app/app_routes.js
View file @
f9ce32e4
...
@@ -44,22 +44,10 @@ app.config(['$routeProvider', function ($routeProvider) {
...
@@ -44,22 +44,10 @@ app.config(['$routeProvider', function ($routeProvider) {
})
})
.
otherwise
({
redirectTo
:
'/dashboard'
});
.
otherwise
({
redirectTo
:
'/dashboard'
});
}]).
run
(
function
(
$rootScope
,
$location
,
$cookies
)
{
}]).
run
(
function
(
$rootScope
,
$location
,
$cookies
)
{
/**
* todo: below session id is temporary session_id
* the login logic will be finished when backend complete
*
*/
$rootScope
.
loggedInUser
?
$rootScope
.
loggedInUser
:
fals
e
;
$rootScope
.
loggedInUser
=
tru
e
;
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
)
{
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
)
{
//if ($rootScope.loggedInUser == null) {
// will be used when needed
// // no logged user, redirect to /login
// if (next.templateUrl === "login/login.html") {
//
// } else {
// $location.path("/login");
// }
//}
});
});
}).
config
([
'$httpProvider'
,
function
(
$httpProvider
)
{
}).
config
([
'$httpProvider'
,
function
(
$httpProvider
)
{
// to send cookies CORS
// to send cookies CORS
...
...
app/components/auth/auth_controller.js
View file @
f9ce32e4
...
@@ -43,7 +43,7 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, $cook
...
@@ -43,7 +43,7 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, $cook
.
post
(
RESTURL
.
url
+
url
,
credentials
)
.
post
(
RESTURL
.
url
+
url
,
credentials
)
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
//$window.sessionStorage.token = data.token;
//$window.sessionStorage.token = data.token;
$rootScope
.
loggedInUser
=
true
;
//
$rootScope.loggedInUser = true;
})
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
// Erase the token if the user fails to log in
// Erase the token if the user fails to log in
...
@@ -69,13 +69,10 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, $cook
...
@@ -69,13 +69,10 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, $cook
};
};
loginService
.
logout
=
function
()
{
loginService
.
logout
=
function
()
{
console
.
log
(
"logout"
);
$http
.
post
(
RESTURL
.
url
+
'logout'
,
{}).
then
(
function
(){
$http
.
post
(
RESTURL
.
url
+
'logout'
,
{}).
then
(
function
(){
$rootScope
.
loggedInUser
=
false
;
$rootScope
.
loggedInUser
=
false
;
$location
.
path
(
"/login"
);
$location
.
path
(
"/login"
);
});
});
console
.
log
(
"loggedout"
);
};
};
loginService
.
isAuthenticated
=
function
()
{
loginService
.
isAuthenticated
=
function
()
{
...
...
app/components/dashboard/dashboard_controller.js
View file @
f9ce32e4
...
@@ -12,6 +12,6 @@
...
@@ -12,6 +12,6 @@
angular
.
module
(
'ulakbus.dashboard'
,
[
'ngRoute'
])
angular
.
module
(
'ulakbus.dashboard'
,
[
'ngRoute'
])
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$location
)
{
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$location
)
{
if
(
!
$rootScope
.
loggedInUser
){
$location
.
path
(
"/login"
);}
//if(
$rootScope.loggedInUser){$location.path("/login");}
$scope
.
testData
=
"<h1>This is main Dashboard</h1>"
;
$scope
.
testData
=
"<h1>This is main Dashboard</h1>"
;
});
});
\ No newline at end of file
app/index.html
View file @
f9ce32e4
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
</head>
</head>
<body>
<body>
<nav
class=
"navbar navbar-default navbar-static-top"
role=
"navigation"
style=
"margin-bottom: 0"
>
<nav
class=
"navbar navbar-default navbar-static-top"
role=
"navigation"
style=
"margin-bottom: 0"
ng-if=
"$root.loggedInUser"
>
<ul
class=
"header-menu"
>
<ul
class=
"header-menu"
>
<li><a
href=
""
>
Mesajlar
</a></li>
<li><a
href=
""
>
Mesajlar
</a></li>
<li><a
href=
""
>
Görevler
</a></li>
<li><a
href=
""
>
Görevler
</a></li>
...
...
app/main.html
View file @
f9ce32e4
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
</head>
</head>
<body>
<body>
<nav
class=
"navbar navbar-default navbar-static-top"
role=
"navigation"
style=
"margin-bottom: 0"
>
<nav
class=
"navbar navbar-default navbar-static-top"
role=
"navigation"
style=
"margin-bottom: 0"
ng-if=
"$root.loggedInUser"
>
<ul
class=
"header-menu"
>
<ul
class=
"header-menu"
>
<li><a
href=
""
>
Mesajlar
</a></li>
<li><a
href=
""
>
Mesajlar
</a></li>
<li><a
href=
""
>
Görevler
</a></li>
<li><a
href=
""
>
Görevler
</a></li>
...
@@ -115,12 +115,12 @@
...
@@ -115,12 +115,12 @@
<!-- @if NODE_ENV == 'PRODUCTION' -->
<!-- @if NODE_ENV == 'PRODUCTION' -->
<script
src=
"bower_components/jquery.min.js"
></script>
<script
src=
"bower_components/jquery.min.js"
></script>
<script
src=
"
bower_components
/angular.min.js"
></script>
<script
src=
"
http://ajax.googleapis.com/ajax/libs/angularjs/1.3.18
/angular.min.js"
></script>
<script
src=
"bower_components/components.js"
></script>
<script
src=
"bower_components/components.js"
></script>
<script
src=
"shared/translations.js"
></script>
<script
src=
"shared/translations.js"
></script>
<script
src=
"templates.js"
></script>
<script
src=
"templates.js"
></script>
<script
src=
"app.js"
></script>
<script
src=
"app.js"
></script>
<script
src=
"bower_components/theme.js"
></script>
<script
src=
"
dist/
bower_components/theme.js"
></script>
<!-- @endif -->
<!-- @endif -->
</body>
</body>
</html>
</html>
app/main.js
View file @
f9ce32e4
...
@@ -41,7 +41,7 @@ var app = angular.module(
...
@@ -41,7 +41,7 @@ var app = angular.module(
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"
)){
if
(
item
.
indexOf
(
"backendurl"
)
>
-
1
){
backendurl
=
item
.
split
(
'='
)[
1
];
backendurl
=
item
.
split
(
'='
)[
1
];
}
}
});
});
...
...
app/shared/directives.js
View file @
f9ce32e4
...
@@ -16,7 +16,6 @@ app.directive('logout', function ($http, $location, RESTURL) {
...
@@ -16,7 +16,6 @@ app.directive('logout', function ($http, $location, RESTURL) {
$rootScope
.
loggedInUser
=
false
;
$rootScope
.
loggedInUser
=
false
;
console
.
log
(
$rootScope
.
loggedInUser
);
console
.
log
(
$rootScope
.
loggedInUser
);
$location
.
path
(
"/login"
);
$location
.
path
(
"/login"
);
$scope
.
$apply
();
});
});
});
});
}
}
...
@@ -71,12 +70,20 @@ app.directive('sidebar', ['$location', function () {
...
@@ -71,12 +70,20 @@ app.directive('sidebar', ['$location', function () {
restrict
:
'E'
,
restrict
:
'E'
,
replace
:
true
,
replace
:
true
,
scope
:
{},
scope
:
{},
controller
:
function
(
$scope
,
$http
,
RESTURL
)
{
controller
:
function
(
$scope
,
$rootScope
,
$http
,
RESTURL
,
$location
)
{
$http
.
post
(
RESTURL
.
url
+
'crud/'
).
success
(
function
(
data
)
{
$rootScope
.
$watch
(
$scope
.
menuItems
=
data
.
app_models
;
$rootScope
.
loggedInUser
,
function
(){
});
$http
.
post
(
RESTURL
.
url
+
'crud/'
).
success
(
function
(
data
)
{
$scope
.
menuItems
=
data
.
app_models
;
$scope
.
selectedMenu
=
'dashboard'
;
});
}
);
//$http.post(RESTURL.url + 'crud/').success(function (data) {
// $scope.menuItems = data.app_models;
//});
$scope
.
selectedMenu
=
$location
.
path
();
$scope
.
collapseVar
=
0
;
$scope
.
collapseVar
=
0
;
$scope
.
multiCollapseVar
=
0
;
$scope
.
multiCollapseVar
=
0
;
...
...
app/shared/templates/directives/header-sub-menu.html
View file @
f9ce32e4
<div
class=
"manager-view-header container-fluid"
>
<div
class=
"manager-view-header container-fluid"
ng-class=
"{hidden: $root.loggedInUser != true}"
>
<header-breadcrumb></header-breadcrumb>
<header-breadcrumb></header-breadcrumb>
<div
id=
"header-buttons"
>
<div
id=
"header-buttons"
>
<button
type=
"button"
class=
"btn btn-primary"
ng-click=
"triggerSubmit()"
>
Kaydet
</button>
<button
type=
"button"
class=
"btn btn-primary"
ng-click=
"triggerSubmit()"
>
Kaydet
</button>
...
...
app/shared/templates/directives/sidebar.html
View file @
f9ce32e4
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"brand"
>
<div
class=
"brand"
>
<a
href=
""
class=
"logo"
><img
src=
"/img/brand-logo.png"
/></a>
<a
href=
""
class=
"logo"
><img
src=
"/img/brand-logo.png"
/></a>
</div>
</div>
<ul
class=
"nav in sidebarscroll"
id=
"side-menu"
>
<ul
class=
"nav in sidebarscroll"
id=
"side-menu"
ng-class=
"{hidden: $root.loggedInUser != true}"
>
<!--<sidebar-search></sidebar-search>-->
<!--<sidebar-search></sidebar-search>-->
<li
ui-sref-active=
"active"
>
<li
ui-sref-active=
"active"
>
<a
href=
"#/dashboard"
><i
class=
"fa fa-dashboard fa-fw"
></i>
Panel
</a>
<a
href=
"#/dashboard"
><i
class=
"fa fa-dashboard fa-fw"
></i>
Panel
</a>
...
...
app/zetalib/interceptors.js
View file @
f9ce32e4
...
@@ -24,13 +24,18 @@ app.config(['$httpProvider', function ($httpProvider) {
...
@@ -24,13 +24,18 @@ app.config(['$httpProvider', function ($httpProvider) {
},
},
'response'
:
function
(
response
)
{
'response'
:
function
(
response
)
{
//Will only be called for HTTP up to 300
//Will only be called for HTTP up to 300
if
(
response
.
data
.
is_login
===
true
){
if
(
response
.
data
.
is_login
==
false
){
$rootScope
.
loggedInUser
=
response
.
data
.
is_login
;
$rootScope
.
loggedInUser
=
response
.
data
.
is_login
;
//$location.replace();
$location
.
path
(
"/login"
);
}
if
(
response
.
data
.
is_login
==
true
){
$rootScope
.
loggedInUser
=
true
;
if
(
$location
.
path
()
===
"/login"
){
if
(
$location
.
path
()
===
"/login"
){
$location
.
path
(
"/dashboard"
);
$location
.
path
(
"/dashboard"
);
}
}
}
}
if
(
response
.
data
.
client_cmd
)
{
if
(
response
.
data
.
client_cmd
)
{
//$location.path(response.data.screen);
//$location.path(response.data.screen);
console
.
log
(
response
.
data
.
client_cmd
);
console
.
log
(
response
.
data
.
client_cmd
);
...
@@ -43,7 +48,7 @@ app.config(['$httpProvider', function ($httpProvider) {
...
@@ -43,7 +48,7 @@ app.config(['$httpProvider', function ($httpProvider) {
$location
.
reload
();
$location
.
reload
();
}
}
if
(
rejection
.
status
===
401
)
{
if
(
rejection
.
status
===
401
)
{
$rootScope
.
loggedInUser
=
false
;
//
$rootScope.loggedInUser = false;
if
(
$location
.
path
()
===
"/login"
){
if
(
$location
.
path
()
===
"/login"
){
console
.
log
(
"show errors on login form"
);
console
.
log
(
"show errors on login form"
);
}
else
{
}
else
{
...
...
dist/app.js
View file @
f9ce32e4
This diff is collapsed.
Click to expand it.
dist/index.html
View file @
f9ce32e4
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
</head>
</head>
<body>
<body>
<nav
class=
"navbar navbar-default navbar-static-top"
role=
"navigation"
style=
"margin-bottom: 0"
>
<nav
class=
"navbar navbar-default navbar-static-top"
role=
"navigation"
style=
"margin-bottom: 0"
ng-if=
"$root.loggedInUser"
>
<ul
class=
"header-menu"
>
<ul
class=
"header-menu"
>
<li><a
href=
""
>
Mesajlar
</a></li>
<li><a
href=
""
>
Mesajlar
</a></li>
<li><a
href=
""
>
Görevler
</a></li>
<li><a
href=
""
>
Görevler
</a></li>
...
@@ -59,11 +59,11 @@
...
@@ -59,11 +59,11 @@
<script
src=
"bower_components/jquery.min.js"
></script>
<script
src=
"bower_components/jquery.min.js"
></script>
<script
src=
"
bower_components
/angular.min.js"
></script>
<script
src=
"
http://ajax.googleapis.com/ajax/libs/angularjs/1.3.18
/angular.min.js"
></script>
<script
src=
"bower_components/components.js"
></script>
<script
src=
"bower_components/components.js"
></script>
<script
src=
"shared/translations.js"
></script>
<script
src=
"shared/translations.js"
></script>
<script
src=
"templates.js"
></script>
<script
src=
"templates.js"
></script>
<script
src=
"app.js"
></script>
<script
src=
"app.js"
></script>
<script
src=
"bower_components/theme.js"
></script>
<script
src=
"
dist/
bower_components/theme.js"
></script>
</body>
</body>
</html>
</html>
dist/templates.js
View file @
f9ce32e4
...
@@ -925,7 +925,7 @@ angular.module("shared/templates/directives/header-notification.html", []).run([
...
@@ -925,7 +925,7 @@ angular.module("shared/templates/directives/header-notification.html", []).run([
angular
.
module
(
"shared/templates/directives/header-sub-menu.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
angular
.
module
(
"shared/templates/directives/header-sub-menu.html"
,
[]).
run
([
"$templateCache"
,
function
(
$templateCache
)
{
$templateCache
.
put
(
"shared/templates/directives/header-sub-menu.html"
,
$templateCache
.
put
(
"shared/templates/directives/header-sub-menu.html"
,
"<div class=
\"
manager-view-header container-fluid
\"
>
\n
"
+
"<div class=
\"
manager-view-header container-fluid
\"
ng-class=
\"
{hidden: $root.loggedInUser != true}
\"
>
\n
"
+
" <header-breadcrumb></header-breadcrumb>
\n
"
+
" <header-breadcrumb></header-breadcrumb>
\n
"
+
" <div id=
\"
header-buttons
\"
>
\n
"
+
" <div id=
\"
header-buttons
\"
>
\n
"
+
" <button type=
\"
button
\"
class=
\"
btn btn-primary
\"
ng-click=
\"
triggerSubmit()
\"
>Kaydet</button>
\n
"
+
" <button type=
\"
button
\"
class=
\"
btn btn-primary
\"
ng-click=
\"
triggerSubmit()
\"
>Kaydet</button>
\n
"
+
...
@@ -1002,7 +1002,7 @@ angular.module("shared/templates/directives/sidebar.html", []).run(["$templateCa
...
@@ -1002,7 +1002,7 @@ angular.module("shared/templates/directives/sidebar.html", []).run(["$templateCa
" <div class=
\"
brand
\"
>
\n
"
+
" <div class=
\"
brand
\"
>
\n
"
+
" <a href=
\"\"
class=
\"
logo
\"
><img src=
\"
/img/brand-logo.png
\"
/></a>
\n
"
+
" <a href=
\"\"
class=
\"
logo
\"
><img src=
\"
/img/brand-logo.png
\"
/></a>
\n
"
+
" </div>
\n
"
+
" </div>
\n
"
+
" <ul class=
\"
nav in sidebarscroll
\"
id=
\"
side-menu
\"
>
\n
"
+
" <ul class=
\"
nav in sidebarscroll
\"
id=
\"
side-menu
\"
ng-class=
\"
{hidden: $root.loggedInUser != true}
\"
>
\n
"
+
" <!--<sidebar-search></sidebar-search>-->
\n
"
+
" <!--<sidebar-search></sidebar-search>-->
\n
"
+
" <li ui-sref-active=
\"
active
\"
>
\n
"
+
" <li ui-sref-active=
\"
active
\"
>
\n
"
+
" <a href=
\"
#/dashboard
\"
><i class=
\"
fa fa-dashboard fa-fw
\"
></i> Panel</a>
\n
"
+
" <a href=
\"
#/dashboard
\"
><i class=
\"
fa fa-dashboard fa-fw
\"
></i> Panel</a>
\n
"
+
...
...
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