bstlboard-front/src/app/ui/comment/comment.ui.html

99 lines
4.9 KiB
HTML

<div class="comment">
<div mat-line>
<mat-icon color="warn" *ngIf="comment.flaggedStatus == 'FLAGGED'">outlined_flag</mat-icon>
<span *ngIf="index">{{index}}.&nbsp;</span>
<small>
<ng-container *ngIf="comment.metadata && !comment.metadata.unvote && actions">
<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 && actions"> | </span>
<a *ngIf="comment.metadata.unvote" href="javascript:" (click)="unvote()">{{'comment.unvote' | i18n}}</a>
<span *ngIf="comment.metadata && comment.metadata.flag"> | </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>
<span *ngIf="comment.metadata && comment.metadata.unflag"> | </span>
<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 *ngIf="actions">
<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>
<span class="mod" *ngIf="moderator">
<span *ngIf="comment.metadata.flagged"> | </span>
<a *ngIf="comment.metadata.flagged" href="javascript:"
(click)="modUnflagComment()">{{'moderation.comment.unflag' |
i18n}}</a>
<span> | </span>
<a href="javascript:" (click)="modDeleteComment(comment)">{{'moderation.comment.delete' |
i18n}}</a>
</span>
</small>
</div>
</ng-container>
<ng-container *ngIf="comment.metadata && comment.metadata.edit">
<form [formGroup]="form" (ngSubmit)="update()" #formDirective="ngForm">
<mat-form-field>
<mat-label>{{'comment.text' | i18n}}</mat-label>
<textarea matAutosize matAutosizeMinRows="3" matInput formControlName="text" required></textarea>
<mat-error *ngIf="hasError('text')">
{{'comment.text.error' | i18n}}
</mat-error>
</mat-form-field>
<button type="submit" *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>