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

Add information regarding rights as an eventmaker #3574

Merged
merged 11 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/routes/events/components/EventEditor/EventEditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
margin-bottom: 0;
}

.metaFieldInformation {
margin-bottom: 0;
font-size: small;
}

.metaField input {
padding-bottom: 5px;
padding-top: 5px;
Expand Down
31 changes: 26 additions & 5 deletions app/routes/events/components/EventEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,23 @@ function EventEditor({
)}
</ContentSidebar>
</ContentSection>
{!isEditPage && (
<Tooltip
style={{
marginLeft: '3px',
}}
content="Jeg er kjent med at jeg kun kan bruke rettighetene mine til å opprette abakusarrangement som er i tråd med arrangementskalenderen og Abakus sine blesteregler, og at jeg må ta kontakt med hs@abakus.no dersom jeg er usikker eller ønsker å opprette et annet/eksternt arrangement."
>
<Field
label="Arrangementet er avklart i arrangementskalenderen"
name="isClarified"
component={CheckBox.Field}
fieldClassName={styles.metaFieldInformation}
className={styles.formField}
normalize={(v) => !!v}
/>
</Tooltip>
)}

<Flex wrap>
{isEditPage && (
Expand Down Expand Up @@ -592,15 +609,15 @@ const validate = (data) => {
}

if (!data.title) {
errors.title = 'Tittel er påkrevet';
errors.title = 'Tittel er påkrevd';
}

if (!data.description || data.description.trim() === '') {
errors.description = 'Kalenderbeskrivelse er påkrevet';
errors.description = 'Kalenderbeskrivelse er påkrevd';
}

if (!data.eventType) {
errors.eventType = 'Arrangementstype er påkrevet';
errors.eventType = 'Arrangementstype er påkrevd';
}

if (data.isPriced && data.priceMember > 10000) {
Expand All @@ -612,7 +629,7 @@ const validate = (data) => {
}

if (!data.location) {
errors.location = 'Lokasjon er påkrevet';
errors.location = 'Lokasjon er påkrevd';
}

if (data.useMazemap && !data.mazemapPoi) {
Expand All @@ -624,7 +641,7 @@ const validate = (data) => {
}

if (!data.id && !data.cover) {
errors.cover = 'Cover er påkrevet';
errors.cover = 'Cover er påkrevd';
}

if (!data.eventStatusType) {
Expand All @@ -639,6 +656,10 @@ const validate = (data) => {
errors.feedbackDescription = 'Kan ikke være tomt';
}

if (!data.isClarified) {
errors.isClarified = 'Arrangementet må være avklart';
}

if (!isInteger(data.registrationDeadlineHours)) {
errors.registrationDeadlineHours = 'Kun hele timer';
}
Expand Down
1 change: 1 addition & 0 deletions app/routes/events/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export type EditingEvent = Event & {
addFee: boolean;
registrationDeadline: Dateish;
hasFeedbackQuestion: boolean;
isClarified: boolean;
authors: Option[];
};

Expand Down
21 changes: 21 additions & 0 deletions cypress/e2e/create_event_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('Create event', () => {
fieldError('title').should('not.exist');
fieldError('description').should('not.exist');
fieldError('eventType').should('not.exist');
fieldError('isClarified').should('not.exist');

cy.contains('button', 'Opprett').should('be.disabled');
// click editor to initialize form and enable Opprett button
Expand All @@ -49,6 +50,7 @@ describe('Create event', () => {
fieldError('title').should('be.visible');
fieldError('description').should('be.visible');
fieldError('eventType').should('be.visible');
fieldError('isClarified').should('be.visible');

// Upload file
uploadHeader();
Expand All @@ -60,6 +62,9 @@ describe('Create event', () => {
field('description').type('blir fett').blur();
fieldError('description').should('not.exist');

field('isClarified').check();
fieldError('isClarified').should('not.exist');

// TODO: Make the suggestion box open if you click the label, not only when you click the input field
selectField('eventType').click();
cy.focused().type('sos', { force: true });
Expand Down Expand Up @@ -160,6 +165,7 @@ describe('Create event', () => {
.click();
field('title').type('Pils på Webkomkontoret!').blur();
field('description').type('blir fett').blur();
field('isClarified').check();
selectField('eventType').click();
cy.focused().type('sos{enter}', { force: true });

Expand Down Expand Up @@ -207,6 +213,9 @@ describe('Create event', () => {
.and('contain', 'Bedkom');
cy.focused().type('{enter}', { force: true });

// Check clarification
field('isClarified').check();

cy.contains('button', 'Opprett').should('not.be.disabled').click();

// Verify that created event looks good..
Expand Down Expand Up @@ -236,6 +245,9 @@ describe('Create event', () => {
selectField('eventStatusType').click();
cy.focused().type('TBA{enter}', { force: true });

// Check clarification
field('isClarified').check();

cy.contains('button', 'Opprett').should('not.be.disabled').click();

// Verify that created event looks good..
Expand Down Expand Up @@ -311,6 +323,9 @@ describe('Create event', () => {
cy.get(c('DatePicker__header')).find('button:last-child').click();
cy.contains(c('DatePicker__calendarItem'), '15').click();

// Check clarification
field('isClarified').check();

cy.contains('button', 'Opprett').should('not.be.disabled').click();

// Verify that created event looks good..
Expand Down Expand Up @@ -348,6 +363,9 @@ describe('Create event', () => {
cy.contains('Sted').click();
cy.focused().type('Kjellern');

// Check clarification
field('isClarified').check();

cy.contains('button', 'Opprett').should('not.be.disabled').click();

// Verify that created event looks good..
Expand Down Expand Up @@ -399,6 +417,9 @@ describe('Create event', () => {
.and('contain', 'Abakus');
cy.focused().type('{enter}', { force: true });

// Check clarification
field('isClarified').check();

cy.contains('button', 'Opprett').should('not.be.disabled').click();

// Verify that created event looks good..
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/event_editor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ describe('Editor', () => {
field('description').type('blir fett').blur();
selectField('eventType').click();
cy.focused().type('sos{enter}', { force: true });
field('isClarified').check();

// Create event
cy.contains('button', 'Opprett').should('not.be.disabled').click();
Expand Down