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