Files
bstlboard-front/src/app/ui/comment/comment.ui.html
T
2021-10-07 14:00:52 +02:00

95 lines
4.6 KiB
HTML

<div class="comment">
<div mat-line>
<small>
<ng-container *ngIf="comment.metadata && !comment.metadata.unvote">
<a href="javascript:" (click)="voteUp(comment.id)" matTooltip="{{'vote.up' | i18n}}">
<mat-icon inline="true">thumb_up</mat-icon>
</a>
<span>&nbsp;</span>
<a href="javascript:" (click)="voteDown(comment.id)" matTooltip="{{'vote.down' | i18n}}">
<mat-icon inline="true">thumb_down</mat-icon>
</a>
<span>&nbsp;</span>
</ng-container>
<span class="voted" *ngIf="comment.metadata && comment.metadata.unvote">
<mat-icon *ngIf="comment.metadata && comment.metadata.upvoted" inline="true">thumb_up</mat-icon>
<mat-icon *ngIf="comment.metadata && comment.metadata.downvoted" inline="true">thumb_down</mat-icon>
<span>&nbsp;</span>
</span>
<a routerLink="/c/{{comment.id}}" matTooltip="{{comment.created | datef:'LLLL'}}">{{ (comment.modified ||
comment.created)
| datef}}</a>
<span *ngIf="comment.metadata && comment.metadata.author"> {{'comment.author' | i18n}}<a
routerLink="/u/{{comment.author}}">{{comment.author}}</a></span>
<span *ngIf="parentLink && comment.parent"> {{'comment.to' | i18n}} <a
routerLink="/c/{{comment.parent}}">{{'comment' | i18n}}</a></span>
<span *ngIf="comment.metadata && comment.metadata.entry"> {{'comment.on' | i18n}} <a class="entry"
routerLink="/e/{{comment.target}}">{{comment.metadata.entry || 'entry'}}</a></span>
<span *ngIf="comment.metadata && comment.metadata.unvote"> | </span>
<a *ngIf="comment.metadata.unvote" href="javascript:" (click)="unvote()">{{'comment.unvote' | i18n}}</a>
<span> | </span>
<a *ngIf="comment.metadata && comment.metadata.flag" href="javascript:" (click)="flag(comment.id)" matTooltip="{{'comment.flag' |
i18n}}">
<mat-icon inline="true">outlined_flag</mat-icon>
</a>
<a *ngIf="comment.metadata && comment.metadata.unflag" href="javascript:" (click)="unflag(comment.id)"
matTooletip="{{'comment.unflag' |
i18n}}">
<mat-icon inline="true">flag</mat-icon>
</a>
</small>
</div>
<ng-container *ngIf="!comment.metadata || !comment.metadata.edit">
<div mat-line class="text"
[style.opacity]="comment.metadata && comment.metadata.points && comment.metadata.points < 0 ? 1 + (comment.metadata.points / 10) : '1.0'"
[innerHTML]="comment.text | urltext"></div>
<div mat-line>
<small>
<a href="javascript:" (click)="comment.metadata.reply=!comment.metadata.reply">{{(comment.metadata.reply ?
'comment.replyHide' : 'comment.reply') | i18n}}</a>
<span *ngIf="canEdit()"> | </span>
<a *ngIf="canEdit()" href="javascript:" (click)="edit()">{{'comment.edit' | i18n}}</a>
<ng-container *ngIf="moderator">
<span *ngIf="comment.flaggedStatus == 'FLAGGED'"> | </span>
<a *ngIf="comment.flaggedStatus == 'FLAGGED'" href="javascript:" (click)="modUnflagComment()">{{'moderation.comment.unflag' |
i18n}}</a>
<span> | </span>
<a href="javascript:" (click)="modDeleteComment(comment)">{{'moderation.comment.delete' |
i18n}}</a>
</ng-container>
</small>
</div>
</ng-container>
<ng-container *ngIf="comment.metadata && comment.metadata.edit">
<form [formGroup]="form" (ngSubmit)="update()" #formDirective="ngForm">
<mat-form-field>
<textarea [mat-autosize] [matAutosizeMinRows]="3" matInput formControlName="text"
placeholder="{{'comment.text' | i18n}}" required></textarea>
<mat-error *ngIf="hasError('text')">
{{'comment.text.error' | i18n}}
</mat-error>
</mat-form-field>
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">
{{'comment.save' | i18n}}
</button>
</form>
<div mat-line>
<small>
<a href="javascript:" (click)="comment.metadata.edit = false">{{'cancel' | i18n}}</a>
<span> | </span>
<a href="javascript:" (click)="deleteComment(comment)">{{'comment.delete' | i18n}}</a>
</small>
</div>
</ng-container>
<div mat-line>
<ui-commentform *ngIf="comment.metadata.reply" [target]="comment.target" [parent]="comment.id"
(replyCommentEvent)="replyCallback($event)"></ui-commentform>
</div>
</div>
<ui-comments *ngIf="subcomments && comment.metadata && (comment.metadata.comments > 0 || comment.metadata.reply)"
#subcomments [target]="comment.target" [parent]="comment.id" [subcomments]="subcomments"></ui-comments>