improvements+fixes
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
<page-notfound *ngIf="notfound"></page-notfound>
|
||||
<ng-container *ngIf="entry">
|
||||
<ui-entry [entry]="entry" [change]="boundRefresh"></ui-entry>
|
||||
<div class="container">
|
||||
<page-notfound *ngIf="notfound"></page-notfound>
|
||||
<ng-container *ngIf="entry">
|
||||
<ui-entry [entry]="entry" [change]="boundRefresh"></ui-entry>
|
||||
|
||||
<p>{{entry.text}}</p>
|
||||
<p class="text">{{entry.text}}</p>
|
||||
|
||||
<ui-commentform [target]="entry.id" [change]="boundReplyCallback"></ui-commentform>
|
||||
<ui-commentform [target]="entry.id" [change]="boundReplyCallback"></ui-commentform>
|
||||
|
||||
<ng-container *ngIf="entry.metadata.comments">
|
||||
<ui-comments [target]="entry.id"></ui-comments>
|
||||
<ng-container *ngIf="entry.metadata.comments">
|
||||
<ui-comments [target]="entry.id"></ui-comments>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
.text {
|
||||
max-width: 100%;
|
||||
white-space: break-spaces;
|
||||
word-break: break-all;
|
||||
}
|
||||
@@ -7,7 +7,8 @@ import { CommentService } from '../../services/comment.service';
|
||||
|
||||
@Component({
|
||||
selector: 'page-entry',
|
||||
templateUrl: './entry.page.html'
|
||||
templateUrl: './entry.page.html',
|
||||
styleUrls: [ './entry.page.scss' ]
|
||||
})
|
||||
export class PageEntry implements OnInit {
|
||||
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
</mat-error>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<a class="external-login" href="{{apiUrl}}/{{client.loginUrl}}" *ngFor="let client of externals"
|
||||
mat-raised-button color="accent">{{'login.external.client' | i18n:client.id}}</a>
|
||||
<a class="external-login" (click)="externalLogin(client)" *ngFor="let client of externals" mat-raised-button
|
||||
color="accent">{{'login.external.client' | i18n:client.id}}</a>
|
||||
<mat-slide-toggle [(ngModel)]="autologin">
|
||||
{{'login.autologin' | i18n}}
|
||||
</mat-slide-toggle>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
<form *ngIf="internalLogin || externals && externals.length < 1" action="{{apiUrl}}/login" method="POST" #loginForm>
|
||||
<mat-card>
|
||||
<form action="{{apiUrl}}/login" method="POST" #loginForm>
|
||||
<mat-card *ngIf="internalLogin || externals && externals.length < 1">
|
||||
<mat-card-content>
|
||||
<h2>{{'login.internal' | i18n}}</h2>
|
||||
<mat-error *ngIf="loginInvalid">
|
||||
|
||||
@@ -13,6 +13,7 @@ import { AuthService } from '../../services/auth.service';
|
||||
export class PageLogin implements OnInit {
|
||||
|
||||
@ViewChild('loginForm') loginForm: ElementRef;
|
||||
autologin: boolean = false;
|
||||
internalLogin: boolean;
|
||||
loginInvalid: boolean;
|
||||
externalLoginInvalid: boolean;
|
||||
@@ -46,6 +47,12 @@ export class PageLogin implements OnInit {
|
||||
|
||||
this.authService.getExternal().subscribe((data: any[]) => {
|
||||
this.externals = data;
|
||||
const autologinClient = localStorage.getItem("bstlboard.autologin");
|
||||
for (let client of this.externals) {
|
||||
if (client.id == autologinClient) {
|
||||
window.location.href = this.apiUrl + "/" + client.loginUrl;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
@@ -56,5 +63,15 @@ export class PageLogin implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
externalLogin(client: any): void {
|
||||
console.log(this.autologin);
|
||||
if (this.autologin) {
|
||||
localStorage.setItem("bstlboard.autologin", client.id);
|
||||
} else {
|
||||
localStorage.removeItem("bstlboard.autologin");
|
||||
}
|
||||
|
||||
window.location.href = this.apiUrl + "/" + client.loginUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,19 +11,17 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<textarea matInput placeholder="{{'settings.about' | i18n}}" formControlName="about"></textarea>
|
||||
<textarea [mat-autosize] [matAutosizeMinRows]="3" matInput placeholder="{{'settings.about' | i18n}}" formControlName="about"></textarea>
|
||||
<mat-error>
|
||||
{{'settings.about.error' | i18n}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-slide-toggle (change)="darkThemeChange($event)" [checked]="user.darkTheme">
|
||||
{{'settings.darkTheme' | i18n}}
|
||||
</mat-slide-toggle>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">
|
||||
{{'settings.update' | i18n}}
|
||||
</button>
|
||||
<a *ngIf="success" mat-button color="primary">{{'settings.success' | i18n}}</a>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ export class PageSettings implements OnInit {
|
||||
auth: any;
|
||||
user: any;
|
||||
working: boolean = false;
|
||||
success: boolean = false;
|
||||
form: FormGroup;
|
||||
@ViewChild('formDirective') private formDirective: NgForm;
|
||||
|
||||
@@ -25,7 +26,6 @@ export class PageSettings implements OnInit {
|
||||
username: [ { disabled: true }, Validators.nullValidator ],
|
||||
email: [ '', Validators.nullValidator ],
|
||||
about: [ '', Validators.nullValidator ],
|
||||
darkTheme: [ '', Validators.nullValidator ],
|
||||
});
|
||||
|
||||
this.form.get('username').disable();
|
||||
@@ -35,14 +35,9 @@ export class PageSettings implements OnInit {
|
||||
this.form.get('username').setValue(this.user.username);
|
||||
this.form.get('email').setValue(this.user.email);
|
||||
this.form.get('about').setValue(this.user.about);
|
||||
this.form.get('darkTheme').setValue(this.user.darkTheme);
|
||||
})
|
||||
}
|
||||
|
||||
darkThemeChange($event) {
|
||||
this.user.darkTheme = $event.checked;
|
||||
}
|
||||
|
||||
hasError(controlName: string): boolean {
|
||||
return this.form.controls[ controlName ].errors != null;
|
||||
}
|
||||
@@ -53,6 +48,7 @@ export class PageSettings implements OnInit {
|
||||
}
|
||||
|
||||
this.working = true;
|
||||
this.success = false;
|
||||
|
||||
this.user.about = this.form.get('about').value;
|
||||
this.user.email = this.form.get('email').value;
|
||||
@@ -60,6 +56,7 @@ export class PageSettings implements OnInit {
|
||||
this.userService.update(this.user).subscribe((data) => {
|
||||
this.user = data;
|
||||
this.working = false;
|
||||
this.success = true;
|
||||
}, (error) => {
|
||||
this.working = false;
|
||||
if (error.status == 422) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<textarea matInput placeholder="{{'submission.text' | i18n}}" formControlName="text"></textarea>
|
||||
<textarea [mat-autosize] [matAutosizeMinRows]="3" matInput placeholder="{{'submission.text' | i18n}}" formControlName="text"></textarea>
|
||||
<mat-error>
|
||||
{{'submission.text.error' | i18n}}
|
||||
</mat-error>
|
||||
|
||||
Reference in New Issue
Block a user