Skip to content

Commit

Permalink
Merge pull request #371 from cultuurnet/fix/modal-under-header
Browse files Browse the repository at this point in the history
fix: modal appearing under header
  • Loading branch information
hirviid authored Oct 30, 2023
2 parents 9084694 + 226db5f commit 6092d80
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 24 deletions.
1 change: 1 addition & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

<!-- Utilities -->
<script src="scripts/utilities/ubr.utilities.module.js"></script>
<script src="scripts/utilities/iframe-utils.js"></script>
<!-- Controllers-->
<script src="scripts/utilities/app.controller.js"></script>
<script src="scripts/utilities/login.controller.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ angular
controllerAs: 'psc'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe() ? '' : 'views/header.html'
}
},
params: {
Expand Down Expand Up @@ -146,7 +146,7 @@ angular
nfcService.init();
eIDService.init();

var runningInIframe = window !== window.parent;
var runningInIframe = isRunningInIframe();

$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
// Don't block any state changes if not running inside an iframe
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/counter/activities/ubr.activities.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ angular
templateUrl: 'views/counter-activities/sidebar-counter-activities.html'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe() ? '' : 'views/header.html'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ angular
templateUrl: 'views/checkindevices/sidebar-checkindevices.html'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe() ? '' : 'views/header.html'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ angular
])
/* @ngInject */
.config(function ($stateProvider) {

/* @ngInject */
function showCreateMembershipModal($uibModal, $state) {
$uibModal
Expand Down Expand Up @@ -49,7 +48,7 @@ angular
templateUrl: 'views/counter-membership/sidebar-info.html'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe() ? '' : 'views/header.html'
}
},
params: {
Expand Down
11 changes: 6 additions & 5 deletions app/scripts/counter/statistics/ubr.counter-statistics.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ angular
'ubr.counter',
'daterangepicker'
])
.constant('isRunningInIframe', isRunningInIframe())
/* @ngInject */
.config(function ($stateProvider) {
.config(function ($stateProvider, isRunningInIframe) {

$stateProvider
.state('counter.statistics', {
Expand All @@ -31,7 +32,7 @@ angular
templateUrl: 'views/counter-statistics/sidebar-info.html'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe ? '' : 'views/header.html'
}
}
})
Expand All @@ -49,7 +50,7 @@ angular
templateUrl: 'views/counter-statistics/sidebar-info.html'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe ? '' : 'views/header.html'
}
}
})
Expand All @@ -66,7 +67,7 @@ angular
templateUrl: 'views/counter-statistics/sidebar-info.html'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe ? '' : 'views/header.html'
}
}
})
Expand All @@ -83,7 +84,7 @@ angular
templateUrl: 'views/counter-statistics/sidebar-info.html'
},
header: {
templateUrl: 'views/header.html'
templateUrl: isRunningInIframe ? '' : 'views/header.html'
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/utilities/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function appController($rootScope, $location, $state, $stateParams, appConfig, u
app.user = undefined;
app.counter = undefined;
app.buildNumber = appConfig.buildNumber;
app.runningInIframe = window !== window.parent;
app.runningInIframe = isRunningInIframe();

function browserEngineIsOlderThan(requiredEngineVersion){
var matches = navigator.userAgent.match(/(.*)\/(.*)$/);
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/utilities/iframe-utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
window.isRunningInIframe = function () {
return window !== window.parent;
};
2 changes: 1 addition & 1 deletion app/scripts/utilities/uitid.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function uitidService($q, $window, $http, appConfig) {
*/
uitId.getUser = function() {
var deferredUser = $q.defer();
var runningInIframe = window !== window.parent;
var runningInIframe = isRunningInIframe();

if (uitId.user) {
deferredUser.resolve(uitId.user);
Expand Down
24 changes: 14 additions & 10 deletions app/styles/components/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ body {
background-color: $white;
}

.main-content {
.main-content--iframe {
min-height: 100%;
position: relative;
@include breakpoint(map-get($breakpoints, sml)) {
padding-top: 50px;
}
@include breakpoint(map-get($breakpoints, med)) {
padding-top: 60px;
}

@include breakpoint(map-get($breakpoints, sml)) {
> .main,
> .footer {
Expand All @@ -28,7 +23,6 @@ body {
position: fixed;
height: 100%;
top: 0;
padding-top: 50px;
left: 0;
z-index: 700;
}
Expand All @@ -49,6 +43,16 @@ body {
padding-right: 15px;
}
}
}

.main-content {
@extend .main-content--iframe;
@include breakpoint(map-get($breakpoints, sml)) {
padding-top: 50px;
}
@include breakpoint(map-get($breakpoints, med)) {
padding-top: 60px;
}
@include breakpoint(768px) {
> .sidebar {
padding-top: 60px;
Expand All @@ -65,8 +69,8 @@ body {
padding-top: 60px;
} */
}
.navbar {
@include breakpoint(660px) {
.navbar {
@include breakpoint(660px) {
position: fixed;
left: 0;
top: 0;
Expand Down
2 changes: 1 addition & 1 deletion app/views/split-view.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<header ui-view="header" class="header" role="banner" ng-show="app.user">
</header> <!--/ .header -->

<div class="main-content clearfix">
<div ng-class="{'main-content--iframe': app.runningInIframe, 'main-content': !app.runningInIframe}" class="clearfix">

<aside role="complementary" class="sidebar grid__12 grid--bp-sml__5 grid--bp-med__4 grid--bp-xlr__3">
<div ui-view="sidebar" class="inside" ng-show="app.user">
Expand Down

0 comments on commit 6092d80

Please sign in to comment.