diff --git a/ennstatus/root/forms.py b/ennstatus/root/forms.py --- a/ennstatus/root/forms.py +++ b/ennstatus/root/forms.py @@ -1,9 +1,13 @@ from flask_wtf import Form -from wtforms import SelectField, StringField, RadioField, BooleanField, SubmitField +from wtforms import (SelectField, + StringField, + RadioField, + BooleanField, + SubmitField + ) from wtforms.validators import InputRequired, Email, Length, DataRequired - COUNTRIES = [ ('luxembourg', 'Luxembourg'), ('united_kingdom', 'United Kingdom'), @@ -54,7 +58,9 @@ class MembershipForm(Form): ) membership = RadioField('Membership Plan*', - validators=[InputRequired('Please select one of the options!')], + validators=[ + InputRequired('Please select one of the options!') + ], choices=[ ('regular', 'Regular membership (120€/year)'), ('student', 'Student membership (60€/year)'), @@ -64,3 +70,48 @@ class MembershipForm(Form): c3l = BooleanField('Include "Chaos Computer Club Lëtzebuerg" Membership1') submit = SubmitField('Become a member') + + +class BridgeprogramForm(Form): + + fullname = StringField('Full name', + validators=[Length(max=65536)], + ) + + email = StringField('E-Mail*', + validators=[ + InputRequired('This field is required!'), + Email() + ] + ) + + bridgename = StringField('Bridge name', + validators=[ + InputRequired('This field is required!'), + Length(max=65536) + ] + ) + + duration = RadioField('Duration', + validators=[ + InputRequired('Please select one of the options!') + ], + choices=[ + ('1', '1 year'), + ('2', '2 years'), + ] + ) + + payment = RadioField('Payment Method', + validators=[ + InputRequired('Please select one of the options!') + ], + choices=[ + ('wiretransfer', 'Wiretransfer'), + ('bitcoin', 'Bitcoin'), + ('paypal', 'PayPal'), + ('snailmail', 'Snailmail') + ] + ) + + submit = SubmitField('Apply') diff --git a/ennstatus/root/views.py b/ennstatus/root/views.py --- a/ennstatus/root/views.py +++ b/ennstatus/root/views.py @@ -1,7 +1,7 @@ from flask import (Blueprint, render_template, current_app, request, redirect, url_for, flash) -from ennstatus.root.forms import BPMForm, MembershipForm +from ennstatus.root.forms import BPMForm, MembershipForm, BridgeprogramForm from ennstatus.root.constants import BPM_ADDRESSES from ennstatus.root.functions import send_membership_mail @@ -28,9 +28,10 @@ def partners(): return render_template('root/partners.html') -@root_page.route('/bridgeprogram') +@root_page.route('/bridgeprogram', methods=('GET', 'POST')) def bridgeprogram(): - return render_template('root/bridgeprogram.html') + form = BridgeprogramForm() + return render_template('root/bridgeprogram.html', form=form) @root_page.route('/member') diff --git a/ennstatus/templates/base.html b/ennstatus/templates/base.html --- a/ennstatus/templates/base.html +++ b/ennstatus/templates/base.html @@ -52,7 +52,7 @@
  • Mirrors
  • -
  • Wiki
  • +
  • Wiki
  • About Ennstatus
  • diff --git a/ennstatus/templates/root/bridgeprogram.html b/ennstatus/templates/root/bridgeprogram.html --- a/ennstatus/templates/root/bridgeprogram.html +++ b/ennstatus/templates/root/bridgeprogram.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% import 'bootstrap/wtf.html' as wtf %} + {% set title = "Bridge Program" %} {% block content %} @@ -21,4 +23,70 @@

    As a partner in our project you can choose the nickname of your bridge and follow it on Ënnstatus, our self-made information-panel.

    You want to know more about our work? Our staff is always happy to answer your questions, don't hestitate to contact us.

    +
    +

    Apply for the bridge program

    +
    + {{ form.hidden_tag() }} + {{ wtf.form_field(form.fullname, form_type='horizontal') }} + {{ wtf.form_field(form.email, form_type='horizontal') }} + {{ wtf.form_field(form.bridgename, form_type='horizontal') }} +
    + {{ form.duration.label(class_='control-label col-lg-2') }} +
    + {% for field in form.duration %} +
    + {{ field() }} +
    + + +
    +
    + {% endfor %} +
    + {% if form.duration.errors %} +
    + {% for error in form.duration.errors %} +

    {{ error }}

    + {% endfor %} +
    + {% endif %} +
    +
    + {{ form.payment.label(class_='control-label col-lg-2') }} +
    + {% for field in form.payment %} +
    + {{ field() }} +
    + + +
    +
    + {% endfor %} +
    + {% if form.payment.errors %} +
    + {% for error in form.payment.errors %} +

    {{ error }}

    + {% endfor %} +
    + {% endif %} +
    +
    +
    + {{ form.submit(class_='btn btn-primary') }} +
    +
    +
    +
    {% endblock %}