Fix decoration list preview image dimensions

pull/1/head
Florian Hartwich 2017-05-16 23:51:03 +02:00
parent f582bc5fce
commit f6037a1913
3 changed files with 12 additions and 4 deletions

View File

@ -13,7 +13,11 @@
</div>
<div class="col-xs-3">
<img src="{{imageSrc}}" height="{{decoration.isMedal ? 50 : 20}}" [style.margin-top]="previewMargin" class="decoration-list-preview">
<img src="{{imageSrc}}"
[style.max-height]="imgStyle.height"
[style.max-width]="imgStyle.width"
[style.margin-top]="imgStyle.marginTop"
class="decoration-list-preview">
<span (click)="delete(); $event.stopPropagation()" title="Löschen" class="glyphicon glyphicon-trash trash"></span>
</div>
</div>

View File

@ -15,7 +15,7 @@ export class DecorationItemComponent {
selected: boolean;
decoration: Decoration;
imageSrc;
previewMargin;
imgStyle = {width: '', height: '', marginTop: ''};
decorationSelected = new EventEmitter();
decorationDelete = new EventEmitter();
@ -26,7 +26,11 @@ export class DecorationItemComponent {
ngOnInit() {
this.imageSrc = 'resource/decoration/' + this.decoration._id + '.png?' + Date.now();
if (!this.decoration.isMedal) {
this.previewMargin = '17px'
this.imgStyle.width = '62px';
this.imgStyle.marginTop = '17px'
} else {
this.imgStyle.height = '50px';
this.imgStyle.marginTop = '3px'
}
}

View File

@ -58,7 +58,7 @@ export class DecorationListComponent implements OnInit {
}
deleteDecoration(decoration) {
let fraction = 'GLOBAL';
let fraction = 'Global';
if (decoration.fraction === 'BLUFOR') fraction = 'NATO';
else if (decoration.fraction === 'OPFOR') fraction = 'CSAT';