description template editor: enable reordering from not-selected questions

This commit is contained in:
Sofia Papacharalampous 2024-05-28 14:57:47 +03:00
parent 572f970c1e
commit 25c00ed545
2 changed files with 6 additions and 4 deletions

View File

@ -56,9 +56,10 @@
[ngClass]="{'field-container-active': fieldset.get('id').value === selectedFieldSetId}"> [ngClass]="{'field-container-active': fieldset.get('id').value === selectedFieldSetId}">
<mat-card-content> <mat-card-content>
<mat-card-header *ngIf="(fieldset.get('id').value === selectedFieldSetId) && !viewOnly"> <!-- <mat-card-header *ngIf="(fieldset.get('id').value === selectedFieldSetId) && !viewOnly"> -->
<mat-card-header *ngIf="!viewOnly">
<mat-icon *ngIf="reorderingMode" class="handle dragpan enabled-dragpan">drag_indicator</mat-icon> <mat-icon *ngIf="reorderingMode" class="handle dragpan enabled-dragpan">drag_indicator</mat-icon>
<button mat-icon-button class="ml-auto mr-auto" *ngIf="!reorderingMode" (click)="enableReordering()"> <button mat-icon-button class="ml-auto mr-auto" *ngIf="!reorderingMode && (fieldset.get('id').value === selectedFieldSetId)" (click)="enableReordering()">
<mat-icon class="handle dragpan">drag_indicator</mat-icon> <mat-icon class="handle dragpan">drag_indicator</mat-icon>
</button> </button>
</mat-card-header> </mat-card-header>

View File

@ -53,7 +53,7 @@ export class DescriptionTemplateEditorSectionFieldSetComponent implements OnInit
this.dragulaService.createGroup(this.FIELDSETS, { this.dragulaService.createGroup(this.FIELDSETS, {
moves: (el, container, handle) => { moves: (el, container, handle) => {
// if(this.viewOnly) return false; //uncomment if want to unable drag n drop in viewonly mode // if(this.viewOnly) return false; //uncomment if want to unable drag n drop in viewonly mode
if (el.id != (this.dragula_prefix + this.tocentry.id)) return false; // if (el.id != (this.dragula_prefix + this.tocentry.id)) return false;
if (handle.className && handle.classList.contains('handle')) return true; if (handle.className && handle.classList.contains('handle')) return true;
return false; return false;
} }
@ -67,13 +67,14 @@ export class DescriptionTemplateEditorSectionFieldSetComponent implements OnInit
// obs. // obs.
this.dataNeedsRefresh.emit(); this.dataNeedsRefresh.emit();
return; return;
})); }));
this.subs.add(this.dragulaService.dragend(this.FIELDSETS).subscribe(({ el }) => { this.subs.add(this.dragulaService.dragend(this.FIELDSETS).subscribe(({ el }) => {
this.exitReordering(); this.exitReordering();
})) }));
const initializerSub = this.initializer const initializerSub = this.initializer
.pipe( .pipe(