Commit 0c15c1be authored by Evren Kutar's avatar Evren Kutar

add design switch as a service for designer work without backend

parent a1876dc9
......@@ -73,6 +73,14 @@ angular.module(
return {url: backendurl};
})())
.service('DESIGN', function ($routeParams, $cookies) {
// use route param to change cookie for design
// this is a config as a service added for designer can work without backend
if (angular.isDefined($routeParams.design) || location.hash.split('?')[1].split('=')[1]) {
$cookies.put('design', $routeParams.design || location.hash.split('?')[1].split('=')[1]);
}
return $cookies.get('design') === 'true' ? {switch: true} : {switch: false};
})
.constant('toastr', window.toastr)
.constant('WS', window.WebSocket)
.config(function ($logProvider) {
......
......@@ -64,7 +64,7 @@ angular.module('ulakbus.dashboard', [])
$scope.userPopover = {templateUrl: 'components/dashboard/user-info.html'};
$scope.get_info = function (type, key) {
Generator.get_list({url: 'crud', form_params: {model: type, object_id: key, cmd: 'show'}})
Generator.get_list({url: 'crud', form_params: {wf: 'crud', model: type, object_id: key, cmd: 'show'}})
.then(function (data) {
$scope.userPopover.name = data.data.object.unicode;
$scope.userPopover.tcno = data.data.object.tckn;
......
......@@ -93,10 +93,6 @@
<script src="bower_components/moment/min/moment.min.js"></script>
<script src="bower_components/toastr/toastr.min.js"></script>
<script src="../node_modules/bpmn-js/lib/Modeler.js"></script>
<script src="../node_modules/requirejs/require.js"></script>
<script src="bower_components/angular-loading-bar/build/loading-bar.min.js"></script>
<script src="bower_components/metisMenu/dist/metisMenu.min.js"></script>
<script src="bower_components/intro.js/intro.js"></script>
......@@ -116,7 +112,6 @@
<script src="components/auth/auth_controller.js"></script>
<script src="components/auth/auth_service.js"></script>
<script src="components/admin/bpmn_manager_controller.js"></script>
<script src="components/dashboard/dashboard_controller.js"></script>
<script src="components/crud/crud_controller.js"></script>
<script src="components/debug/debug_controller.js"></script>
......
......@@ -78,6 +78,14 @@ angular.module(
return {url: backendurl};
})())
.service('DESIGN', function ($routeParams, $cookies) {
// use route param to change cookie for design
// this is a config as a service added for designer can work without backend
if (angular.isDefined($routeParams.design) || location.hash.split('?')[1].split('=')[1]) {
$cookies.put('design', $routeParams.design || location.hash.split('?')[1].split('=')[1]);
}
return $cookies.get('design') === 'true' ? {switch: true} : {switch: false};
})
.constant('toastr', window.toastr)
.constant('WS', window.WebSocket)
.config(function ($logProvider) {
......
......@@ -297,7 +297,7 @@ angular.module('ulakbus')
restrict: 'E',
replace: true,
scope: {},
controller: function ($scope, $rootScope, $cookies, $route, $http, RESTURL, $log, $location, $window, $timeout) {
controller: function ($scope, $rootScope, $cookies, $route, $http, RESTURL, DESIGN, $log, $location, $window, $timeout) {
$scope.prepareMenu = function (menuItems) {
var newMenuItems = {};
angular.forEach(menuItems, function (value, key) {
......@@ -362,7 +362,10 @@ angular.module('ulakbus')
})
.error(function (data, status, headers, config) {
$log.error('menu not retrieved', data);
$location.path('/login');
$log.info('design switch', DESIGN.switch);
if (!DESIGN.switch) {
$location.path('/login');
}
});
};
$scope.$on("regenerate_menu", function () {
......
......@@ -29,7 +29,7 @@
<li ng-repeat="(k, v) in item">
<!--<a ng-if="v.model" ng-href="#{{v.url}}" ng- -->
<!--ng-click="breadcrumb([key, v.text], $event)">{{v.text}}</a>-->
<a ng-href="#/{{v.wf}}/{{v.model}}?{{v.param}}={{selectedUser.key}}"
<a ng-href="#/{{v.wf}}/{{v.model}}"
ng-click="breadcrumb([key, v.text], $event)">{{v.text}}</a>
</li>
</ul>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -438,7 +438,7 @@ angular.module("components/dashboard/dashboard.html", []).run(["$templateCache",
"<div ng-app=\"ulakbus.dashboard\" class=\"dashboard student-dashboard\">\n" +
" <div class=\"starter-template\">\n" +
" <ng-include src=\"'components/dashboard/user-templates/student.html'\" ng-if=\"$root.current_user.is_student\"></ng-include>\n" +
" <ng-include src=\"'components/dashboard/user-templates/staff.html'\" ng-if=\"$root.current_user.is_staff\"></ng-include>\n" +
" <ng-include src=\"'components/dashboard/user-templates/staff.html'\" ng-if=\"!$root.current_user.is_student\"></ng-include>\n" +
" </div>\n" +
"</div>");
}]);
......@@ -1683,7 +1683,7 @@ angular.module("shared/templates/directives/sidebar.html", []).run(["$templateCa
" <li ng-repeat=\"(k, v) in item\">\n" +
" <!--<a ng-if=\"v.model\" ng-href=\"#{{v.url}}\" ng- -->\n" +
" <!--ng-click=\"breadcrumb([key, v.text], $event)\">{{v.text}}</a>-->\n" +
" <a ng-href=\"#/{{v.wf}}/{{v.model}}?{{v.param}}={{selectedUser.key}}\"\n" +
" <a ng-href=\"#/{{v.wf}}/{{v.model}}\"\n" +
" ng-click=\"breadcrumb([key, v.text], $event)\">{{v.text}}</a>\n" +
" </li>\n" +
" </ul>\n" +
......
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