Skip to content

Commit

Permalink
DSS-1043: revert takedown request editor
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrBohuslavskyi committed Nov 27, 2024
1 parent d81692b commit a9d17d7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,19 @@ <h4>Takedown Requests for each platform are aggregated into a CSV file and sent

<div class="form-group-row">
<div class="form-group-row-col">
<label for="customDetailTxt">Provide details of the request
<strong>{{isWithStandardDetailControl.value?' (Optional)':''}}</strong></label>
<label for="customDetailTxt">Provide details of the request</label>
</div>
<div class="form-group-row-col">
<p-editor (onTextChange)="onEditorChanged($event)" appendTo="body" #textarea id="customDetailTxt"
name="customDetailTxt" formControlName="customDetailTxt" [style]="{ height: '320px' }">
<ng-template pTemplate="header">
<span class="ql-formats">
<button type="button" class="ql-bold" aria-label="Bold"></button>
<button type="button" class="ql-italic" aria-label="Italic"></button>
<button type="button" class="ql-underline" aria-label="Underline"></button>
<button type="button" class="ql-link" aria-label="Link"></button>
<button class="ql-list" value="ordered" aria-label="List Ordered"></button>
<button class="ql-list" value="bullet" aria-label="List Bullet"></button>
</span>
</ng-template>
</p-editor>
<span class="limit-text" [class.almost-limit-text]="(commentControl.getRawValue() || '').length > 1950"
[class.limited-text]="(commentControl.getRawValue() || '').length > 1999">{{(commentControl.getRawValue()
|| '').length}}/2000</span>
<textarea #textarea rows="5" cols="30" maxlength="2000" class="wide custom-details"
formControlName="customDetailTxt"
placeholder="{{isWithStandardDetailControl.value?'Optional':'Required'}}" pInputTextarea
id="customDetailTxt" name="customDetailTxt"></textarea>
<span class="limit-text" [class.almost-limit-text]="textarea.value.length > 1950"
[class.limited-text]="textarea.value.length > 1999">{{textarea.value.length}}/2000</span>
</div>
<div class="form-group-row-col validation-errors" *ngIf="!commentControl.pristine && commentControl.errors">
<small id="customDetailTxtError" *ngIf="commentControl.errors?.['required']">Details of the
<div class="form-group-row-col validation-errors"
*ngIf="!customDetailTxtControl.pristine && customDetailTxtControl.errors">
<small id="customDetailTxtError" *ngIf="customDetailTxtControl.errors?.['required']">Details of the
request
are required</small>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { validateEmailListString } from '../../../common/consts/validators.const
import { ErrorHandlingService } from '../../../common/services/error-handling.service';
import { GlobalLoaderService } from '../../../common/services/global-loader.service';
import { ListingTableRow } from '../../../common/models/listing-table-row';
import { EditorModule, EditorTextChangeEvent } from 'primeng/editor';

@Component({
selector: 'app-bulk-takedown-request',
Expand All @@ -34,7 +33,6 @@ import { EditorModule, EditorTextChangeEvent } from 'primeng/editor';
DialogModule,
ChipsModule,
ReactiveFormsModule,
EditorModule,
],
templateUrl: './bulk-takedown-request.component.html',
styleUrl: './bulk-takedown-request.component.scss'
Expand Down Expand Up @@ -64,7 +62,7 @@ export class BulkTakedownRequestComponent implements OnInit {
public get isWithStandardDetailControl(): AbstractControl {
return this.myForm.controls['isWithStandardDetail'];
}
public get commentControl(): AbstractControl {
public get customDetailTxtControl(): AbstractControl {
return this.myForm.controls['customDetailTxt'];
}

Expand Down Expand Up @@ -95,10 +93,6 @@ export class BulkTakedownRequestComponent implements OnInit {
});
}

onEditorChanged(_: EditorTextChangeEvent): void {
this.commentControl.updateValueAndValidity();
}

onSort(property: keyof ListingDetails): void {
if (this.sort) {
if (this.sort.prop === property) {
Expand Down Expand Up @@ -155,11 +149,11 @@ export class BulkTakedownRequestComponent implements OnInit {

onWithStandardDetailChanged(value: CheckboxChangeEvent): void {
if (value.checked)
this.commentControl.removeValidators([Validators.required]);
this.customDetailTxtControl.removeValidators([Validators.required]);
else
this.commentControl.addValidators([Validators.required]);
this.customDetailTxtControl.addValidators([Validators.required]);

this.commentControl.updateValueAndValidity();
this.customDetailTxtControl.updateValueAndValidity();
this.myForm.updateValueAndValidity();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,15 @@ <h4>Add Details of your request</h4>

<div class="form-group-row">
<div class="form-group-row-col">
<label for="customDetailTxt">Provide details of the request
<strong>{{isWithStandardDetailControl.value?'(Optional)':''}}</strong></label>
<label for="customDetailTxt">Provide details of the request</label>
</div>
<div class="form-group-row-col">
<p-editor (onTextChange)="onEditorChanged($event)" appendTo="body" id="comment" name="comment"
placeholder="Enter Additional Comment Here..." formControlName="customDetailTxt"
[style]="{ height: '320px' }">
<ng-template pTemplate="header">
<span class="ql-formats">
<button type="button" class="ql-bold" aria-label="Bold"></button>
<button type="button" class="ql-italic" aria-label="Italic"></button>
<button type="button" class="ql-underline" aria-label="Underline"></button>
<button type="button" class="ql-link" aria-label="Link"></button>
<button class="ql-list" value="ordered" aria-label="List Ordered"></button>
<button class="ql-list" value="bullet" aria-label="List Bullet"></button>
</span>
</ng-template>
</p-editor>
<span class="limit-text"
[class.almost-limit-text]="(customDetailTxtControl.getRawValue() || '').length > 1950"
[class.limited-text]="(customDetailTxtControl.getRawValue() || '').length > 1999">{{(customDetailTxtControl.getRawValue()
|| '').length}}/2000</span>
<textarea #textarea rows="5" cols="30" maxlength="2000" class="customDetail-txa"
formControlName="customDetailTxt"
placeholder="{{isWithStandardDetailControl.value?'Optional':'Required'}}" pInputTextarea
id="customDetailTxt" name="customDetailTxt"></textarea>
<span class="limit-text" [class.almost-limit-text]="textarea.value.length > 1950"
[class.limited-text]="textarea.value.length > 1999">{{textarea.value.length}}/2000</span>
</div>
<div class="form-group-row-col validation-errors"
*ngIf="!customDetailTxtControl.pristine && customDetailTxtControl.errors">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { InputNumberModule } from 'primeng/inputnumber';
import { GlobalLoaderService } from '../../../common/services/global-loader.service';
import { forkJoin } from 'rxjs';
import { ErrorHandlingService } from '../../../common/services/error-handling.service';
import { EditorModule, EditorTextChangeEvent } from 'primeng/editor';

@Component({
selector: 'app-delisting-request',
Expand All @@ -41,7 +40,6 @@ import { EditorModule, EditorTextChangeEvent } from 'primeng/editor';
TooltipModule,
ButtonModule,
ToastModule,
EditorModule,
],
templateUrl: './delisting-request.component.html',
styleUrl: './delisting-request.component.scss'
Expand Down Expand Up @@ -153,10 +151,6 @@ export class DelistingRequestComponent implements OnInit {
}
}

onEditorChanged(_: EditorTextChangeEvent): void {
this.customDetailTxtControl.updateValueAndValidity();
}

onPreviewClose(): void {
this.isPreviewVisible = false;
}
Expand Down

0 comments on commit a9d17d7

Please sign in to comment.