To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 518d0a6b authored by Sandro Lutz's avatar Sandro Lutz Committed by Sandro Lutz
Browse files

Hide terms checkbox in event card when not required (Fixes #20)

parent d07e8f96
Pipeline #68314 failed with stages
in 12 minutes and 44 seconds
......@@ -179,6 +179,7 @@ const EventDetails = ({ eventId, ...props }) => {
let signupButtons = null
let additionalFields = null
let showTermsCheckbox = false
let emailField = null
let termsCheckbox = null
let termsDialog = null
......@@ -376,6 +377,7 @@ const EventDetails = ({ eventId, ...props }) => {
// ----------------------
// Prepare signup buttons
if (data.time_register_start === null || data.time_register_end === null) {
showTermsCheckbox = false
signupButtons = (
<Button disabled>
<FormattedMessage id="events.registration.none" />
......@@ -385,20 +387,24 @@ const EventDetails = ({ eventId, ...props }) => {
data.time_register_start &&
now < new Date(data.time_register_start)
) {
showTermsCheckbox = false
signupButtons = (
<Button disabled>
<FormattedMessage id="events.registration.notStarted" />
</Button>
)
} else if (data.time_register_end && now > new Date(data.time_register_end)) {
showTermsCheckbox = false
signupButtons = (
<Button disabled>
<FormattedMessage id="events.registration.over" />
</Button>
)
} else if (auth.isLoggedIn && !isSignupLoaded) {
showTermsCheckbox = false
signupButtons = <Spinner size={24} />
} else if (!auth.isLoggedIn && !data.allow_email_signup) {
showTermsCheckbox = false
signupButtons = (
<React.Fragment>
<Button onClick={() => dispatch(authLoginStart())}>
......@@ -480,6 +486,7 @@ const EventDetails = ({ eventId, ...props }) => {
}
}
showTermsCheckbox = true
signupButtons = (
<React.Fragment>
{(!signup || !signup.data || (signup.data && hasAdditionalFields)) && (
......@@ -531,8 +538,8 @@ const EventDetails = ({ eventId, ...props }) => {
>
{emailField}
{additionalFields}
{termsDialog}
{termsCheckbox}
{showTermsCheckbox && termsDialog}
{showTermsCheckbox && termsCheckbox}
</div>
<TranslatedContent
parseMarkdown
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment