Skip to content

Commit

Permalink
fix email autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerrialn committed Jun 9, 2024
1 parent 27fdbcc commit eb66b2b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\LiveComponent\DefaultActionTrait;

#[AsLiveComponent('email_autocompleter_component')]
class EmailAutocompleterComponent extends AbstractController
#[AsLiveComponent('InvitationEmailAutocompleteComponent', template: 'components/invitation-email-autocomplete-component.twig')]
class InvitationEmailAutocompleteComponent extends AbstractController
{
use DefaultActionTrait;

Expand Down Expand Up @@ -69,7 +69,7 @@ public function filter(#[CurrentUser] User $currentUser): void
}

#[LiveAction]
public function submit(#[CurrentUser] User $currentUser): void
public function save(#[CurrentUser] User $currentUser): void
{
$email = $this->createEmail(emailAddress: $this->emailAddress);
$this->createUserContact(email: $email, user: $currentUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<div class="sticky-top bg-white p-2">
<div class="d-flex flex-wrap justify-content-start align-items-center mb-3"></div>
<div class="input-group">
<input id="email-input" placeholder="{{ 'email-address'|trans }}" data-model="emailAddress"
class="form-control"
type="text" data-action="live#action" data-action-name="debounce(100)|filter"
<input autocomplete="off" id="email" placeholder="{{ 'email-address'|trans }}"
data-model="emailAddress"
data-live-action-param="prevent|debounce(100)|filter"
class="form-control mb-0"
type="text" data-action="live#action:prevent"
/>
<a href="#" class="btn btn-success rounded-0" data-action="live#action"
data-action-name="prevent|submit">
<a href="#" class="btn btn-success rounded-0"
data-action="live#action:prevent"
data-live-action-param="prevent|save">
<span class="bi bi-plus-circle-fill fs-4"></span>
</a>
</div>
Expand Down Expand Up @@ -51,8 +54,11 @@
{% elseif contact.email.owner and event.IsOrganiser(contact.email.owner) %}
<div class="bi bi-person-badge-fill fs-3"></div>
{% else %}
<a href="#" class="link-success" data-action="live#action"
data-action-name="prevent|sendInvitation(contact={{ contact.id }})">
<a href="#" class="link-success"
data-action="live#action:prevent"
data-live-action-param="sendInvitation"
data-live-contact-param="{{ contact.id }}"
>
<span class="bi bi-send-fill fs-3"></span>
</a>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions templates/events/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

<div class="vstack d-flex justify-content-between gap-1">
{% for moment in event.eventMoments %}
{% if moment.type.name == 'EVENT_CANCELED' %}
{% if moment.type.name == 'EVENT_CANCELED' and event.eventCancellation %}
<div class="alert mb-1 d-flex flex-column justify-content-center border-0 text-bg-dark-grey">
<div class="bi bi-exclamation-triangle-fill fs-3 text-danger text-center"></div>
<div class="text-center lead fw-bold">{{ moment.type.value|trans|title }}</div>
Expand Down Expand Up @@ -246,7 +246,7 @@
<h1 class="modal-title fs-5" id="exampleModalLabel">{{ 'send-invitations'|trans|capitalize }}</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
{{ component('email_autocompleter_component', {
{{ component('InvitationEmailAutocompleteComponent', {
event: event
}) }}
</div>
Expand Down

0 comments on commit eb66b2b

Please sign in to comment.