From 77842281ef6d55c183dd6bf49e56b950e5147ad4 Mon Sep 17 00:00:00 2001 From: Booteille Date: Sat, 7 Dec 2024 15:10:04 +0100 Subject: [PATCH] Most invitations features working. My files still missing --- themes/default/public/js/list-invitations.js | 26 +++++++------------ themes/default/templates/exception.html.ep | 18 +++++++++++++ .../templates/invitations/exception.html.ep | 10 ------- .../templates/invitations/invite.html.ep | 8 +++--- .../invitations/my_invitations.html.ep | 23 +++++----------- 5 files changed, 40 insertions(+), 45 deletions(-) create mode 100644 themes/default/templates/exception.html.ep delete mode 100644 themes/default/templates/invitations/exception.html.ep diff --git a/themes/default/public/js/list-invitations.js b/themes/default/public/js/list-invitations.js index 62cd92d..83cceab 100644 --- a/themes/default/public/js/list-invitations.js +++ b/themes/default/public/js/list-invitations.js @@ -27,7 +27,7 @@ const toggleHidden = () => { const invitationsListDOM = document.querySelector(".invitations-list"); const toggleButtonDOM = document.querySelector(".action-toggle-hidden"); const itemsHiddenDOM = invitationsListDOM.querySelectorAll( - ".item[data-visibility='0']" + ".item[data-visibility='hidden']" ); if (invitationsListDOM.dataset.visibility === "hidden") { @@ -72,7 +72,7 @@ const deleteInvitation = () => { }) .then((data) => { if (data.success) { - data.success.forEach((t) => { + data.tokens.forEach((t) => { addToast(t.msg, "success"); document.getElementById(`row-${t.token}`).remove(); }); @@ -157,11 +157,11 @@ const toggleVisibility = () => { const itemDOM = document.getElementById(`row-${t.token}`); if (t.show) { - itemDOM.setAttribute("data-visibility", 1); + itemDOM.setAttribute("data-visibility", "shown"); showNode(itemDOM); - itemDOM.querySelector(".selection .icon.hide-source").remove(); + itemDOM.querySelector(".selection .icon").classList.add("is-hidden"); } else { - itemDOM.setAttribute("data-visibility", 0); + itemDOM.setAttribute("data-visibility", "hidden"); if ( document.querySelector(".invitations-list").dataset.visibility === @@ -170,13 +170,7 @@ const toggleVisibility = () => { hideNode(itemDOM); } - itemDOM - .querySelector(".selection") - .appendChild( - document - .querySelector("template#icon-hide-source") - .content.cloneNode(true) - ); + itemDOM.querySelector(".selection .icon").classList.remove("is-hidden") } itemDOM.querySelector(".selection input").click(); @@ -238,11 +232,11 @@ const fillModal = (event) => { document.addEventListener("DOMContentLoaded", () => { document.querySelectorAll(".modal-button.action-files-info").forEach( (button) => - (button.onclick = (event) => { - fillModal(event); + (button.onclick = (event) => { + fillModal(event); - document.querySelector(".modal.files-info").showModal(); - }) + document.querySelector(".modal.files-info").showModal(); + }) ); document.querySelector(".close-modal").onclick = () => { diff --git a/themes/default/templates/exception.html.ep b/themes/default/templates/exception.html.ep new file mode 100644 index 0000000..48f5e8b --- /dev/null +++ b/themes/default/templates/exception.html.ep @@ -0,0 +1,18 @@ + +
+% if (stash('expired_or_deleted_invitation')) { +
+
+ <%= l('Sorry, your invitation has expired or has been deleted.') %> +
+
+% } + +% if (stash('invitation_not_found')) { +
+
+ <%= l('Sorry, the invitation doesn’t exist. Are you sure you are on the right URL?') %> +
+
+% } +
diff --git a/themes/default/templates/invitations/exception.html.ep b/themes/default/templates/invitations/exception.html.ep deleted file mode 100644 index 7d049b4..0000000 --- a/themes/default/templates/invitations/exception.html.ep +++ /dev/null @@ -1,10 +0,0 @@ -% if (stash('expired_or_deleted_invitation')) { -
- <%= l('Sorry, your invitation has expired or has been deleted.') %> -
-% } -% if (stash('invitation_not_found')) { -
- <%= l('Sorry, the invitation doesn’t exist. Are you sure you are on the right URL?') %> -
-% } diff --git a/themes/default/templates/invitations/invite.html.ep b/themes/default/templates/invitations/invite.html.ep index ef4686a..21493cf 100644 --- a/themes/default/templates/invitations/invite.html.ep +++ b/themes/default/templates/invitations/invite.html.ep @@ -11,9 +11,11 @@ % if (scalar(@{$self->stash('success')})) {
- % for my $msg (@{$self->stash('success')}) { - <%= $msg %> - % } +

+ % for my $msg (@{$self->stash('success')}) { + <%= $msg %> + % } +

% } diff --git a/themes/default/templates/invitations/my_invitations.html.ep b/themes/default/templates/invitations/my_invitations.html.ep index 92217ef..9ade0ba 100644 --- a/themes/default/templates/invitations/my_invitations.html.ep +++ b/themes/default/templates/invitations/my_invitations.html.ep @@ -14,13 +14,13 @@
- +
-
- +
+
+ @@ -108,18 +105,12 @@
- -
@@ -43,16 +43,13 @@ % my ($e, $num) = @_; % return if $e->deleted; % my $class = ''; - % $class = 'deleted' unless $e->is_valid; + % $class = ' deleted' unless $e->is_valid; % $class .= ' is-hidden' unless $e->show_in_list; -
- - % unless ($e->show_in_list) { - - % } +
<%= $e->guest_mail %>