Skip to content
This repository was archived by the owner on Nov 23, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/form-samples-mgmt/form-samples-mgmt.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ angular.module('app.form-samples-mgmt', ['oasp.validation', 'oasp.oaspI18n', 'ui
}
return $translate.use();
}
},
ncyBreadcrumb: {
label: 'Validation showcase'
}
}
);
Expand Down
8 changes: 8 additions & 0 deletions app/main/app/container.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module('app.main').controller('ContainerCntl', function ($scope, appContext, $state) {
'use strict';

appContext.getCurrentUser().then(function (currentUser) {
$scope.currentUser = currentUser;
});
$scope.state = $state;
});
39 changes: 39 additions & 0 deletions app/main/app/container.controller.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
describe('Controller: ContainerCntl', function () {
'use strict';

var $scope, $window, security;
beforeEach(module('app.main'));
beforeEach(inject(function ($rootScope, $controller, $q) {
security = {
getCurrentUser: function () {
return $q.when({
isLoggedIn: function () {
return false;
},
getUserName: function () {
return '';
}
});
}
};
$scope = $rootScope;
$window = {
location: jasmine.createSpyObj('location', ['href', 'reload'])
};

$controller('AppCntl',
{$scope: $scope, oaspSecurityService: security, $window: $window});
}));

it('exposes currentUser.isLoggedIn() on $scope which returns false for anonymous user', function () {
// then
$scope.$apply();
expect($scope.currentUser.isLoggedIn()).toBeFalsy();
});

it('exposes currentUser.getName() on $scope which returns empty string for anonymous users', function () {
// then
$scope.$apply();
expect($scope.currentUser.getUserName()).toEqual('');
});
});
3 changes: 2 additions & 1 deletion app/main/i18n/locale-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"TABLES": "Tische",
"KITCHEN": "Küche",
"LOADING": "Landung...",
"CORP": "© OASP 2015"
"CORP": "© OASP 2015",
"ACCESS_DENIED": "Zugriff verweigert. Jede Rolle der {{requestedRoles}} erforderlich, um diesen Zustand zu gehen"
}
}
3 changes: 2 additions & 1 deletion app/main/i18n/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"TABLES": "Tables",
"KITCHEN": "Kitchen",
"LOADING": "Loading ...",
"CORP": "© OASP 2015"
"CORP": "© OASP 2015",
"ACCESS_DENIED": "Access denied. Any role of {{requestedRoles}} required to go to this state"
}
}
5 changes: 5 additions & 0 deletions app/main/layout/breadcrumb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ul id="breadcrumb">
<li ng-repeat="step in steps" ng-class="{active: $last}" ng-switch="$last || !!step.abstract"><a
ng-switch-when="false" href="{{step.ncyBreadcrumbLink}}"><span class="icon icon-beaker"> </span>{{step.ncyBreadcrumbLabel}}</a><a
ng-switch-when="true"><span class="icon icon-beaker"> </span>{{step.ncyBreadcrumbLabel}}</a></li>
</ul>
3 changes: 2 additions & 1 deletion app/main/layout/container.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div class="container">
<div class="container" data-ng-controller="ContainerCntl">
<div class="row" data-ncy-breadcrumb data-ng-show="currentUser.isLoggedIn()&&!state.is('notFound')"></div>
<div data-ui-view class="row">
<h3 translate>OASP.LOADING </h3>
</div>
Expand Down
94 changes: 94 additions & 0 deletions app/main/layout/css/breadcrumb.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#breadcrumb {
list-style: none;
display: inline-block;
margin-top: 10px;
padding: 0px;
.icon {
font-size: 14px;
}
li {
float: left;
a {
color: #FFF;
display: block;
background: #3498db;
text-decoration: none;
position: relative;
height: 40px;
line-height: 40px;
padding: 0 10px 0 5px;
text-align: center;
margin-right: 23px;
}
&:nth-child(even) {
a {
background-color: #2980b9;
&:before {
border-color: #2980b9;
border-left-color: transparent;
}
&:after {
border-left-color: #2980b9;
}
}
}
&:first-child {
a {
padding-left: 15px;
border-radius: 4px 0 0 4px;
&:before {
border: none;
}
}
}
&:last-child {
a {
padding-right: 15px;
border-radius: 0 4px 4px 0;
&:after {
border: none;
}
}
}
a {
&:before, &:after {
content: "";
position: absolute;
top: 0;
border: 0 solid #3498db;
border-width: 20px 10px;
width: 0;
height: 0;
}
&:before {
left: -20px;
border-left-color: transparent;
}
&:after {
left: 100%;
border-color: transparent;
border-left-color: #3498db;
}
&:hover {
background-color: #1abc9c;
&:before {
border-color: #1abc9c;
border-left-color: transparent;
}
&:after {
border-left-color: #1abc9c;
}
}
&:active {
background-color: #16a085;
&:before {
border-color: #16a085;
border-left-color: transparent;
}
&:after {
border-left-color: #16a085;
}
}
}
}
}
3 changes: 2 additions & 1 deletion app/main/layout/css/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
-moz-user-select: @val;
-ms-user-select: @val;
user-select: @val;
}
}

1 change: 1 addition & 0 deletions app/main/main.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "main/layout/css/variables";
@import "main/layout/css/mixins";
@import "main/layout/css/breadcrumb";

body {
padding-top: 50px;
Expand Down
8 changes: 6 additions & 2 deletions app/main/main.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
* @requires oasp.oaspI18n
* @requires ui.bootstrap
*/
angular.module('app.main', ['ui.router', 'oasp.oaspUi', 'oasp.oaspSecurity', 'app.main.templates', 'oasp.validation', 'oasp.oaspI18n', 'ui.bootstrap'])
angular.module('app.main', ['ui.router', 'ncy-angular-breadcrumb', 'oasp.oaspUi', 'oasp.oaspSecurity', 'app.main.templates', 'oasp.validation', 'oasp.oaspI18n', 'ui.bootstrap'])
.constant('SIGN_IN_DLG_PATH', '/main/sign-in')
.constant('ROLES', {
COOK: 'COOK',
WAITER: 'WAITER'
})
.config(function (SIGN_IN_DLG_PATH, $stateProvider, $urlRouterProvider, $urlMatcherFactoryProvider, oaspTranslationProvider, valdrProvider) {
.config(function (SIGN_IN_DLG_PATH, $breadcrumbProvider, $stateProvider, $urlRouterProvider, $urlMatcherFactoryProvider, oaspTranslationProvider, valdrProvider) {
'use strict';

$breadcrumbProvider.setOptions({
includeAbstract: true,
templateUrl: 'main/layout/breadcrumb.html'
});

// --------- Routing ---------

Expand Down
5 changes: 2 additions & 3 deletions app/oasp/oasp-security/oasp-authorization-service.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ angular.module('oasp.oaspSecurity')
}
};
},
$get: function ($q, $log, $injector) {
$get: function ($q, $log, $injector, growl, $filter) {
var getAppContextService = function () {
return $injector.get(config.appContextServiceName);
},
Expand Down Expand Up @@ -80,14 +80,13 @@ angular.module('oasp.oaspSecurity')
if (authorized) {
deferredAuthorizationCheck.resolve(true);
} else {
$log.warn('Access denied. Any role of \'' + requestedRoles + '\' required to go to this state');
deferredAuthorizationCheck.reject();
growl.warning($filter('translate')('OASP.ACCESS_DENIED', {requestedRoles: requestedRoles}));
}
});

return deferredAuthorizationCheck.promise;
},

/**
* @ngdoc method
* @name oaspSecurity.oaspAuthorizationService#userHasAnyRole
Expand Down
6 changes: 4 additions & 2 deletions app/oasp/oasp-security/oasp-security.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* @name oasp.oaspSecurity
* @module oasp
*/
angular.module('oasp.oaspSecurity', [])
.config(function ($httpProvider) {
angular.module('oasp.oaspSecurity', ['angular-growl', 'oasp.oaspI18n'])
.config(function ($httpProvider, oaspTranslationProvider) {
'use strict';
$httpProvider.interceptors.push('oaspSecurityInterceptor');

oaspTranslationProvider.enableTranslationForModule('oaspSecurity');
})
.run(function (oaspSecurityService) {
'use strict';
Expand Down
8 changes: 7 additions & 1 deletion app/sales-mgmt/sales-mgmt.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ angular.module('app.sales-mgmt', ['app.main', 'app.offer-mgmt', 'app.sales-mgmt.
$stateProvider.state('salesMgmt', {
abstract: true,
url: '/sales-mgmt',
template: '<ui-view/>'
template: '<ui-view/>',
ncyBreadcrumb: {
label: 'Sales Management'
}
});

$stateProvider.state('salesMgmt.cookPositions',
Expand All @@ -28,6 +31,9 @@ angular.module('app.sales-mgmt', ['app.main', 'app.offer-mgmt', 'app.sales-mgmt.
currentPositions: ['positions', function (positions) {
return positions.get();
}]
},
ncyBreadcrumb: {
label: 'Cook Positions'
}
}
)
Expand Down
14 changes: 12 additions & 2 deletions app/table-mgmt/table-mgmt.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ angular.module('app.table-mgmt', ['app.offer-mgmt', 'app.sales-mgmt', 'app.main'
$stateProvider.state('tableMgmt', {
abstract: true,
url: '/table-mgmt',
template: '<ui-view/>'
template: '<ui-view/>',
ncyBreadcrumb: {
label: 'Table Management'
}
});

$stateProvider.state('tableMgmt.search', {
Expand All @@ -28,13 +31,20 @@ angular.module('app.table-mgmt', ['app.offer-mgmt', 'app.sales-mgmt', 'app.main'
return paginatedTables;
});
}]
},
ncyBreadcrumb: {
label: 'Search'
}
});

$stateProvider.state('tableMgmt.details', {
url: '/table-details/:tableId',
templateUrl: 'table-mgmt/table-details/table-details.html',
controller: 'TableDetailsCntl',
controllerAs: 'TDC'
controllerAs: 'TDC',
ncyBreadcrumb: {
parent:'tableMgmt.search',
label: 'Details'
}
});
});
57 changes: 29 additions & 28 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
{
"name": "oasp-js",
"version": "0.0.1",
"dependencies": {
"modernizr": "2.6.x",
"respond": "1.1.x",
"bootstrap": "3.3.x",
"angular": "1.3.x",
"angular-ui-select": "0.8.x",
"autofill-event": "1.0.x",
"angular-ui-bootstrap-bower": "0.13.x",
"angular-translate": "2.5.x",
"angular-translate-loader-partial": "2.5.x",
"angular-spinner": "0.5.x",
"angular-growl-v2": "0.7.x",
"angular-animate": "1.3.x",
"trNgGrid": "3.0.x",
"sockjs-client": "0.3.x",
"stomp-websocket": "2.3.x",
"angular-ui-router": "0.2.x",
"valdr": "1.1.x",
"angular-ui-validate": "1.2.x"
},
"devDependencies": {
"angular-mocks": "1.3.x"
},
"resolutions": {
"angular": ">=1.3"
}
"name": "oasp-js",
"version": "0.0.1",
"dependencies": {
"modernizr": "2.6.x",
"respond": "1.1.x",
"bootstrap": "3.3.x",
"angular": "1.3.x",
"angular-ui-select": "0.8.x",
"autofill-event": "1.0.x",
"angular-ui-bootstrap-bower": "0.13.x",
"angular-translate": "2.5.x",
"angular-translate-loader-partial": "2.5.x",
"angular-spinner": "0.5.x",
"angular-growl-v2": "0.7.x",
"angular-animate": "1.3.x",
"trNgGrid": "3.0.x",
"sockjs-client": "0.3.x",
"stomp-websocket": "2.3.x",
"angular-ui-router": "0.2.x",
"angular-breadcrumb": "0.4.1",
"valdr": "1.1.x",
"angular-ui-validate": "1.2.x"
},
"devDependencies": {
"angular-mocks": "1.3.x"
},
"resolutions": {
"angular": ">=1.3"
}
}