Skip to content

Commit

Permalink
gh-582 Polish CSS styles
Browse files Browse the repository at this point in the history
  • Loading branch information
ghillert committed Jan 31, 2018
1 parent 2fc702d commit 702ef14
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 15 deletions.
36 changes: 34 additions & 2 deletions ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ import { Component, DoCheck } from '@angular/core';
import { ToastyConfig } from 'ng2-toasty';
import { AuthService } from './auth/auth.service';
import { SecurityInfo } from './auth/model/security-info.model';
import { Renderer2 } from '@angular/core';
import { OnInit } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent implements DoCheck {
export class AppComponent implements DoCheck, OnInit {

public securityInfo: SecurityInfo;
public isCollapsed = true;

constructor(private toastyConfig: ToastyConfig, private authService: AuthService) {
constructor(private toastyConfig: ToastyConfig,
private renderer: Renderer2,
private authService: AuthService) {
this.toastyConfig.theme = 'bootstrap';
this.toastyConfig.limit = 5;
this.toastyConfig.showClose = true;
Expand All @@ -26,6 +30,34 @@ export class AppComponent implements DoCheck {
this.securityInfo = this.authService.securityInfo;
}

ngOnInit() {
this.renderer.listen('document', 'scroll', (evt) => {
this.updateToasty();
});
this.renderer.listen('document', 'resize', (evt) => {
this.updateToasty();
});
this.updateToasty();
}

private updateToasty() {
const bodyScrollTop = window.pageYOffset || document.documentElement.scrollTop;
const navHeight = document.getElementsByTagName('nav')[0].offsetHeight;
let marginToParent = 10;
const toastyElement = document.getElementById('toasty');

if (window.outerWidth <= 768) {
marginToParent = 0;
}

if (bodyScrollTop > navHeight) {
toastyElement.style.top = marginToParent + 'px';
} else if (bodyScrollTop >= 0) {
const distance = navHeight - bodyScrollTop;
toastyElement.style.top = distance + marginToParent + 'px';
}
}

public toggleCollapse(): void {
this.isCollapsed = !this.isCollapsed;
}
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/apps/apps.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1 [ngBusy]="busy">Apps</h1>
</p>

<div class="row">
<div class="col-md-18">
<div class="col-xs-10 col-md-18">
<button id="registerApplicationButton" type="button" (click)="registerApps()"
class="btn btn-default" [appRoles]="['ROLE_CREATE']"
><span class="glyphicon glyphicon-plus"></span>
Expand All @@ -26,9 +26,9 @@ <h1 [ngBusy]="busy">Apps</h1>
<span class="hidden-xs">Bulk Import Applications</span>
</button>
</div>
<div class="col-md-6 text-right">
<div class="col-xs-14 col-md-6 text-right">
<label *ngIf="appRegistrations" class="control">
<input type="text" class="input" placeholder="Filter items" [(ngModel)]="appRegistrations.filter" >
<input type="text" class="input filter-input" placeholder="Filter items" [(ngModel)]="appRegistrations.filter" >
</label>
<button id="refreshAppRegistrationsButton" type="button" (click)="loadAppRegistrations(true)"
class="btn btn-default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
</div>
<div class="row">
<div class="col-md-19 col-actions">
<div class="col-xs-10 col-md-19 col-actions">
<app-tri-state-button *ngIf="streamDefinitions?.items" class="toggle-all" [appRoles]="['ROLE_CREATE']"
[items]="streamDefinitions.getItemsAsObservable()"
(eventHandler)="deployMultipleStreamDefinitions(streamDefinitions.items)"
Expand Down Expand Up @@ -47,9 +47,9 @@
icon="remove"
></app-tri-state-button>
</div>
<div class="col-md-5 text-right" style="padding-left: 0;">
<div class="col-xs-14 col-md-5 text-right" style="padding-left: 0;">
<label *ngIf="streamDefinitions" class="control">
<input type="text" class="input" placeholder="Filter definitions" [(ngModel)]="streamDefinitions.filter">
<input type="text" class="input filter-input" placeholder="Filter definitions" [(ngModel)]="streamDefinitions.filter">
</label>
<button *ngIf="streamDefinitions" type="button" (click)="loadStreamDefinitions()"
class="btn btn-default">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

<ng-template [ngBusy]="{busy: busy, wrapperClass: 'ng-busy ng-busy-no-margin', minDuration: 2000}"></ng-template>
<div class="row">
<div class="col-md-19">
<div class="col-xs-8">
<button type="button" [appRoles]="['ROLE_CREATE']" (click)="bulkDefineTasks()"
class="btn btn-default">
<span class="glyphicon glyphicon-import"></span>
<span class="hidden-xs">Bulk Define Tasks</span>
</button>
</div>
<div class="col-md-5 text-right" style="padding-left: 0;">
<div class="col-xs-16 text-right" style="padding-left: 0;">
<label *ngIf="taskDefinitions" class="control">
<input type="text" class="input" placeholder="Filter definitions" [(ngModel)]="taskDefinitions.filter">
<input type="text" class="input filter-input" placeholder="Filter definitions" [(ngModel)]="taskDefinitions.filter">
</label>
<button *ngIf="taskDefinitions" type="button" (click)="loadTaskDefinitions()"
class="btn btn-default">
Expand Down
8 changes: 4 additions & 4 deletions ui/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ body {
margin-right: 2px;
}

#toasty {
top: unset !important;
}

.navbar {

.container {
Expand Down Expand Up @@ -153,6 +149,10 @@ body {
.form-control-feedback {
top: 5px;
}

.filter-input {
max-width: 125px;
}
// ~~~~ responsive

@media (max-width: 768px) {
Expand Down

0 comments on commit 702ef14

Please sign in to comment.