Editing label now working
This commit is contained in:
parent
023f124e6f
commit
578da20c84
@ -17,7 +17,7 @@ export const setCurrentDiscussion = createAction(
|
||||
);
|
||||
|
||||
export const setCurrentDiscussionId = createAction(
|
||||
'[DiscussionViewer] Set Current Discussion',
|
||||
'[DiscussionViewer] Set Current Discussion ID',
|
||||
props<{ id: any }>()
|
||||
);
|
||||
|
||||
|
@ -3,14 +3,14 @@
|
||||
<span
|
||||
class="border paragraph"
|
||||
[ngClass]="loadedLabel ? loadedLabel : 'no-label'"
|
||||
[nbTooltip]="loadedLabel ? loadedLabel : ''"
|
||||
[nbTooltip]="item.label[index] ? item.label[index] : ''"
|
||||
[nbTooltipTrigger]="trigger"
|
||||
>
|
||||
{{ message }}
|
||||
</span>
|
||||
<nb-icon
|
||||
icon="person"
|
||||
*ngIf="userEdited && (selectedDimension$ | async) !== 0"
|
||||
*ngIf="(selectedDimension$ | async) !== 0 && item.user_updated[index]"
|
||||
nbTooltip="Ten paragraf został edytowany manualnie"
|
||||
></nb-icon>
|
||||
</div>
|
||||
@ -23,8 +23,7 @@
|
||||
<nb-select
|
||||
placeholder="Wybierz etykietę"
|
||||
(selectedChange)="fetchLabel($event)"
|
||||
[selected]="loadedLabel"
|
||||
*ngIf="currentCategories$ | async"
|
||||
[placeholder]="item.label[index] ? item.label[index] : 'Wybierz etykietę'"
|
||||
>
|
||||
<nb-option *ngFor="let category of categories" [value]="category.id">{{
|
||||
category.category
|
||||
|
@ -2,7 +2,10 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||
import { NbTrigger } from '@nebular/theme';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { updateCategory } from 'src/app/actions/discussion.actions';
|
||||
import {
|
||||
getDiscussion,
|
||||
updateCategory,
|
||||
} from 'src/app/actions/discussion.actions';
|
||||
import { State } from 'src/app/reducers';
|
||||
import { Category } from 'src/app/reducers/dimension.reducers';
|
||||
import { selectCurrentDimension } from 'src/app/selectors/discussion.selectors';
|
||||
@ -15,10 +18,12 @@ import { ParagraphService } from '../../../services/paragraph.service';
|
||||
})
|
||||
export class StyledParagraphComponent implements OnInit {
|
||||
@Input() message: string;
|
||||
@Input() loadedLabel: string;
|
||||
@Input() loadedLabel?: string;
|
||||
@Input() paragraphId: number;
|
||||
@Input() currentCategories$: Observable<Category[]>;
|
||||
@Input() userEdited: boolean;
|
||||
@Input() userEdited?: boolean;
|
||||
@Input() item: any;
|
||||
@Input() index: any;
|
||||
trigger: NbTrigger;
|
||||
categories: Category[];
|
||||
dimension: number;
|
||||
@ -40,7 +45,8 @@ export class StyledParagraphComponent implements OnInit {
|
||||
|
||||
fetchLabel(categoryId: any) {
|
||||
this.store.dispatch(
|
||||
updateCategory({ categoryId, paragraphId: this.paragraphId })
|
||||
updateCategory({ categoryId, paragraphId: this.item.para_id[this.index] })
|
||||
);
|
||||
this.store.dispatch(getDiscussion());
|
||||
}
|
||||
}
|
||||
|
@ -49,12 +49,13 @@
|
||||
<nb-card-header>
|
||||
{{ item.author | idToName: displayNamesMode:parsedNames }}
|
||||
</nb-card-header>
|
||||
<nb-card-body *ngIf="(currentDimension$ | async) === 0">
|
||||
<nb-card-body>
|
||||
<app-styled-paragraph
|
||||
*ngFor="let paragraph of item.message; let i = index"
|
||||
[message]="paragraph"
|
||||
[currentCategories$]="currentCategories$"
|
||||
[paragraphId]="item.para_id[i]"
|
||||
[item]="item"
|
||||
[index]="i"
|
||||
></app-styled-paragraph>
|
||||
</nb-card-body>
|
||||
<!-- <nb-card-body *ngIf="(currentDimension$ | async) !== 0">
|
||||
|
Loading…
Reference in New Issue
Block a user