Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deactivates the pupil signup for selected chapters #98

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const chapters_query = `{
}
baseId
acceptsSignups
deactivatePupils
token
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type Chapter = {
}
baseId: string
acceptsSignups: boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe not the most future-proof interface for managing signup state of chapters.

How about we use acceptsSignups: Record<'students' | 'pupils', boolean> = {students: true, pupils: false} ?

deactivatePupils: boolean
token: string
}

Expand Down
1 change: 1 addition & 0 deletions src/routes/signup-pupil/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import raw_form from '../../signup-form/de/pupil.yml'
export const load: PageServerLoad = async () => {
let chapters = await fetch_chapters()
chapters = chapters.filter((chap) => chap.acceptsSignups)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why you don't combine these filters?

let chapters = await fetch_chapters()
chapters = chapters.filter((chap) => chap.acceptsSignups && !chap.deactivatePupils)

chapters = chapters.filter((chap) => !chap.deactivatePupils)

const form = parse_form_data({ ...raw_form, ...messages })

Expand Down
50 changes: 49 additions & 1 deletion src/routes/standorte/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<BasePage {page}>
<!-- Buttons at the end of the chapter pages to contact the dfferent chapter manager by mail
showSignupButtons should be set false when chapter is still in setup -->
{#if page?.yaml?.showSignupButtons !== false}
{#if page?.yaml?.showSignupButtons !== false && page?.yaml?.allowPupils !== false}
<h2 style="text-align: center; margin-top: 2em;">{$microcopy?.location?.register}</h2>
<section>
<span>
Expand Down Expand Up @@ -61,6 +61,54 @@
>
</span>
</section>
{:else if page?.yaml?.allowPupils == false}
<h2 style="text-align: center; margin-top: 2em;">{$microcopy?.location?.register}</h2>
<section>
<span>
{$microcopy?.location?.joinStudent}
<a href="/signup-student?chapter={page.title}" class="btn blue">
<Icon inline icon="fa-solid:graduation-cap" {style} />{$microcopy?.location
?.registerStudent}
</a>
<a href={$microcopy?.location?.linkStudentInfo} class="btn blue stroke">
<Icon
inline
icon="bi:info-circle-fill"
style={style + `margin-right: 6pt;`}
/>{$microcopy?.location?.infoStudentButton}
</a>
</span>
<span>
{$microcopy?.location?.joinPupil}
<a class="btn green">
<Icon inline icon="fa-solid:child" {style} />{$microcopy?.location
?.declinePupil}
</a>
<a href={$microcopy?.location?.linkPupilInfo} class="btn green stroke">
<Icon
inline
icon="bi:info-circle-fill"
style={style + `margin-right: 6pt;`}
/>{$microcopy?.location?.infoPupilButton}</a
>
</span>
<span>
{$microcopy?.location?.locationManagement}
<a
href="mailto:info.{slug}{$microcopy?.location?.mailTo} {page.title}"
class="btn orange"
>
<Icon inline icon="ic:email" {style} />{$microcopy?.location?.writeMailButton}
</a>
<a href={$microcopy?.location?.linkLeadingInfo} class="btn orange stroke">
<Icon
inline
icon="bi:info-circle-fill"
style={style + `margin-right: 6pt;`}
/>{$microcopy?.location?.infoLeadingButton}</a
>
</span>
</section>
{/if}

<svelte:fragment slot="afterBody">
Expand Down