Commit cc2ed499 authored by Evren Kutar's avatar Evren Kutar

error pages 404 and 500 and no content to list page

parent 8b18dbb6
......@@ -18,8 +18,7 @@ var app = angular.module(
'formService',
'ulakbus.dashboard',
'ulakbus.auth',
//'ulakbus.staff',
//'ulakbus.student',
'ulakbus.error_pages',
'ulakbus.crud',
'ulakbus.version',
'schemaForm',
......
......@@ -10,14 +10,14 @@ app.config(['$routeProvider', function ($routeProvider) {
templateUrl: 'components/dashboard/dashboard.html',
controller: 'DashCtrl'
})
.when('/500', {
templateUrl: 'components/uitemplates/500.html',
controller: '500Ctrl'
})
.when('/404', {
templateUrl: 'components/uitemplates/404.html',
controller: '404Ctrl'
})
// .when('/500', {
// templateUrl: 'components/uitemplates/500.html',
// controller: '500Ctrl'
// })
// .when('/404', {
// templateUrl: 'components/uitemplates/404.html',
// controller: '404Ctrl'
// })
.when('/crud/:model/add', {
templateUrl: 'components/crud/templates/add.html',
controller: 'CRUDAddEditCtrl'
......
<div class="starter-template">
<h1>{{model}} <a href="#/crud/{{model}}/add"><button type="button" class="btn btn-primary">Ekle</button></a></h1>
<div class="tablescroll">
<div class="row" ng-if="!nobjects[1]">
<div class="col-md-12">
<p class="no-content">Listelenecek içerik yok.</p>
</div>
</div>
<div class="tablescroll" ng-if="nobjects[1]">
<table class="table table-bordered" style="background-color:#fff;">
<thead>
<tr>
......@@ -41,7 +46,7 @@
<br/>
<hr/>
<div class="btn-group">
<div class="btn-group" ng-if="nobjects[1]">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
İşlemler <span class="caret"></span>
......
<div ng-app="ulakbus.error_pages" class="error-page">
<div class="starter-template">
<div class="row">
<div class="error-block">
<p>404</p>
<p>Dosya Bulunamıyor</p>
<a href="#/dashboard"><button class="btn btn-warning">Panel Sayfasına Dön</button></a>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div ng-app="ulakbus.error_pages" class="error-page">
<div class="starter-template">
<div class="row">
<div class="error-block">
<p>500</p>
<p>Sunucu Hatası</p>
<a href="#/dashboard"><button class="btn btn-warning">Panel Sayfasına Dön</button></a>
</div>
</div>
</div>
</div>
\ No newline at end of file
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict';
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/500', {
templateUrl: 'components/error_pages/500.html',
controller: '500Ctrl'
})
.when('/404', {
templateUrl: 'components/error_pages/404.html',
controller: '404Ctrl'
});
}]);
angular.module('ulakbus.error_pages', ['ngRoute'])
.controller('500Ctrl', function ($scope, $rootScope, $location) {
})
.controller('404Ctrl', function ($scope, $rootScope, $location) {
});
\ No newline at end of file
......@@ -5,24 +5,17 @@
* (GPLv3). See LICENSE.txt for details.
*/
'use strict';
// 'use strict';
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/500', {
templateUrl: 'components/uitemplates/500.html',
controller: '500Ctrl'
})
.when('/404', {
templateUrl: 'components/uitemplates/404.html',
controller: '404Ctrl'
});
}]);
// app.config(['$routeProvider', function ($routeProvider) {
// $routeProvider
// .when('/500', {
// templateUrl: 'components/uitemplates/500.html',
// controller: '500Ctrl'
// });
// }]);
angular.module('ulakbus.uitemplates', ['ngRoute'])
.controller('500Ctrl', function ($scope, $rootScope, $location) {
})
.controller('400Ctrl', function ($scope, $rootScope, $location) {
});
\ No newline at end of file
// .controller('500Ctrl', function ($scope, $rootScope, $location) {
// });
\ No newline at end of file
......@@ -63,7 +63,7 @@
</div>
</div>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bower_components/angular-route/angular-route.min.js"></script>
......@@ -101,6 +101,7 @@
<script src="components/dashboard/dashboard_controller.js"></script>
<script src="components/crud/crud_controller.js"></script>
<script src="components/uitemplates/uitemplates.js"></script>
<script src="components/error_pages/error_controller.js"></script>
<!--<script src="components/student/student_controller.js"></script>-->
<script src="components/version/interpolate-filter.js"></script>
<script src="components/version/version-directive.js"></script>
......
......@@ -71,7 +71,7 @@
</div>
<!-- @if NODE_ENV == 'DEVELOPMENT' -->
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bower_components/angular-route/angular-route.min.js"></script>
......@@ -109,6 +109,7 @@
<script src="components/dashboard/dashboard_controller.js"></script>
<script src="components/crud/crud_controller.js"></script>
<script src="components/uitemplates/uitemplates.js"></script>
<script src="components/error_pages/error_controller.js"></script>
<!--<script src="components/student/student_controller.js"></script>-->
<script src="components/version/interpolate-filter.js"></script>
<script src="components/version/version-directive.js"></script>
......@@ -117,7 +118,7 @@
<!-- @if NODE_ENV == 'PRODUCTION' -->
<script src="bower_components/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.18/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.20/angular.min.js"></script>
<script src="bower_components/components.js"></script>
<script src="shared/translations.js"></script>
<script src="templates.js"></script>
......
......@@ -18,8 +18,7 @@ var app = angular.module(
'formService',
'ulakbus.dashboard',
'ulakbus.auth',
//'ulakbus.staff',
//'ulakbus.student',
'ulakbus.error_pages',
'ulakbus.crud',
'ulakbus.version',
'schemaForm',
......
......@@ -12,57 +12,61 @@ app.config(['$httpProvider', function ($httpProvider) {
*/
$httpProvider.interceptors.push(function ($q, $rootScope, $location) {
return {
'request': function(config){
'request': function (config) {
// todo: delete console logs
if (config.method == "POST"){
if (config.method === "POST") {
// to prevent OPTIONS preflight request
config.headers["Content-Type"] = "text/plain"
} else {
config.headers["Content-Type"] = "text/plain";
}
return config;
},
'response': function (response) {
//Will only be called for HTTP up to 300
if(response.data.is_login == false){
if (response.data.is_login === false) {
$rootScope.loggedInUser = response.data.is_login;
$location.path("/login");
}
if(response.data.is_login == true){
if (response.data.is_login === true) {
$rootScope.loggedInUser = true;
if($location.path()==="/login"){
if ($location.path() === "/login") {
$location.path("/dashboard");
}
}
if(response.data.client_cmd) {
// if (response.data.client_cmd) {
//$location.path(response.data.screen);
}
// }
return response;
},
'responseError': function (rejection) {
// if unauthorized then redirect to login page
if(rejection.status === 400) {
if (rejection.status === 400) {
$location.reload();
}
if(rejection.status === 401) {
if (rejection.status === 401) {
//$rootScope.loggedInUser = false;
if($location.path()==="/login"){
if ($location.path() === "/login") {
console.log("show errors on login form");
} else{
} else {
$location.path('/login');
}
}
if(rejection.status === 403) {
if (rejection.data.is_login == true){
if (rejection.status === 403) {
if (rejection.data.is_login === true) {
$rootScope.loggedInUser = true;
console.log('user logged in');
if($location.path()==="/login"){
if ($location.path() === "/login") {
$location.path("/dashboard");
}
}
}
if (rejection.status === 404) {
$location.path("/404");
}
if (rejection.status === 500) {
$location.path("/500");
}
return $q.reject(rejection);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment