Skip to content

Commit

Permalink
feat(campaign): add name and description (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
WikiRik authored Mar 31, 2021
1 parent 7677145 commit 316b438
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 49 deletions.
59 changes: 45 additions & 14 deletions src/views/auth/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
<div class="columns is-vcentered">
<div class="column is-6 is-offset-3">
<div class="box">
<div class="field" v-if="campaign.autojoin_body">
<label class="label">Register on MyAEGEE for {{ campaign.autojoin_body.name }}</label>
<p>With this form you will be registering on MyAEGEE and automatically become a member of {{ campaign.autojoin_body.name }} after you have confirmed your email.</p>
<p><span v-html="$options.filters.markdown(campaign.description_long)" /></p>
<p v-if="campaign.autojoin_body.email">If you have any questions, you can contact {{ campaign.autojoin_body.name }} at {{ campaign.autojoin_body.email }}.</p>
</div>
<div class="field" v-if="!campaign.autojoin_body">
<label class="label">Register on MyAEGEE</label>
<p>With this form you will be registering on MyAEGEE. You will not become a member of a local yet, but you can make a join request after you have confirmed your email.</p>
</div>

<hr />
<form v-on:submit.prevent="register">
<div class="field">
<label class="label">Username</label>
<label class="label">Username <span class="has-text-danger">*</span></label>
<div class="control">
<input
v-model="user.username"
Expand All @@ -21,7 +33,7 @@
</div>

<div class="field">
<label class="label">Email</label>
<label class="label">Email <span class="has-text-danger">*</span></label>
<div class="control">
<input
v-model="user.email"
Expand All @@ -35,15 +47,15 @@
</div>

<div class="field">
<label class="label">Password</label>
<label class="label">Password <span class="has-text-danger">*</span></label>
<div class="control">
<input v-model="user.password" data-cy="password" required class="input" type="password" minlength="8" placeholder="Type a secure password.">
</div>
<p class="help is-danger" v-if="errors.password">{{ errors.password.join(', ')}}</p>
</div>

<div class="field">
<label class="label">Password confirmation</label>
<label class="label">Password confirmation <span class="has-text-danger">*</span></label>
<div class="control">
<input v-model="user.password_copy" required data-cy="password-confirmation" class="input" type="password" minlength="8" placeholder="Repeat your password.">
</div>
Expand All @@ -53,15 +65,15 @@
<hr />

<div class="field">
<label class="label">First name</label>
<label class="label">First name <span class="has-text-danger">*</span></label>
<div class="control">
<input v-model="user.first_name" required data-cy="first-name" class="input" type="text" placeholder="E.g. Stephen">
</div>
<p class="help is-danger" v-if="errors.first_name">{{ errors.first_name.join(', ')}}</p>
</div>

<div class="field">
<label class="label">Last name</label>
<label class="label">Last name <span class="has-text-danger">*</span></label>
<div class="control">
<input v-model="user.last_name" required data-cy="last-name" class="input" type="text" placeholder="E.g. Hawking">
</div>
Expand All @@ -83,7 +95,7 @@
<p class="help is-danger" v-if="errors.date_of_birth">{{ errors.date_of_birth.join(', ')}}</p>
</div>

<select-or-custom v-model="user.gender" data-cy="gender" :values="['Male', 'Female']" label="Gender" required>
<select-or-custom v-model="user.gender" data-cy="gender" :values="['Male', 'Female']" label="Gender">
<template slot="errors-slot">
<p class="help is-danger" v-if="errors.gender">{{ errors.gender.join(', ')}}</p>
</template>
Expand All @@ -106,8 +118,9 @@
</div>

<div class="field">
<label class="label">I agree to the <router-link :to="{ name: 'oms.confluence', params: { page_id: 'terms-of-service' } }">Privacy Policy</router-link>
<input type="checkbox" class="checkbox" data-cy="agree-to-privacy-policy" v-model="agreedToPrivacyPolicy" />
<label class="checkbox">
I agree to the <router-link :to="{ name: 'oms.confluence', params: { page_id: 'terms-of-service' } }">Privacy Policy <span class="has-text-danger">*</span> </router-link>
<input type="checkbox" required data-cy="agree-to-privacy-policy" v-model="agreedToPrivacyPolicy" />
</label>
<p class="help is-danger" v-if="errors.agreedToPrivacyPolicy">{{ errors.agreedToPrivacyPolicy.join(', ')}}</p>
</div>
Expand Down Expand Up @@ -147,6 +160,13 @@ export default {
address: null,
about_me: null
},
campaign: {
name: '',
description_long: '',
id: null,
autojoin_body: null,
active: null
},
birthday: null,
agreedToPrivacyPolicy: false,
errors: {}
Expand All @@ -172,11 +192,6 @@ export default {
return
}
if (!this.user.date_of_birth) {
this.errors.date_of_birth = ['Please enter your date of birth.']
return
}
if (this.user.password !== this.user.password_copy) {
this.errors.password = ['Passwords do not match.']
return
Expand Down Expand Up @@ -214,6 +229,22 @@ export default {
this.$root.showError('Could not register', err)
})
}
},
mounted () {
this.isLoading = true
this.axios.get(this.services['core'] + '/campaigns/' + this.$route.params.id).then((response) => {
this.campaign = response.data.data
}).then(
this.isLoading = false
).catch((err) => {
if (err.response && err.response.status === 404) {
this.$root.showError('Campaign is not found')
} else {
this.$root.showError('Some error happened', err)
}
this.$router.push({ name: 'oms.login' })
})
}
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/views/core/bodies/CampaignsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</router-link>
</b-table-column>

<b-table-column field="description" label="Description">
{{ props.row.description_short }}
<b-table-column field="description_long" label="Description">
<span class="description" v-html="$options.filters.markdown(props.row.description_long)"></span>
</b-table-column>

<b-table-column label="Link">
Expand Down
32 changes: 12 additions & 20 deletions src/views/core/campaigns/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@
</div>

<div class="field">
<label class="label">Description (short)</label>
<label class="label">Description</label>
<div class="control">
<input class="input" type="text" required v-model="campaign.description_short" />
<textarea class="textarea" placeholder="e.g. Hello world" required v-model="campaign.description_long"></textarea>
</div>
<p class="help is-danger" v-if="errors.description_short">{{ errors.description_short.join(', ')}}</p>
</div>

<div class="field">
<label class="label">Description (long)</label>
<div class="control">
<input class="input" type="text" v-model="campaign.description_long" />
<label class="label">Preview <MarkdownTooltip/></label>
<div class="content">
<span v-html="$options.filters.markdown(campaign.description_long)" />
</div>
<p class="help is-danger" v-if="errors.description_long">{{ errors.description_long.join(', ')}}</p>
<p class="help is-danger" v-if="errors.description_long">{{ errors.description_long.join(', ') }}</p>
</div>

<div class="field">
Expand Down Expand Up @@ -76,13 +72,6 @@
<p class="help is-danger" v-if="errors.autojoin_body_id">{{ errors.autojoin_body_id.join(', ')}}</p>
</div>

<div class="field">
<label class="label">Auto-activate user?
<input type="checkbox" v-model="campaign.activate_user" />
</label>
<p class="help is-danger" v-if="errors.activate_user">{{ errors.auto_activate.join(', ')}}</p>
</div>

<div class="field">
<label class="label">Active?
<input type="checkbox" v-model="campaign.active" :disabled="!$route.params.id"/>
Expand All @@ -109,19 +98,22 @@
<script>
import { mapGetters } from 'vuex'
import MarkdownTooltip from '../../../components/tooltips/MarkdownTooltip'
export default {
components: {
MarkdownTooltip
},
name: 'EditCampaign',
data () {
return {
campaign: {
name: '',
description_short: '',
description_long: '',
id: null,
autojoin_body_id: null,
autojoin_body: null,
active: true,
activate_user: false
active: true
},
bodies: [],
errors: {},
Expand Down
4 changes: 2 additions & 2 deletions src/views/core/campaigns/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
</router-link>
</b-table-column>

<b-table-column field="description_short" label="Description">
{{ props.row.description_short }}
<b-table-column field="description_long" label="Description">
<span class="description" v-html="$options.filters.markdown(props.row.description_long)"></span>
</b-table-column>

<b-table-column label="Link">
Expand Down
14 changes: 3 additions & 11 deletions src/views/core/campaigns/Single.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
</tr>
<tr>
<th>Description</th>
<td>{{ campaign.description_short }}</td>
</tr>
<tr>
<th>Long description</th>
<td>{{ campaign.description_long }}</td>
<td>
<span v-html="$options.filters.markdown(campaign.description_long)"/>
</td>
</tr>
<tr>
<th>URL</th>
Expand All @@ -32,11 +30,6 @@
</td>
<td v-if="!campaign.autojoin_body">This campaign will not create a join request to a body after signup </td>
</tr>
<tr>
<th>Activate User</th>
<td v-if="campaign.activate_user">User will be activated automatically after mail confirmation</td>
<td v-if="!campaign.activate_user">User will remain inactive even after mail confirmation</td>
</tr>
<tr>
<th>Status</th>
<td v-if="campaign.active">Active</td>
Expand Down Expand Up @@ -93,7 +86,6 @@ export default {
return {
campaign: {
name: '',
description_short: '',
description_long: '',
id: null,
url: null,
Expand Down

0 comments on commit 316b438

Please sign in to comment.