diff --git a/assets/controllers/form-related-links_controller.js b/assets/controllers/form-related-links_controller.js index db3b5051b..ca0a27aaf 100644 --- a/assets/controllers/form-related-links_controller.js +++ b/assets/controllers/form-related-links_controller.js @@ -6,7 +6,7 @@ export default class extends Controller { static values = { index: Number, label: String, - link: String, + value: String, deleteIcon: String, }; @@ -29,11 +29,11 @@ export default class extends Controller { )); rowNode.appendChild(nodeLabel); - const nodeLink = this.#htmlToNode(this.linkValue.replace( + const nodeValue = this.#htmlToNode(this.valueValue.replace( /__name__/g, this.indexValue, )); - rowNode.appendChild(nodeLink); + rowNode.appendChild(nodeValue); this.#addButtonDeleteLink(rowNode); @@ -44,7 +44,7 @@ export default class extends Controller { #addButtonDeleteLink(item) { const removeFormButton = document.createElement('button'); removeFormButton.innerHTML = this.deleteIconValue; - removeFormButton.className = 'btn'; + removeFormButton.className = 'btn btn__secondary'; item.append(removeFormButton); diff --git a/assets/styles/layout/_forms.scss b/assets/styles/layout/_forms.scss index d31153fa5..a57b98ac6 100644 --- a/assets/styles/layout/_forms.scss +++ b/assets/styles/layout/_forms.scss @@ -549,12 +549,3 @@ div.input-box { margin-bottom: 0; flex-grow: 1 } - -.related-link-row button { - padding: 0; - background: none; - font-size: 1.5rem; - border: 0; - color: var(--kbin-input-text-color); - -} diff --git a/src/Controller/User/Profile/UserEditController.php b/src/Controller/User/Profile/UserEditController.php index 5590cc89b..302110499 100644 --- a/src/Controller/User/Profile/UserEditController.php +++ b/src/Controller/User/Profile/UserEditController.php @@ -5,7 +5,6 @@ namespace App\Controller\User\Profile; use App\Controller\AbstractController; -use App\DTO\RelatedLinkDTO; use App\DTO\UserDto; use App\Form\UserBasicType; use App\Form\UserEmailType; diff --git a/src/DTO/RelatedLinkDTO.php b/src/DTO/RelatedLinkDTO.php index 90b94f20f..0fbc7f138 100644 --- a/src/DTO/RelatedLinkDTO.php +++ b/src/DTO/RelatedLinkDTO.php @@ -5,8 +5,8 @@ class RelatedLinkDTO { private string $label; - private string $link; - private bool $verified = false; + private string $value; + private bool $verifiedLink = false; /** * @return string @@ -27,32 +27,32 @@ public function setLabel(string $label): void /** * @return string */ - public function getLink(): string + public function getValue(): string { - return $this->link; + return $this->value; } /** - * @param string $link + * @param string $value */ - public function setLink(string $link): void + public function setValue(string $value): void { - $this->link = $link; + $this->value = $value; } /** * @return bool */ - public function isVerified(): bool + public function isVerifiedLink(): bool { - return $this->verified; + return $this->verifiedLink; } /** - * @param bool $verified + * @param bool $verifiedLink */ - public function setVerified(bool $verified): void + public function setVerifiedLink(bool $verifiedLink): void { - $this->verified = $verified; + $this->verifiedLink = $verifiedLink; } } diff --git a/src/Entity/User.php b/src/Entity/User.php index b0b5e37c2..d8e9b6703 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -902,9 +902,4 @@ public function getRelatedLinks(): array { return $this->relatedLinks; } - - public function setRelatedLinks(array $relatedLinks): void - { - $this->relatedLinks = $relatedLinks; - } } diff --git a/src/Factory/UserFactory.php b/src/Factory/UserFactory.php index 387e04ff0..f6e560954 100644 --- a/src/Factory/UserFactory.php +++ b/src/Factory/UserFactory.php @@ -24,8 +24,6 @@ public function __construct( public function createDto(User $user): UserDto { -// $temp = $this->denormalizer->denormalize($user->getRelatedLinks(), sprintf('%s[]', RelatedLinkDTO::class)); - $dto = UserDto::create( $user->username, $user->email, diff --git a/src/Form/UserRelatedDataType.php b/src/Form/UserRelatedDataType.php index 88a4a40e3..a96994468 100644 --- a/src/Form/UserRelatedDataType.php +++ b/src/Form/UserRelatedDataType.php @@ -18,7 +18,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('label', TextType::class) - ->add('link', UrlType::class) + ->add('value', UrlType::class) ->setDataMapper($this); ; } @@ -40,7 +40,7 @@ public function mapDataToForms($viewData, \Traversable $forms): void $forms = iterator_to_array($forms); $forms['label']->setData($viewData->getLabel()); - $forms['link']->setData($viewData->getLink()); + $forms['value']->setData($viewData->getValue()); } public function mapFormsToData(\Traversable $forms, &$viewData): void @@ -53,7 +53,7 @@ public function mapFormsToData(\Traversable $forms, &$viewData): void // beware of type inconsistency, see caution below $viewData = new RelatedLinkDTO(); $viewData->setLabel($forms['label']->getData()); - $viewData->setLink($forms['link']->getData()); + $viewData->setValue($forms['value']->getData()); } public function configureOptions(OptionsResolver $resolver): void diff --git a/templates/user/settings/profile.html.twig b/templates/user/settings/profile.html.twig index 575aa32c9..f0174b046 100644 --- a/templates/user/settings/profile.html.twig +++ b/templates/user/settings/profile.html.twig @@ -48,7 +48,7 @@ {{ stimulus_controller('form-related-links') }} data-form-related-links-index-value="{{ form.relatedLinks|length }}" data-form-related-links-link-value="{{ - form_row(form.relatedLinks.vars.prototype.link, { + form_row(form.relatedLinks.vars.prototype.value, { label: false })|e('html_attr') }}" @@ -70,7 +70,7 @@ {{ form_row(item_form.label, { label: false }) }} - {{ form_row(item_form.link, { + {{ form_row(item_form.value, { label: false }) }}