Skip to content

Commit

Permalink
add collection_radio_buttonts
Browse files Browse the repository at this point in the history
  • Loading branch information
ElviaBth committed Jul 16, 2024
1 parent b657bc0 commit 1432f3e
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@
</div>
<div class="row column -mt-4">
<div class="ml-2">
<div class="mr-4">
<%= form.radio_button :no_expiration, t("share_tokens.form.never_expire", scope: "decidim.admin"), checked: form.object.no_expiration %>
</div>
<%= form.collection_radio_buttons :no_expiration, [[false, t("share_tokens.form.never_expire", scope: "decidim.admin")], [true, t("share_tokens.form.custom", scope: "decidim.admin")]], :first, :last %>

<%= form.radio_button :no_expiration, t("share_tokens.form.custom", scope: "decidim.admin"), checked: !form.object.no_expiration %>

<div id="expires_at_field_wrapper" class="<%= form.object.no_expiration ? "hidden" : "" %> mt-4 row column">
<%= form.datetime_field :expires_at, label: t("share_tokens.form.custom_expiration", scope: "decidim.admin") %>
</div>
Expand All @@ -52,7 +48,7 @@
};

const toggleExpiresAtField = () => {
if (expiresAtRadioButtons[1].checked) {
if (expiresAtRadioButtons[2].checked) {
expiresAtFieldWrapper.classList.remove("hidden");
} else {
expiresAtFieldWrapper.classList.add("hidden");
Expand Down

0 comments on commit 1432f3e

Please sign in to comment.