Changeset - f648ae583d32
[Not reviewed]
version_5
0 4 0
Dennis Fink - 9 years ago 2015-10-13 22:27:43
dennis.fink@c3l.lu
Added preliminary bridge program form
4 files changed with 127 insertions and 7 deletions:
0 comments (0 inline, 0 general)
ennstatus/root/forms.py
Show inline comments
 
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'),
 
    ('united_states', 'United States of America'),
 
    ('belgium', 'Belgium'),
 
    ('france', 'France'),
 
@@ -51,16 +55,63 @@ class MembershipForm(Form):
 
                          )
 
    gpg = StringField('GPG-ID',
 
                      validators=[Length(max=18)],
 
                      )
 

	
 
    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)'),
 
                                ('starving', 'Starving Hacker - Get in touch with us at info@enn.lu'),
 
                            ]
 
                            )
 

	
 
    c3l = BooleanField('Include "Chaos Computer Club Lëtzebuerg" Membership<sup>1</sup>')
 
    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')
ennstatus/root/views.py
Show inline comments
 
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
 

	
 
root_page = Blueprint('root', __name__)
 

	
 

	
 
@@ -25,15 +25,16 @@ def services():
 

	
 
@root_page.route('/partners')
 
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')
 
def member():
 
    return render_template('root/member.html')
 

	
ennstatus/templates/base.html
Show inline comments
 
@@ -49,13 +49,13 @@
 
              <a>Tor Servers</a>
 
              <ul class="dropdown-menu">
 
                <li><a href="{{ url_for('status.index') }}">Ennstatus Panel</a></li>
 
              </ul>
 
            </li>
 
            <li><a href="{{ url_for('root.mirrors') }}">Mirrors</a></li>
 
            <li><a href="{{ get_wiki_address() }}">Wiki</a></li>
 
            <li><a href="{{ base_macros.get_wiki_address() }}">Wiki</a></li>
 
            <li><a href="{{ url_for('root.disclaimer') }}">About Ennstatus</a></li>
 
          </ul>
 
        </li>
 
        <li class="dropdown">
 
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Support <b class="caret"></b></a>
 
          <ul class="dropdown-menu">
ennstatus/templates/root/bridgeprogram.html
Show inline comments
 
{% extends "base.html" %}
 

	
 
{% import 'bootstrap/wtf.html' as wtf %}
 

	
 
{% set title = "Bridge Program" %}
 

	
 
{% block content %}
 
  <div class="col-md-1">
 
  </div>
 
  <div class="col-md-11">
 
@@ -18,7 +20,73 @@
 
    <p>Interested? Our <a href="//wiki.enn.lu/doku.php?id=user:kahpa">bridge operator</a> will give you further information about the project.</p>
 
    <p><strong>Get in touch:</strong> <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:bridges@enn.lu">bridges@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?op=get&search=0x3F917F479C5D0F3B">0x9C5D0F3B</a> (DE, EN, LB, FR)</p>
 
    <h3>Interaction</h3>
 
    <p>As a partner in our project you can choose the nickname of your bridge and follow it on <a href="{{ url_for('status.index') }}">Ënnstatus</a>, our self-made information-panel.</p>
 
    <p>You want to know more about our work? Our staff is always happy to answer your questions, don't hestitate to <a href="{{ url_for('root.contact') }}">contact us.</a></p>
 
  </div>
 
  <div class="col-md-offset-1 col-md-11">
 
    <h2>Apply for the bridge program</h2>
 
    <form method="post" class="form form-horizontal" role="form">
 
      {{ 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') }}
 
      <div class="form-group {% if form.duration.errors %} has-error {% endif %} required">
 
        {{ form.duration.label(class_='control-label col-lg-2') }}
 
        <div class="col-lg-10">
 
        {% for field in form.duration %}
 
          <div class="radio">
 
            {{ field() }}
 
            <div class="btn-group">
 
              <label class="btn btn-success" for="{{ field.id }}">
 
                <span class="glyphicon glyphicon-plus"></span>
 
                <span class="glyphicon glyphicon-minus"></span>
 
              </label>
 
              <label class="btn btn-default" for="{{ field.id }}">
 
                {{ field.label.text }}
 
              </label>
 
            </div>
 
          </div>
 
        {% endfor %}
 
        </div>
 
        {% if form.duration.errors %}
 
          <div class="col-lg-offset-2 col-lg-10">
 
            {% for error in form.duration.errors %}
 
              <p class="help-block">{{ error }}</p>
 
            {% endfor %}
 
          </div>
 
        {% endif %}
 
      </div>
 
      <div class="form-group {% if form.payment.errors %} has-error {% endif %} required">
 
        {{ form.payment.label(class_='control-label col-lg-2') }}
 
        <div class="col-lg-10">
 
        {% for field in form.payment %}
 
          <div class="radio">
 
            {{ field() }}
 
            <div class="btn-group">
 
              <label class="btn btn-success" for="{{ field.id }}">
 
                <span class="glyphicon glyphicon-plus"></span>
 
                <span class="glyphicon glyphicon-minus"></span>
 
              </label>
 
              <label class="btn btn-default" for="{{ field.id }}">
 
                {{ field.label.text }}
 
              </label>
 
            </div>
 
          </div>
 
        {% endfor %}
 
        </div>
 
        {% if form.payment.errors %}
 
          <div class="col-lg-offset-2 col-lg-10">
 
            {% for error in form.payment.errors %}
 
              <p class="help-block">{{ error }}</p>
 
            {% endfor %}
 
          </div>
 
        {% endif %}
 
      </div>
 
      <div class="form-group">
 
        <div class="col-lg-offset-2 col-lg-10">
 
          {{ form.submit(class_='btn btn-primary') }}
 
        </div>
 
      </div>
 
    </form>
 
  </div>
 
{% endblock %}
0 comments (0 inline, 0 general)