Browse Source

Small UI fixes.

pull/348/head
Sebastian Stehle 8 years ago
parent
commit
062d4297aa
  1. 2
      src/Squidex/app/features/content/pages/content/content-field.component.html
  2. 4
      src/Squidex/app/features/content/pages/content/content-field.component.ts
  3. 16
      src/Squidex/app/framework/angular/ignore-scrollbar.directive.ts
  4. 13
      src/Squidex/app/framework/angular/modals/modal-view.directive.ts
  5. 31
      src/Squidex/app/framework/angular/modals/tooltip.directive.ts
  6. 2
      src/Squidex/app/shared/components/markdown-editor.component.ts
  7. 2
      src/Squidex/app/shared/components/rich-editor.component.ts
  8. 2
      src/Squidex/app/shared/services/schemas.service.ts

2
src/Squidex/app/features/content/pages/content/content-field.component.html

@ -2,7 +2,7 @@
<div [class.col-12]="!fieldFormCompare" [class.col-6]="fieldFormCompare"> <div [class.col-12]="!fieldFormCompare" [class.col-6]="fieldFormCompare">
<div class="table-items-row" [class.field-invalid]="isInvalid | async"> <div class="table-items-row" [class.field-invalid]="isInvalid | async">
<div class="languages-buttons"> <div class="languages-buttons">
<button *ngIf="isTranslateable" type="button" class="btn btn-text-secondary btn-sm mr-1" (click)="translate()" title="Autotranslate from master language"> <button *ngIf="isTranslatable" type="button" class="btn btn-text-secondary btn-sm mr-1" (click)="translate()" title="Autotranslate from master language">
<i class="icon-translate"></i> <i class="icon-translate"></i>
</button> </button>

4
src/Squidex/app/features/content/pages/content/content-field.component.ts

@ -62,7 +62,7 @@ export class ContentFieldComponent implements OnChanges {
public isInvalid: Observable<boolean>; public isInvalid: Observable<boolean>;
public isDifferent: Observable<boolean>; public isDifferent: Observable<boolean>;
public isTranslateable: boolean; public isTranslatable: boolean;
constructor( constructor(
private readonly appsState: AppsState, private readonly appsState: AppsState,
@ -81,7 +81,7 @@ export class ContentFieldComponent implements OnChanges {
} }
if (changes['fieldForm'] || changes['field'] || changes['languages']) { if (changes['fieldForm'] || changes['field'] || changes['languages']) {
this.isTranslateable = this.field.isTranslateable; this.isTranslatable = this.field.isTranslatable;
} }
if ((changes['fieldForm'] || changes['fieldFormCompare']) && this.fieldFormCompare) { if ((changes['fieldForm'] || changes['fieldFormCompare']) && this.fieldFormCompare) {

16
src/Squidex/app/framework/angular/ignore-scrollbar.directive.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { AfterViewInit, Directive, ElementRef, OnInit, Renderer2 } from '@angular/core'; import { AfterViewInit, Directive, ElementRef, HostListener, OnInit, Renderer2 } from '@angular/core';
import { timer } from 'rxjs'; import { timer } from 'rxjs';
import { ResourceOwner } from '@app/framework/internal'; import { ResourceOwner } from '@app/framework/internal';
@ -24,15 +24,13 @@ export class IgnoreScrollbarDirective extends ResourceOwner implements OnInit, A
super(); super();
} }
public ngOnInit() { @HostListener('resize)')
if (!this.parent) { public onResize() {
this.parent = this.renderer.parentNode(this.element.nativeElement); this.reposition();
} }
this.own( public ngOnInit() {
this.renderer.listen(this.element.nativeElement, 'resize', () => { this.parent = this.renderer.parentNode(this.element.nativeElement);
this.reposition();
}));
this.own(timer(100, 100).subscribe(() => this.reposition)); this.own(timer(100, 100).subscribe(() => this.reposition));
} }

13
src/Squidex/app/framework/angular/modals/modal-view.directive.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/ */
import { Directive, EmbeddedViewRef, Input, OnChanges, OnDestroy, Renderer2, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core'; import { ChangeDetectorRef, Directive, EmbeddedViewRef, Input, OnChanges, OnDestroy, Renderer2, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { import {
@ -37,10 +37,11 @@ export class ModalViewDirective implements OnChanges, OnDestroy {
public closeAlways = false; public closeAlways = false;
constructor( constructor(
private readonly templateRef: TemplateRef<any>, private readonly changeDetector: ChangeDetectorRef,
private readonly renderer: Renderer2, private readonly renderer: Renderer2,
private readonly viewContainer: ViewContainerRef, private readonly rootView: RootViewComponent,
private readonly rootView: RootViewComponent private readonly templateRef: TemplateRef<any>,
private readonly viewContainer: ViewContainerRef
) { ) {
} }
@ -87,6 +88,8 @@ export class ModalViewDirective implements OnChanges, OnDestroy {
setTimeout(() => { setTimeout(() => {
this.startListening(); this.startListening();
}); });
this.changeDetector.detectChanges();
} else if (!isOpen && this.renderedView) { } else if (!isOpen && this.renderedView) {
const container = this.getContainer(); const container = this.getContainer();
const containerIndex = container.indexOf(this.renderedView); const containerIndex = container.indexOf(this.renderedView);
@ -96,6 +99,8 @@ export class ModalViewDirective implements OnChanges, OnDestroy {
this.renderedView = null; this.renderedView = null;
this.unsubscribeToClick(); this.unsubscribeToClick();
this.changeDetector.detectChanges();
} }
} }

31
src/Squidex/app/framework/angular/modals/tooltip.directive.ts

@ -7,15 +7,15 @@
// tslint:disable:directive-selector // tslint:disable:directive-selector
import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core'; import { Directive, ElementRef, HostListener, Input, Renderer2 } from '@angular/core';
import { DialogService, ResourceOwner } from '@app/framework/internal'; import { DialogService } from '@app/framework/internal';
import { Tooltip } from '@app/shared'; import { Tooltip } from '@app/shared';
@Directive({ @Directive({
selector: '[title]' selector: '[title]'
}) })
export class TooltipDirective extends ResourceOwner implements OnInit { export class TooltipDirective {
private titleText: string; private titleText: string;
@Input() @Input()
@ -33,23 +33,20 @@ export class TooltipDirective extends ResourceOwner implements OnInit {
private readonly element: ElementRef, private readonly element: ElementRef,
private readonly renderer: Renderer2 private readonly renderer: Renderer2
) { ) {
super();
} }
public ngOnInit() { @HostListener('mouseenter')
const target = this.element.nativeElement; public onMouseEnter() {
if (this.titleText) {
this.own( this.dialogs.tooltip(new Tooltip(this.element.nativeElement, this.titleText, this.titlePosition));
this.renderer.listen(target, 'mouseenter', () => { }
if (this.titleText) { }
this.dialogs.tooltip(new Tooltip(target, this.titleText, this.titlePosition));
}
}));
this.own( @HostListener('mouseleave')
this.renderer.listen(this.element.nativeElement, 'mouseleave', () => { public onMouseLeave() {
this.dialogs.tooltip(new Tooltip(target, null, this.titlePosition)); if (this.titleText) {
})); this.dialogs.tooltip(new Tooltip(this.element.nativeElement, null, this.titlePosition));
}
} }
private unsetAttribute() { private unsetAttribute() {

2
src/Squidex/app/shared/components/markdown-editor.component.ts

@ -83,8 +83,6 @@ export class MarkdownEditorComponent extends StatefulControlComponent<State, str
private showSelector = () => { private showSelector = () => {
this.assetsDialog.show(); this.assetsDialog.show();
this.detectChanges();
} }
public ngAfterViewInit() { public ngAfterViewInit() {

2
src/Squidex/app/shared/components/rich-editor.component.ts

@ -83,8 +83,6 @@ export class RichEditorComponent extends StatefulControlComponent<any, string> i
private showSelector = () => { private showSelector = () => {
this.assetsDialog.show(); this.assetsDialog.show();
this.detectChanges();
} }
private getEditorOptions() { private getEditorOptions() {

2
src/Squidex/app/shared/services/schemas.service.ts

@ -136,7 +136,7 @@ export class RootFieldDto extends FieldDto {
return this.properties.fieldType === 'String'; return this.properties.fieldType === 'String';
} }
public get isTranslateable() { public get isTranslatable() {
return this.isLocalizable && this.isString && (this.properties.editor === 'Input' || this.properties.editor === 'Textarea'); return this.isLocalizable && this.isString && (this.properties.editor === 'Input' || this.properties.editor === 'Textarea');
} }

Loading…
Cancel
Save