Changeset - 34da714bae58
[Not reviewed]
dev
0 5 0
Dennis Fink - 9 years ago 2015-10-25 16:10:25
dennis.fink@c3l.lu
Move submit fields directly into the corresponding form class
5 files changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
ennstatus/donate/forms.py
Show inline comments
 
from flask_wtf import Form
 
from wtforms import SelectField
 
from wtforms import SelectField, SubmitField
 
from wtforms.validators import DataRequired
 

	
 

	
 
class DateForm(Form):
 
    year = SelectField('Year', validators=[DataRequired()])
 
    month = SelectField('Month',
 
                        choices=[
 
                            ('{:02d}'.format(i), str(i)) for i in range(1, 13)
 
                        ],
 
                        validators=[DataRequired()])
 

	
 
    submit = SubmitField('Submit')
ennstatus/root/forms.py
Show inline comments
 
from flask_wtf import Form
 
from wtforms import (SelectField,
 
                     StringField,
 
                     RadioField,
 
                     BooleanField,
 
                     SubmitField
 
                     )
 
from wtforms.validators import InputRequired, Email, Length, DataRequired
 

	
 

	
 
COUNTRIES = [
 
    ('luxembourg', 'Luxembourg'),
 
    ('belgium', 'Belgium'),
 
    ('france', 'France'),
 
    ('germany', 'Germany'),
 
]
 

	
 

	
 
class BPMForm(Form):
 
    country = SelectField('Country',
 
                          validators=[DataRequired()],
 
                          choices=COUNTRIES)
 
    submit = SubmitField('Submit')
 

	
 

	
 
class MembershipForm(Form):
 

	
 
    username = StringField('Username*',
 
                           validators=[
 
                               InputRequired('This field is required!'),
 
                               Length(max=255)
 
                           ]
 
                           )
 
    email = StringField('E-Mail*',
 
                        validators=[
 
                            InputRequired('This field is required!'),
 
                            Email()
 
                        ]
 
                        )
 
    fullname = StringField('Full name',
 
                           validators=[Length(max=65536)],
 
                           )
 
    street = StringField('Nr., Street',
 
                         validators=[Length(max=4000)],
 
                         )
 
    zip = StringField('ZIP-Code',
 
                      validators=[Length(max=30)],
 
                      )
 
    city = StringField('City/Town',
 
                       validators=[Length(max=500)],
 
                       )
 
    country = StringField('Country',
 
                          validators=[Length(max=500)],
 
                          )
 
    gpg = StringField('GPG-ID',
 
                      validators=[Length(max=18)],
 
                      )
 

	
 
    membership = RadioField('Membership Plan*',
 
                            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'),
ennstatus/templates/donate/index.html
Show inline comments
 
{% extends "base.html" %}
 

	
 
{% set title = "Donate" %}
 

	
 
{% block styles %}
 
  {{ super() }}
 
  <style>
 
    .bitpay-donate { margin:20px 0;}
 
    .bitpay-donate fieldset {border:0;}
 
    .bitpay-donate input {padding:4px 10px;}
 
    .bitpay-donate select {padding:3px 10px;}
 
    .bitpay-donate ul, .bitpay-donate li {padding:0;margin:0;list-style:none;}
 
    .bitpay-donate li {padding:10px 0;}
 
    .bitpay-donate-field {clear:both;}
 
    .bitpay-donate-field label {float:left;width:100px;}
 
    .bitpay-donate-field div {float:left;}
 
    .bitpay-donate-field-email {width:80%;}
 
    .bitpay-donate-field-price {width:40%;}
 
    .bitpay-donate-field-currency {width:40%;}
 
    .bitpay-donate-button-wrapper {clear:both;margin:auto;text-align:center;}
 
    input.bitpay-donate-error {border:2px solid red;}
 
  </style>
 
{% endblock %}
 

	
 
{% block content %}
 
  <div class="col-md-4">
 
    <img src="{{ url_for('static', filename='images/Support.png') }}" class="img-responsive img-rounded center-block" alt="WhoIs" width="160"></img>
 
    <div class="text-center">
 
      <h2>Support us!</h2>
 
    </div>
 
  </div>
 
  <div class="col-md-8">
 
    <div class="jumbotron">
 
      <h2>Take action for a <strong>#FreeInternet</strong>! Support us today!</h2>
 
      <p>As a non-profit organization we are 100% community funded. Donations from our members and supporters will be used to <strong>power Tor nodes</strong>, <strong>print flyers and posters</strong> or cover administrative charges.</p>
 
      <span class='highlighted-label'><a href="{{ url_for('donate.received') }}"><span class="label label-info">Donation history</span></a></span>
 
      <span class='highlighted-label'><a href="{{ url_for('root.bridgeprogram') }}"><span class="label label-primary">Adopt a Tor Bridge</span></a></span>
 
    </div>
 
  </div>
 
  <div class="col-md-12">
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>Wire Transfer </h3>
 
        </center>
 
        <div class="well well-sm">
 
          <p>
 
            <strong>Account holder:</strong> Frënn vun der Ënn A.S.B.L.<br>
 
            <strong>BIC/SWIFT:</strong> BCEELULL<br>
 
            <strong>IBAN:</strong> LU65 0019 4055 6782 7000<br>
 
          </p>
 
       </div>
 
       <div class="well well-sm">
 
       <p>
 
         <strong>Account holder:</strong> Chaos Computer Club Lëtzebuerg A.S.B.L.<br>
 
         <strong>BIC/SWIFT:</strong> BCEELULL<br>
 
         <strong>IBAN:</strong> LU29 0019 2855 3890 4000<br>
 
         <strong>Subject:</strong> * to FVDE<br>
 
       </p>
 
       </div>
 
      </div>
 
    </div>
 
    <div class="col-md-4 clearfix">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>SnailMail</h3>
 
        </center>
 
        <div class="well well-sm">
 
          <div class="pull-right">
 
            <form class="form-inline" role="form" method="POST" action"{{ url_for('donate.index') }}">
 
              {{ form.hidden_tag() }}
 
              <div class="form-group">
 
                {{ form.country(class_='form-control input-sm', onchange='this.form.submit()') }}
 
                <noscript><input type="submit" class="btn btn-enn btn-sm" value="Submit"></noscript>
 
                <noscript>{{ form.submit(class_='btn btn-enn btn-sm') }}</noscript>
 
              </div>
 
            </form>
 
          </div>
 
          <address>
 
            <strong>Frënn vun der Ënn, ASBL</strong><br>
 
                    BPM 381892<br>
 
                    {{ address['address'] }}<br>
 
                    {{ address['postal_code'] }}, {{ address['city'] }}<br>
 
                    {{ address['country'] }}
 
          </address>
 
        </div>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>Bitcoin</h3>
 
        </center>
 
        <div class="well well-sm">
 
          <p>
 
            <strong>Bitcoin Address:</strong> 1EYZCq2ZL6chWXYYkJoDo7fz39UC7do5cC
 
          </p>
 
        </div>
 
        <form class="bitpay-donate form-horizontal" action="https://bitpay.com/checkout" method="POST" onsubmit="return checkRequiredFields(this);">
 
          <input name="action" type="hidden" value="checkout">
 
          <div class="form-group">
 
            <label class="col-sm-2 control-label">Email:</label>
 
            <div class="col-sm-10">
 
              <input class="bitpay-donate-field-email form-control" name="orderID" type="email" placeholder="Email address (optional)" maxlenght=50 autocapitalize=off autocorrect=off />
 
            </div>
 
          </div>
 
          <div class="form-group">
 
            <label class="col-sm-2 control-label">Amount:</label>
 
            <div class="col-sm-10">
 
              <input class="bitpay-donate-field-price form-control" style="display: inline;" name="price" type="number" value="0.1" placeholder="Amount" maxlenght="10" min="0.000006" step="0.000001" />
 
              <select class="bitpay-donate-field-currency form-control" style="display: inline;" value="" name="currency">
 
                <option selected="selected" value="BTC">BTC</option>
 
                <option value="USD">USD</option>
 
                <option value="EUR">EUR</option>
 
                <option value="GBP">GBP</option>
 
                <option value="AUD">AUD</option>
 
                <option value="BGN">BGN</option>
 
                <option value="BRL">BRL</option>
 
                <option value="CAD">CAD</option>
 
                <option value="CHF">CHF</option>
 
                <option value="CNY">CNY</option>
 
                <option value="CZK">CZK</option>
 
                <option value="DKK">DKK</option>
 
                <option value="HKD">HKD</option>
 
                <option value="HRK">HRK</option>
 
                <option value="HUF">HUF</option>
 
                <option value="IDR">IDR</option>
 
                <option value="ILS">ILS</option>
 
                <option value="INR">INR</option>
 
                <option value="JPY">JPY</option>
 
                <option value="KRW">KRW</option>
 
                <option value="LTL">LTL</option>
 
                <option value="LVL">LVL</option>
 
                <option value="MXN">MXN</option>
 
                <option value="MYR">MYR</option>
 
                <option value="NOK">NOK</option>
 
                <option value="NZD">NZD</option>
 
                <option value="PHP">PHP</option>
 
                <option value="PLN">PLN</option>
 
                <option value="RON">RON</option>
 
                <option value="RUB">RUB</option>
 
                <option value="SEK">SEK</option>
 
                <option value="SGD">SGD</option>
 
                <option value="THB">THB</option>
 
                <option value="TRY">TRY</option>
 
                <option value="ZAR">ZAR</option>
 
              </select>
 
            </div>
 
          </div>
 
          <input type="hidden" name="data" value="k3TZs7wPLcCaurVVZ8iW/MCwDwe94LwJrA22SKBNMwOmVLQ3AAW4TncxqpNFPVNScSCIqoQR+zwgYJSRtFBFciNwQ7Ezcnqb3JptfVNnDubnNy1KVTFCYXZ8m/83aFxFC0p6Lyf07a0HCEWTBMQhmVjFLuQYSa57kYQd+fzlL+lbi5pkBW8ok884l1ELYq6W">
 
          <div class="bitpay-donate-button-wrapper form-group">
 
            <input class="bitpay-donate-button" name="submit" src="https://bitpay.com/img/donate-button.svg" onerror="this.onerror=null; this.src='https://bitpay.com/img/donate-button-md.png'" width="126" height="48" type="image" alt="BitPay, the easy way the easy way to pay with bitcoins." border="0">
 
          </div>
 
        </form>
 
      </div>
 
    </div>
 
  </div>
 
  <div class="col-md-12">
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>PayPal <small><span class="label label-danger">high fees</span></small></h3>
 
          <p>Use your existing PayPal account or check-out as guest. (Credit cards accepted)</p>
 
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
 
    		  <input type="hidden" name="cmd" value="_s-xclick">
 
    		  <input type="hidden" name="hosted_button_id" value="JKNKAGHS65QN4">
 
    		  <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 
    		  <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
 
    		</form>
 
      </center>
 
      </div>
ennstatus/templates/donate/received.html
Show inline comments
 
{% extends "base.html" %}
 
{% import "donate/macros.html" as macros %}
 

	
 
{% set title = "Donate - Received donations" %}
 

	
 
{% block content %}
 
  <div class="col-md-12">
 
    <h2>Received Donations</h2>
 
  </div>
 
  <div class="col-md-12 clearfix">
 
    <div class="pull-left">
 
      {% if csv_file %}
 
        <h3>{{ '-'.join([year, month]) }}</h3>
 
      {% else %}
 
        <h3>Error!</h3>
 
      {% endif %}
 
    </div>
 
    <div class="pull-right">
 
      <form class="form-inline" role="form" method="POST" action="/donate/received">
 
        {{ form.hidden_tag() }}
 
        <div class="form-group">
 
          {{ form.year.label }}
 
          {{ form.year(class_='form-control input-sm') }}
 
          {{ form.month.label }}
 
          {{ form.month(class_='form-control input-sm') }}
 
          <input type="submit" class="btn btn-enn btn-sm" value="Submit">
 
          {{ form.submit(class_='btn btn-enn btn-sm') }}
 
        </div>
 
      </form> 
 
    </div>
 
  </div>
 
  <div class="col-md-12">
 
    {% if csv_file %}
 
      {{ macros.create_donations_table(csv_file) }}
 
    {% else %}
 
      {% if year and month %}
 
        <p>No donations found for {{ '-'.join([year, month]) }}!</p>
 
      {% else %}
 
        <p>No donations found!</p>
 
      {% endif %}
 
    {% endif %}
 
  </div>
 
{% endblock %}
ennstatus/templates/root/contact.html
Show inline comments
 
{% extends "base.html" %}
 

	
 
{% set title = "Contact" %}
 

	
 
{% block content %}
 
  <div class="col-md-4">
 
    <img src="{{ url_for('static', filename='images/Contact.png') }}" class="img-responsive img-rounded center-block" alt="WhoIs" width="160"></img>
 
    <div class="text-center">
 
      <h2>Contact</h2>
 
    </div>
 
  </div>
 
  <div class="col-md-8 clearfix">
 
    <h2 class="pull-left">General</h2>
 
    <div class="pull-right">
 
      <form class="form-inline" role="form" method="POST" action="{{ url_for('root.contact') }}">
 
        {{ form.hidden_tag()}}
 
        <div class="form-group">
 
          {{ form.country(class_='form-control input-sm', onchange='this.form.submit()') }}
 
          <noscript><input type="submit" class="btn btn-enn btn-sm" value="Submit"></noscript>
 
          <noscript>{{ form.submit(class_='btn btn-enn btn-sm') }}</noscript>
 
        </div>
 
      </form>
 
    </div>
 
  </div>
 
  <div class="col-md-8">
 
    <p>Please mail all general inquiries to:</p>
 
    <address>
 
      <strong>Frënn vun der Ënn, ASBL</strong><br>
 
        BPM 381892<br>
 
        {{ address['address'] }}<br>
 
        {{ address['postal_code'] }}, {{ address['city'] }}<br>
 
        {{ address['country'] }}<br>
 
        <br>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:info@enn.lu">info@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Website"><span class="glyphicon glyphicon-cloud"></span></abbr> : <a href="//enn.lu/">enn.lu/</a> <strong>or</strong> <a href="//{{ config['ENNSTATUS_ONION_ADDRESS'] }}/" target="_blank">{{ config['ENNSTATUS_ONION_ADDRESS'] }}</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : +352-691-71-77-44<br>
 
      <abbr title="Fax"><span class="glyphicon glyphicon-phone-alt"></span></abbr> : +352-20-21-18-60
 
    </address>
 

	
 
    <h2>Abuse</h2>
 
    <p>For further details about abuse handling, have a look over <a href="{{ url_for('root.abuse') }}">here</a>.</p>
 
    <address>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:abuse@enn.lu">abuse@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>+352-691-71-77-44<br>
 
    </address>
 

	
 
    <h2>Press</h2>
 
    <p>Press related inqueries should go to:</p>
 
    <address>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:press@enn.lu">press@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>+352-691-71-77-44<br>
 
    </address>
 

	
 
  </div>
 
{% endblock %}
0 comments (0 inline, 0 general)