2021-11-18 09:42:00 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2022-02-09 12:25:08 +01:00
|
|
|
import { StorageService } from '../../../../core/services/storage.service';
|
|
|
|
import { ChoiceText } from '../../../../core/models/choice.model';
|
2021-11-18 09:42:00 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-option-link',
|
|
|
|
templateUrl: './option-link.component.html',
|
|
|
|
styleUrls: ['./option-link.component.scss'],
|
|
|
|
})
|
|
|
|
export class OptionLinkComponent implements OnInit {
|
2022-02-09 12:25:08 +01:00
|
|
|
public url_href: string;
|
|
|
|
public url_display: string;
|
|
|
|
public choice_for_modal: ChoiceText; // choice to be modified after validation of modal
|
|
|
|
public display_option_dialog: boolean = false;
|
|
|
|
|
|
|
|
constructor(public StorageService: StorageService) {}
|
2021-11-18 09:42:00 +01:00
|
|
|
|
|
|
|
ngOnInit(): void {}
|
2022-02-09 12:25:08 +01:00
|
|
|
|
|
|
|
openLinkModal(choice: ChoiceText) {
|
|
|
|
this.choice_for_modal = choice;
|
|
|
|
this.display_option_dialog = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
addLink() {
|
|
|
|
this.StorageService.choicesText.push(new ChoiceText());
|
|
|
|
}
|
|
|
|
|
|
|
|
validateModal() {
|
|
|
|
this.choice_for_modal.url_href = '' + this.url_href;
|
|
|
|
this.choice_for_modal.url_display = '' + this.url_display;
|
|
|
|
this.display_option_dialog = false;
|
2022-02-09 15:55:16 +01:00
|
|
|
this.url_href = '';
|
|
|
|
this.url_display = '';
|
2022-02-09 12:25:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
closeModal() {
|
|
|
|
this.display_option_dialog = false;
|
|
|
|
}
|
2021-11-18 09:42:00 +01:00
|
|
|
}
|