Skip to content

Commit

Permalink
Communication: Remove context duplication while editing answers (ls…
Browse files Browse the repository at this point in the history
  • Loading branch information
canberkanar authored Aug 22, 2022
1 parent de872c1 commit a8ea90a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row m-1 answer-post">
<jhi-answer-post-header [posting]="posting" (openPostingCreateEditModal)="createAnswerPostModal.open()"></jhi-answer-post-header>
<jhi-posting-content [content]="posting.content"></jhi-posting-content>
<jhi-posting-content *ngIf="!createAnswerPostModal.isInputOpen" [content]="posting.content"></jhi-posting-content>
<ng-container #createEditAnswerPostContainer></ng-container>
<jhi-answer-post-footer [posting]="posting" [isLastAnswer]="isLastAnswer" (openPostingCreateEditModal)="openPostingCreateEditModal.emit()"></jhi-answer-post-footer>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { PostContentValidationPattern } from 'app/shared/metis/metis.util';
export class AnswerPostCreateEditModalComponent extends PostingCreateEditModalDirective<AnswerPost> {
@Input() createEditAnswerPostContainerRef: ViewContainerRef;
editorHeight = MarkdownEditorHeight.INLINE;
isInputOpen = false;

constructor(protected metisService: MetisService, protected modalService: NgbModal, protected formBuilder: FormBuilder) {
super(metisService, modalService, formBuilder);
Expand All @@ -27,6 +28,7 @@ export class AnswerPostCreateEditModalComponent extends PostingCreateEditModalDi
open(): void {
this.close();
this.createEditAnswerPostContainerRef.createEmbeddedView(this.postingEditor);
this.isInputOpen = true;
}

/**
Expand All @@ -35,6 +37,7 @@ export class AnswerPostCreateEditModalComponent extends PostingCreateEditModalDi
close(): void {
this.createEditAnswerPostContainerRef.clear();
this.resetFormGroup();
this.isInputOpen = false;
}

/**
Expand Down Expand Up @@ -75,6 +78,7 @@ export class AnswerPostCreateEditModalComponent extends PostingCreateEditModalDi
this.metisService.updateAnswerPost(this.posting).subscribe({
next: () => {
this.isLoading = false;
this.isInputOpen = false;
this.createEditAnswerPostContainerRef?.clear();
},
error: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{ posting.author!.name }}
</span>
<span class="today-flag" *ngIf="postingIsOfToday">{{ todayFlag | artemisTranslate }}</span>
<span [disableTooltip]="postingIsOfToday" [ngbTooltip]="posting.creationDate | artemisDate: 'time'">
<span container="body" [disableTooltip]="postingIsOfToday" [ngbTooltip]="posting.creationDate | artemisDate: 'time'">
{{ postingIsOfToday ? (posting.creationDate | artemisDate: 'time') : (posting.creationDate | artemisDate: 'short-date') }}
</span>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{ posting.author!.name }}
</span>
<span class="today-flag" *ngIf="postingIsOfToday">{{ todayFlag | artemisTranslate }}</span>
<span [disableTooltip]="postingIsOfToday" ngbTooltip="{{ posting.creationDate | artemisDate: 'time' }}">
<span container="body" [disableTooltip]="postingIsOfToday" ngbTooltip="{{ posting.creationDate | artemisDate: 'time' }}">
{{ postingIsOfToday ? (posting.creationDate | artemisDate: 'time') : (posting.creationDate | artemisDate: 'short-date') }}
</span>
</span>
Expand Down

0 comments on commit a8ea90a

Please sign in to comment.