Commit 03618be5 authored by Evren Kutar's avatar Evren Kutar

dev settings page with necessary functionality,

resolves #30
parent 7a5456dc
...@@ -103,6 +103,7 @@ module.exports = function (grunt) { ...@@ -103,6 +103,7 @@ module.exports = function (grunt) {
"app/components/dashboard/dashboard_controller.js", "app/components/dashboard/dashboard_controller.js",
"app/components/crud/crud_controller.js", "app/components/crud/crud_controller.js",
"app/components/debug/debug_controller.js", "app/components/debug/debug_controller.js",
"app/components/devSettings/devSettings_controller.js",
"app/components/error_pages/error_controller.js", "app/components/error_pages/error_controller.js",
"app/components/wf/wf_controller.js", "app/components/wf/wf_controller.js",
"app/components/version/version.js", "app/components/version/version.js",
......
...@@ -21,6 +21,7 @@ var app = angular.module( ...@@ -21,6 +21,7 @@ var app = angular.module(
'ulakbus.error_pages', 'ulakbus.error_pages',
'ulakbus.crud', 'ulakbus.crud',
'ulakbus.debug', 'ulakbus.debug',
'ulakbus.devSettings',
'ulakbus.wf', 'ulakbus.wf',
'ulakbus.version', 'ulakbus.version',
//'schemaForm', //'schemaForm',
...@@ -42,12 +43,6 @@ var app = angular.module( ...@@ -42,12 +43,6 @@ var app = angular.module(
} }
}); });
} }
if (location.href.indexOf("backendurl") > -1){
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl="+backendurl;
window.location.href = window.location.href.split('?')[0];
}
return {url: backendurl}; return {url: backendurl};
})()). })()).
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
</a> </a>
</h1> </h1>
<div class="row" ng-if="!nobjects[1]"> <div class="row" ng-if="!nobjects[1]">
<div class="col-md-12"> <div class="col-md-12">
<p class="no-content">Listelenecek içerik yok.</p> <p class="no-content">Listelenecek içerik yok.</p>
</div>
</div> </div>
</div>
<div class="tablescroll" ng-if="nobjects[1]"> <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>
......
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td class="col-md-2">Backend Url:</td>
<td class="col-md-8">
<input class="form-control" type="text" placeholder="Backend Url Tanımla"
value="{{backendurl}}"
ng-model="backendurl">
<button class="btn btn-primary" ng-click="setbackendurl()">Kaydet</button>
</td>
</tr>
<tr>
<td>Notifications:</td>
<td>
<button class="btn"
ng-class="{'btn-success':notificate=='on', 'btn-danger':notificate=='off'}" ng-click="setnotification()">{{notificate}}</button>
</td>
</tr>
<tr>
<td>Query Debug:</td>
<td>
<a href="#/debug/list">Goster</a>
</td>
</tr>
</tbody>
</table>
</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('/dev/settings', {
templateUrl: 'components/devSettings/devSettings.html',
controller: 'DevSettingsCtrl'
});
}]);
angular.module('ulakbus.devSettings', ['ngRoute'])
.controller('DevSettingsCtrl', function ($scope, $cookies, $rootScope, RESTURL) {
$scope.backendurl = $cookies.get("backendurl");
$scope.notificate = $cookies.get("notificate") || "on";
//$scope.querydebug = $cookies.get("querydebug") || "on";
$scope.changeSettings = function (what, set) {
document.cookie = what+"="+set;
$scope[what] = set;
$rootScope.$broadcast(what, set);
};
$scope.switchOnOff = function (pinn) {
return pinn=="on" ? "off" : "on"
};
$scope.setbackendurl = function () {
$scope.changeSettings("backendurl", $scope.backendurl);
RESTURL.url = $scope.backendurl;
};
$scope.setnotification = function () {
$scope.changeSettings("notificate", $scope.switchOnOff($scope.notificate));
};
//$scope.setquerydebug = function () {
// $scope.changeSettings("querydebug", $scope.switchOnOff($scope.querydebug));
//};
});
\ No newline at end of file
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,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/debug/debug_controller.js"></script> <script src="components/debug/debug_controller.js"></script>
<script src="components/devSettings/devSettings_controller.js"></script>
<script src="components/wf/wf_controller.js"></script> <script src="components/wf/wf_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/error_pages/error_controller.js"></script>
......
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,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/debug/debug_controller.js"></script> <script src="components/debug/debug_controller.js"></script>
<script src="components/devSettings/devSettings_controller.js"></script>
<script src="components/wf/wf_controller.js"></script> <script src="components/wf/wf_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/error_pages/error_controller.js"></script>
......
...@@ -21,6 +21,7 @@ var app = angular.module( ...@@ -21,6 +21,7 @@ var app = angular.module(
'ulakbus.error_pages', 'ulakbus.error_pages',
'ulakbus.crud', 'ulakbus.crud',
'ulakbus.debug', 'ulakbus.debug',
'ulakbus.devSettings',
'ulakbus.wf', 'ulakbus.wf',
'ulakbus.version', 'ulakbus.version',
//'schemaForm', //'schemaForm',
...@@ -47,12 +48,6 @@ var app = angular.module( ...@@ -47,12 +48,6 @@ var app = angular.module(
} }
}); });
} }
if (location.href.indexOf("backendurl") > -1){
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl="+backendurl;
window.location.href = window.location.href.split('?')[0];
}
return {url: backendurl}; return {url: backendurl};
})()). })()).
......
...@@ -26,7 +26,7 @@ app.directive('logout', function ($http, $location, RESTURL) { ...@@ -26,7 +26,7 @@ app.directive('logout', function ($http, $location, RESTURL) {
* headerNotification directive for header * headerNotification directive for header
*/ */
app.directive('headerNotification', function ($http, $rootScope, $interval, RESTURL) { app.directive('headerNotification', function ($http, $rootScope, $cookies, $interval, RESTURL) {
return { return {
templateUrl: 'shared/templates/directives/header-notification.html', templateUrl: 'shared/templates/directives/header-notification.html',
restrict: 'E', restrict: 'E',
...@@ -53,8 +53,10 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST ...@@ -53,8 +53,10 @@ app.directive('headerNotification', function ($http, $rootScope, $interval, REST
// check notifications every 5 seconds // check notifications every 5 seconds
$interval(function () { $interval(function () {
console.log('get notification call - interval'); if ($cookies.get("notificate") == "on") {
$scope.getNotifications(); console.log('get notification call - interval');
$scope.getNotifications();
}
}, 5000); }, 5000);
// when clicked mark as read notification // when clicked mark as read notification
......
...@@ -84,13 +84,12 @@ ...@@ -84,13 +84,12 @@
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i> <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a> </a>
<ul class="dropdown-menu dropdown-user"> <ul class="dropdown-menu dropdown-user">
<li><a href="javascript:void(0)"><i class="fa fa-user fa-fw"></i> Profil</a> <li><a href="javascript:void(0)"><i class="fa fa-user fa-fw"></i> Profil</a></li>
</li>
<li><a href="javascript:void(0)"><i class="fa fa-gear fa-fw"></i> Ayarlar</a>
</li>
<li class="divider"></li> <li class="divider"></li>
<li><a ui-sref="login" href="javascript:void(0);" logout><i class="fa fa-sign-out fa-fw"></i> Çıkış</a> <li><a href="javascript:void(0)"><i class="fa fa-gear fa-fw"></i> Ayarlar</a></li>
</li> <li><a href="#/dev/settings"><i class="fa fa-gear fa-fw"></i> Ayarlar (Dev)</a></li>
<li class="divider"></li>
<li><a ui-sref="login" href="javascript:void(0);" logout><i class="fa fa-sign-out fa-fw"></i> Çıkış</a></li>
</ul> </ul>
<!-- /.dropdown-user --> <!-- /.dropdown-user -->
</li> </li>
......
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