flagging
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<div class="container">
|
||||
<mat-progress-bar *ngIf="!comments || !comments.content" mode="indeterminate"></mat-progress-bar>
|
||||
|
||||
<div *ngIf="comments && comments.content" fxLayout="column" fxFlexFill class="comments">
|
||||
<ng-container *ngFor="let comment of comments.content; let i = index">
|
||||
<mat-divider class="divider" *ngIf="i > 0"></mat-divider>
|
||||
<ui-comment class="comment" [comment]="comment" [subcomments]="false" [parentLink]="true" [change]="boundRefresh">
|
||||
</ui-comment>
|
||||
</ng-container>
|
||||
|
||||
<mat-list *ngIf="comments.totalElements == 0">
|
||||
<mat-list-item>
|
||||
<p>{{'comments.nothing' | i18n}}</p>
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
|
||||
<small *ngIf="comments.totalElements > comments.content.length">
|
||||
<a mat-stroked-button color="primary" (click)="showMore()">{{'comments.showMore' | i18n}}</a>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ModerationService } from '../../../services/moderarion.service';
|
||||
|
||||
@Component({
|
||||
selector: 'page-moderation-comments',
|
||||
templateUrl: './moderation.comments.page.html'
|
||||
})
|
||||
export class PageModerationComments implements OnInit {
|
||||
|
||||
comments: any = {};
|
||||
boundRefresh: Function;
|
||||
|
||||
constructor(private moderationService: ModerationService,) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.boundRefresh = this.refresh.bind(this);
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
refresh(): void {
|
||||
this.moderationService.getFlaggedComments(this.comments.number || 0, this.comments.size || 30).subscribe((data: any) => {
|
||||
this.comments = data;
|
||||
}, (error) => { })
|
||||
}
|
||||
|
||||
showMore() {
|
||||
const oldContent: any[] = this.comments.content;
|
||||
this.moderationService.getFlaggedComments(this.comments.number + 1, this.comments.size).subscribe((data) => {
|
||||
this.comments = data;
|
||||
for (let comment of this.comments.content) {
|
||||
oldContent.push(comment);
|
||||
}
|
||||
this.comments.content = oldContent;
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<page-entries [fetch]="boundFetch"></page-entries>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { ModerationService } from '../../../services/moderarion.service';
|
||||
|
||||
@Component({
|
||||
selector: 'page-moderation-entries',
|
||||
templateUrl: './moderation.entries.page.html'
|
||||
})
|
||||
export class PageModerationEntries implements OnInit {
|
||||
|
||||
boundFetch: Function;
|
||||
|
||||
constructor(private moderationService: ModerationService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.boundFetch = this.fetch.bind(this);
|
||||
}
|
||||
|
||||
fetch(page: number, size: number) {
|
||||
return this.moderationService.getFlaggedEntries(page, size);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user