Commit 5949ecfd authored by Evren Kutar's avatar Evren Kutar

Merge branch 'error_pages'

parents 4da02b24 b26306e0
......@@ -103,4 +103,7 @@ docs/_build/
# PyBuilder
target/
coverage/
\ No newline at end of file
coverage/
sync
*.rdb
\ No newline at end of file
......@@ -298,8 +298,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('dev', ['env:dev', 'preprocess:dev', 'html2js:dev', 'connect:server', 'watch:dev']);
grunt.registerTask('test', ['bower', 'karma:continuous']);
grunt.registerTask('i18n', ['nggettext_extract', 'nggettext_compile']);
grunt.registerTask('default', [
......
......@@ -287,6 +287,11 @@ select {
position: absolute;
right: 0;
background-color:#f5f5f5;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-ms-transition: all .2s;
-o-transition: all .2s;
transition: all .2s;
}
.manager-view-inner {
......@@ -946,6 +951,31 @@ table.dataTable thead .sorting:after {
/* END OF PERSONNEL INFO */
/* SIDEBAR COLLAPSE */
.sidebar-collapse-button {
width: 62px;
height: 41px;
float: left;
padding: 8px 16px;
cursor:pointer;
}
.sidebar-collapse-button:hover {
background-color:#9A1026;
}
.sidebar-collapse-button div {
width: 30px;
height: 2px;
background-color: #fff;
margin-top:5px;
border-radius:5px;
}
/* END OF SIDEBAR COLLAPSE */
/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
......
......@@ -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
......@@ -26,6 +26,7 @@
<body>
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.loggedInUser">
<collapse-menu></collapse-menu>
<ul class="header-menu">
<li><a href="">Mesajlar</a></li>
<li><a href="">Görevler</a></li>
......@@ -62,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>
......@@ -100,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>
......
......@@ -33,6 +33,7 @@
<body>
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.loggedInUser">
<collapse-menu></collapse-menu>
<ul class="header-menu">
<li><a href="">Mesajlar</a></li>
<li><a href="">Görevler</a></li>
......@@ -70,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>
......@@ -108,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>
......@@ -116,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',
......
......@@ -24,7 +24,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
/**
* headerNotification directive for header
*/
app.directive('headerNotification', function ($http, $interval) {
app.directive('headerNotification', function ($http, $interval, RESTURL) {
return {
templateUrl: 'shared/templates/directives/header-notification.html',
restrict: 'E',
......@@ -32,7 +32,7 @@ app.directive('headerNotification', function ($http, $interval) {
link: function ($scope) {
$interval(function () {
// todo: change url to backend
$http.get("http://google.com").success(function (data) {
$http.post(RESTURL+"crud").success(function (data) {
$scope.notifications = data;
});
}, 15000);
......@@ -40,6 +40,26 @@ app.directive('headerNotification', function ($http, $interval) {
};
});
app.directive('collapseMenu', function () {
return {
templateUrl: 'shared/templates/directives/menuCollapse.html',
restrict: 'E',
replace: true,
link: function ($scope) {
$scope.collapsed = false;
$scope.collapseToggle = function () {
if ($scope.collapsed === false) {
jQuery(".manager-view").css("z-index" , "9999").css("width" , "100%");
$scope.collapsed = true;
} else {
jQuery(".manager-view").css("z-index" , "0").css("width" , "calc(100% - 250px)");
$scope.collapsed = false;
}
};
}
};
});
app.directive('headerSubMenu', function () {
return {
templateUrl: 'shared/templates/directives/header-sub-menu.html',
......@@ -98,11 +118,6 @@ app.directive('sidebar', ['$location', function () {
}
});
// todo: change to $watch to init
//$timeout(function () {
// $('#side-menu').metisMenu();
//}, 2000);
$scope.selectedMenu = $location.path();
$scope.collapseVar = 0;
$scope.multiCollapseVar = 0;
......
<div class="sidebar-collapse-button" ng-click="collapseToggle()">
<div></div>
<div></div>
<div></div>
</div>
\ No newline at end of file
......@@ -12,57 +12,62 @@ 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) {
//$rootScope.loggedInUser = false;
if($location.path()==="/login"){
if (rejection.status === 401) {
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) {
console.log(404);
$location.path("/404");
}
// server 500 error returns with -1 on status.
if (rejection.status === -1 && rejection.config.data.model) {
$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