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

Merge branch 'error_pages'

parents 4da02b24 b26306e0
...@@ -103,4 +103,7 @@ docs/_build/ ...@@ -103,4 +103,7 @@ docs/_build/
# PyBuilder # PyBuilder
target/ target/
coverage/ coverage/
\ No newline at end of file
sync
*.rdb
\ No newline at end of file
...@@ -298,8 +298,7 @@ module.exports = function (grunt) { ...@@ -298,8 +298,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-preprocess'); grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-env'); 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', 'connect:server', 'watch:dev']);
grunt.registerTask('dev', ['env:dev', 'preprocess:dev', 'html2js:dev', 'watch:dev']);
grunt.registerTask('test', ['bower', 'karma:continuous']); grunt.registerTask('test', ['bower', 'karma:continuous']);
grunt.registerTask('i18n', ['nggettext_extract', 'nggettext_compile']); grunt.registerTask('i18n', ['nggettext_extract', 'nggettext_compile']);
grunt.registerTask('default', [ grunt.registerTask('default', [
......
...@@ -287,6 +287,11 @@ select { ...@@ -287,6 +287,11 @@ select {
position: absolute; position: absolute;
right: 0; right: 0;
background-color:#f5f5f5; 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 { .manager-view-inner {
...@@ -946,6 +951,31 @@ table.dataTable thead .sorting:after { ...@@ -946,6 +951,31 @@ table.dataTable thead .sorting:after {
/* END OF PERSONNEL INFO */ /* 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 */ /* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) { @media screen and (min-width: 768px) {
......
...@@ -18,8 +18,7 @@ var app = angular.module( ...@@ -18,8 +18,7 @@ var app = angular.module(
'formService', 'formService',
'ulakbus.dashboard', 'ulakbus.dashboard',
'ulakbus.auth', 'ulakbus.auth',
//'ulakbus.staff', 'ulakbus.error_pages',
//'ulakbus.student',
'ulakbus.crud', 'ulakbus.crud',
'ulakbus.version', 'ulakbus.version',
'schemaForm', 'schemaForm',
......
...@@ -10,14 +10,14 @@ app.config(['$routeProvider', function ($routeProvider) { ...@@ -10,14 +10,14 @@ app.config(['$routeProvider', function ($routeProvider) {
templateUrl: 'components/dashboard/dashboard.html', templateUrl: 'components/dashboard/dashboard.html',
controller: 'DashCtrl' controller: 'DashCtrl'
}) })
.when('/500', { // .when('/500', {
templateUrl: 'components/uitemplates/500.html', // templateUrl: 'components/uitemplates/500.html',
controller: '500Ctrl' // controller: '500Ctrl'
}) // })
.when('/404', { // .when('/404', {
templateUrl: 'components/uitemplates/404.html', // templateUrl: 'components/uitemplates/404.html',
controller: '404Ctrl' // controller: '404Ctrl'
}) // })
.when('/crud/:model/add', { .when('/crud/:model/add', {
templateUrl: 'components/crud/templates/add.html', templateUrl: 'components/crud/templates/add.html',
controller: 'CRUDAddEditCtrl' controller: 'CRUDAddEditCtrl'
......
<div class="starter-template"> <div class="starter-template">
<h1>{{model}} <a href="#/crud/{{model}}/add"><button type="button" class="btn btn-primary">Ekle</button></a></h1> <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;"> <table class="table table-bordered" style="background-color:#fff;">
<thead> <thead>
<tr> <tr>
...@@ -41,7 +46,7 @@ ...@@ -41,7 +46,7 @@
<br/> <br/>
<hr/> <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" <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false"> aria-expanded="false">
İşlemler <span class="caret"></span> İş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 @@ ...@@ -5,24 +5,17 @@
* (GPLv3). See LICENSE.txt for details. * (GPLv3). See LICENSE.txt for details.
*/ */
'use strict'; // 'use strict';
app.config(['$routeProvider', function ($routeProvider) { // app.config(['$routeProvider', function ($routeProvider) {
$routeProvider // $routeProvider
.when('/500', { // .when('/500', {
templateUrl: 'components/uitemplates/500.html', // templateUrl: 'components/uitemplates/500.html',
controller: '500Ctrl' // controller: '500Ctrl'
}) // });
.when('/404', { // }]);
templateUrl: 'components/uitemplates/404.html',
controller: '404Ctrl'
});
}]);
angular.module('ulakbus.uitemplates', ['ngRoute']) angular.module('ulakbus.uitemplates', ['ngRoute'])
.controller('500Ctrl', function ($scope, $rootScope, $location) { // .controller('500Ctrl', function ($scope, $rootScope, $location) {
}) // });
\ No newline at end of file
.controller('400Ctrl', function ($scope, $rootScope, $location) {
});
\ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<body> <body>
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.loggedInUser"> <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"> <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>
...@@ -62,7 +63,7 @@ ...@@ -62,7 +63,7 @@
</div> </div>
</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/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.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> <script src="bower_components/angular-route/angular-route.min.js"></script>
...@@ -100,6 +101,7 @@ ...@@ -100,6 +101,7 @@
<script src="components/dashboard/dashboard_controller.js"></script> <script src="components/dashboard/dashboard_controller.js"></script>
<script src="components/crud/crud_controller.js"></script> <script src="components/crud/crud_controller.js"></script>
<script src="components/uitemplates/uitemplates.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/student/student_controller.js"></script>-->
<script src="components/version/interpolate-filter.js"></script> <script src="components/version/interpolate-filter.js"></script>
<script src="components/version/version-directive.js"></script> <script src="components/version/version-directive.js"></script>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<body> <body>
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.loggedInUser"> <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"> <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>
...@@ -70,7 +71,7 @@ ...@@ -70,7 +71,7 @@
</div> </div>
<!-- @if NODE_ENV == 'DEVELOPMENT' --> <!-- @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/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.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> <script src="bower_components/angular-route/angular-route.min.js"></script>
...@@ -108,6 +109,7 @@ ...@@ -108,6 +109,7 @@
<script src="components/dashboard/dashboard_controller.js"></script> <script src="components/dashboard/dashboard_controller.js"></script>
<script src="components/crud/crud_controller.js"></script> <script src="components/crud/crud_controller.js"></script>
<script src="components/uitemplates/uitemplates.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/student/student_controller.js"></script>-->
<script src="components/version/interpolate-filter.js"></script> <script src="components/version/interpolate-filter.js"></script>
<script src="components/version/version-directive.js"></script> <script src="components/version/version-directive.js"></script>
...@@ -116,7 +118,7 @@ ...@@ -116,7 +118,7 @@
<!-- @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="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="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>
......
...@@ -18,8 +18,7 @@ var app = angular.module( ...@@ -18,8 +18,7 @@ var app = angular.module(
'formService', 'formService',
'ulakbus.dashboard', 'ulakbus.dashboard',
'ulakbus.auth', 'ulakbus.auth',
//'ulakbus.staff', 'ulakbus.error_pages',
//'ulakbus.student',
'ulakbus.crud', 'ulakbus.crud',
'ulakbus.version', 'ulakbus.version',
'schemaForm', 'schemaForm',
......
...@@ -24,7 +24,7 @@ app.directive('logout', function ($http, $location, RESTURL) { ...@@ -24,7 +24,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
/** /**
* headerNotification directive for header * headerNotification directive for header
*/ */
app.directive('headerNotification', function ($http, $interval) { app.directive('headerNotification', function ($http, $interval, RESTURL) {
return { return {
templateUrl: 'shared/templates/directives/header-notification.html', templateUrl: 'shared/templates/directives/header-notification.html',
restrict: 'E', restrict: 'E',
...@@ -32,7 +32,7 @@ app.directive('headerNotification', function ($http, $interval) { ...@@ -32,7 +32,7 @@ app.directive('headerNotification', function ($http, $interval) {
link: function ($scope) { link: function ($scope) {
$interval(function () { $interval(function () {
// todo: change url to backend // todo: change url to backend
$http.get("http://google.com").success(function (data) { $http.post(RESTURL+"crud").success(function (data) {
$scope.notifications = data; $scope.notifications = data;
}); });
}, 15000); }, 15000);
...@@ -40,6 +40,26 @@ app.directive('headerNotification', function ($http, $interval) { ...@@ -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 () { app.directive('headerSubMenu', function () {
return { return {
templateUrl: 'shared/templates/directives/header-sub-menu.html', templateUrl: 'shared/templates/directives/header-sub-menu.html',
...@@ -98,11 +118,6 @@ app.directive('sidebar', ['$location', function () { ...@@ -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.selectedMenu = $location.path();
$scope.collapseVar = 0; $scope.collapseVar = 0;
$scope.multiCollapseVar = 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) { ...@@ -12,57 +12,62 @@ app.config(['$httpProvider', function ($httpProvider) {
*/ */
$httpProvider.interceptors.push(function ($q, $rootScope, $location) { $httpProvider.interceptors.push(function ($q, $rootScope, $location) {
return { return {
'request': function(config){ 'request': function (config) {
// todo: delete console logs // todo: delete console logs
if (config.method == "POST"){ if (config.method === "POST") {
// to prevent OPTIONS preflight request // to prevent OPTIONS preflight request
config.headers["Content-Type"] = "text/plain" config.headers["Content-Type"] = "text/plain";
} else {
} }
return config; return config;
}, },
'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 == false){ if (response.data.is_login === false) {
$rootScope.loggedInUser = response.data.is_login; $rootScope.loggedInUser = response.data.is_login;
$location.path("/login"); $location.path("/login");
} }
if(response.data.is_login == true){ if (response.data.is_login === true) {
$rootScope.loggedInUser = 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);
} // }
return response; return response;
}, },
'responseError': function (rejection) { 'responseError': function (rejection) {
// if unauthorized then redirect to login page // if unauthorized then redirect to login page
if(rejection.status === 400) {
if (rejection.status === 400) {
$location.reload(); $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"); console.log("show errors on login form");
} else{ } else {
$location.path('/login'); $location.path('/login');
} }
} }
if(rejection.status === 403) { if (rejection.status === 403) {
if (rejection.data.is_login == true){ if (rejection.data.is_login === true) {
$rootScope.loggedInUser = true; $rootScope.loggedInUser = true;
console.log('user logged in'); if ($location.path() === "/login") {
if($location.path()==="/login"){
$location.path("/dashboard"); $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); 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