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
f816eef2
Commit
f816eef2
authored
Nov 17, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolves #29
resolves #45
parent
a5fdb461
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
30 deletions
+47
-30
Gruntfile.js
Gruntfile.js
+1
-1
login.html
app/components/auth/login.html
+1
-0
form_service.js
app/zetalib/forms/form_service.js
+7
-9
interceptors.js
app/zetalib/interceptors.js
+38
-20
No files found.
Gruntfile.js
View file @
f816eef2
...
...
@@ -330,7 +330,7 @@ module.exports = function (grunt) {
grunt
.
loadNpmTasks
(
'grunt-preprocess'
);
grunt
.
loadNpmTasks
(
'grunt-env'
);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'html2js:dev'
,
'
connect:server'
,
'
watch:dev'
]);
grunt
.
registerTask
(
'dev'
,
[
'env:dev'
,
'preprocess:dev'
,
'html2js:dev'
,
'watch:dev'
]);
grunt
.
registerTask
(
'test'
,
[
'bower'
,
'karma:continuous'
]);
grunt
.
registerTask
(
'i18n'
,
[
'nggettext_extract'
,
'nggettext_compile'
]);
grunt
.
registerTask
(
'local_prod'
,
[
'bower'
,
'env:prod'
,
'preprocess:prod'
,
'nggettext_compile'
,
'concat:js'
,
'concat:css'
,
'concat:components'
,
'copy:local_prod'
,
'html2js:prod'
,
'uglify:dist'
,
'connect:prod_server'
,
'watch:local_prod'
]);
...
...
app/components/auth/login.html
View file @
f816eef2
<loaderdiv><div></div></loaderdiv>
<div
ng-app=
"ulakbus.auth"
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-4 col-md-offset-4"
>
...
...
app/zetalib/forms/form_service.js
View file @
f816eef2
...
...
@@ -473,15 +473,6 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
generator
.
setPageData
(
data
);
redirectTo
(
$scope
,
'detail'
);
}
//todo: msgbox make it work
// if submit returns msgbox after save
//if (data.msgbox) {
// $scope.msgbox = data.msgbox;
// var newElement = $compile("<msgbox ></msgbox>")($scope);
// angular.element(document.querySelector('.main.ng-scope')).children().remove();
// angular.element(document.querySelector('.main.ng-scope')).append(newElement);
//}
};
/**
...
...
@@ -524,6 +515,13 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, $c
if
(
data
.
client_cmd
)
{
generator
.
pathDecider
(
data
.
client_cmd
,
$scope
,
data
);
}
if
(
data
.
msgbox
)
{
$scope
.
msgbox
=
data
.
msgbox
;
var
newElement
=
$compile
(
"<msgbox></msgbox>"
)(
$scope
);
// this is the default action, which is removing page items and reload page with msgbox
angular
.
element
(
document
.
querySelector
(
'.main.ng-scope'
)).
children
().
remove
();
angular
.
element
(
document
.
querySelector
(
'.main.ng-scope'
)).
append
(
newElement
);
}
});
};
return
generator
;
...
...
app/zetalib/interceptors.js
View file @
f816eef2
...
...
@@ -50,7 +50,41 @@ app.config(['$httpProvider', function ($httpProvider) {
return
response
;
},
'responseError'
:
function
(
rejection
)
{
// if unauthorized then redirect to login page
var
errorModal
=
function
()
{
var
codefield
=
""
;
if
(
rejection
.
data
.
error
)
{
codefield
=
'<p><pre>'
+
rejection
.
data
.
error
+
'</pre></p>'
;
}
$
(
'<div class="modal">'
+
'<div class="modal-dialog" style="width:1024px;" role="document">'
+
'<div class="modal-content">'
+
'<div class="modal-header">'
+
'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span'
+
' aria-hidden="true">×</span></button>'
+
'<h4 class="modal-title" id="exampleModalLabel">'
+
rejection
.
status
+
rejection
.
data
.
title
+
'</h4>'
+
'</div>'
+
'<div class="modal-body">'
+
'<div class="alert alert-danger">'
+
'<strong>'
+
rejection
.
data
.
description
+
'</strong>'
+
codefield
+
'</div>'
+
'</div>'
+
'<div class="modal-footer">'
+
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
).
modal
();
};
errorModal
();
if
(
rejection
.
status
===
400
)
{
$location
.
reload
();
...
...
@@ -62,6 +96,7 @@ app.config(['$httpProvider', function ($httpProvider) {
}
}
if
(
rejection
.
status
===
403
)
{
console
.
log
(
403
);
if
(
rejection
.
data
.
is_login
===
true
)
{
$rootScope
.
loggedInUser
=
true
;
if
(
$location
.
path
()
===
"/login"
)
{
...
...
@@ -69,6 +104,8 @@ app.config(['$httpProvider', function ($httpProvider) {
}
}
}
$rootScope
.
$broadcast
(
'show_notifications'
,
rejection
.
data
);
if
(
rejection
.
status
===
404
)
{
console
.
log
(
404
);
$location
.
path
(
"/error/404"
);
...
...
@@ -76,25 +113,6 @@ app.config(['$httpProvider', function ($httpProvider) {
// server 500 error returns with -1 on status.
//if (rejection.status === -1 && rejection.config.data.model) {
if
(
rejection
.
status
===
500
)
{
$
(
'<div class="modal">'
+
'<div class="modal-dialog" style="width:1024px;" role="document">'
+
'<div class="modal-content">'
+
'<div class="modal-header">'
+
'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span'
+
' aria-hidden="true">×</span></button>'
+
'<h4 class="modal-title" id="exampleModalLabel">500 Server Error</h4>'
+
'</div>'
+
'<div class="modal-body">'
+
'<p><pre>'
+
rejection
.
data
.
error
+
'</pre></p>'
+
'</div>'
+
'<div class="modal-footer">'
+
'<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>'
+
'</div>'
+
'</div>'
+
'</div>'
+
'</div>'
).
modal
();
$location
.
path
(
"/error/500"
);
}
return
$q
.
reject
(
rejection
);
...
...
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