Skip to content

Commit

Permalink
Also close registration for sponsors on self-signup
Browse files Browse the repository at this point in the history
  • Loading branch information
florianschmidt1994 committed Apr 4, 2018
1 parent 58f0ac9 commit 4d8758b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/common/resources/translations/translations.de.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,12 @@ module.exports = {
},
"CLOSED": {
"HEADLINE": "Anmeldung geschlossen",
"DESCRIPTION": "Leider ist die Anmeldung als Teilnehmer bei BreakOut 2018 nicht mehr offen :( Du kannst dich aber noch als Sponsor anmelden und so den EinDollarBrille e.V. unterstützen. Trage dich doch in unseren Newsletter ein, um beim nächsten safe BreakOut dabei zu sein!",
"DESCRIPTION": "Leider ist die Anmeldung als Teilnehmer bei BreakOut 2018 gerade nicht geöffnet :( Trag dich aber gerne in unseren Newsletter ein, um immer auf dem aktuellsten Stand zu bleiben!",
"LINK_DESCRIPTION": "ZURÜCK ZUR WEBSEITE"
},
"SPONSOR-CLOSED": {
"HEADLINE": "Sponsoren-Anmeldung geschlossen",
"DESCRIPTION": "Leider ist die Registrierung als Sponsor bei BreakOut 2018 gerade nicht geöffnet :(",
"LINK_DESCRIPTION": "ZURÜCK ZUR WEBSEITE"
},
"MESSAGE": {
Expand Down
7 changes: 6 additions & 1 deletion src/common/resources/translations/translations.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,14 @@ module.exports = {
},
"CLOSED": {
"HEADLINE": "Registration closed",
"DESCRIPTION": "The registration for BreakOut 2018 is closed :( You can still register as a sponsor and support One Dollar Glasses. Sign up for our newsletter to make sure you don't miss the next BreakOut.",
"DESCRIPTION": "The registration for BreakOut 2018 is currently closed :( Sign up for our newsletter to make sure you don't miss any news about BreakOut.",
"LINK_DESCRIPTION": "BACK TO THE WEBSITE"
},
"SPONSOR-CLOSED": {
"HEADLINE": "Registration for Sponsors closed",
"DESCRIPTION": "The registration as a sponsor is currently closed :(",
"LINK_DESCRIPTION": "ZURÜCK ZUR WEBSEITE"
},
"MESSAGE": {
"HEADLINE": "Messages",
"BTN_ADD": "Create new group message",
Expand Down
9 changes: 9 additions & 0 deletions src/server/controller/SponsoringController.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,13 @@ sponsoring.invoice.getByTeam = (req) => co(function*() {
throw ex;
});

sponsoring.sponsoringIsOpenForAnyEvent = (req, res, next) => co(function *(){
const events = yield api.event.all();
if (events.some(event => event.allowNewSponsoring)) {
next();
} else {
res.redirect('/sponsor-closed');
}
});

module.exports = sponsoring;
5 changes: 4 additions & 1 deletion src/server/routes/dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const DynamicController = require('../controller/DynamicController');
const AuthenticationController = require('../controller/AuthenticationController');
const StaticController = require('../controller/StaticController.js');
const TeamController = require('../controller/TeamController');
const SponsoringController = require('../controller/SponsoringController');

const Router = require('co-router');
const multer = require('multer');
Expand Down Expand Up @@ -50,7 +51,9 @@ router.get('/reset/:email/:token', funnelTemplate('reset-pw'));

router.get('/closed', funnelTemplate('closed'));

router.get('/sponsor', session.isUser, redirectIfSponsor, funnelTemplate('sponsor'));
router.get('/sponsor-closed', funnelTemplate('sponsor-closed'));

router.get('/sponsor', session.isUser, SponsoringController.sponsoringIsOpenForAnyEvent, redirectIfSponsor, funnelTemplate('sponsor'));

router.get('/login', StaticController.renderLandingpage); // client-side routing

Expand Down
27 changes: 27 additions & 0 deletions src/server/views/dynamic/register/sponsor-closed.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class="container">
<div class="col-sm-4 registration-box-border div-align-mid">
<div class="row registration-margin">
<div class="col-md-10 div-align-mid">
<img class="bo-modal-logo center" alt="BreakOut" src="/img/logos/BreakOut-Logo_Header.svg">
</div>
</div>
<div class="row registration-margin">
<div class="col-xs-12 text-center">
<h2>{{__ 'HEADLINE'}}</h2>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<p>{{__ 'DESCRIPTION'}}</p>
</div>
</div>

<div class="row registration-margin">
<div class="col-xs-12 text-center">
<a href="http://break-out.org" class="no-underline">
<button class="btn btn-primary btn-block">{{__ 'LINK_DESCRIPTION'}}</button>
</a>
</div>
</div>
</div>
</div>

0 comments on commit 4d8758b

Please sign in to comment.