Changeset - 5edeacb940e8
[Not reviewed]
default
0 4 0
Dennis Fink - 11 years ago 2014-01-21 19:09:24
dennis.fink@c3l.lu
added bpm as donate option
4 files changed with 8 insertions and 4 deletions:
0 comments (0 inline, 0 general)
ennstatus/donate/views.py
Show inline comments
 
from flask import (Blueprint, render_template, request,
 
                   redirect, url_for, current_app)
 

	
 
from ennstatus.donate.forms import DateForm
 
from ennstatus.donate.functions import load_csv, get_choices
 

	
 
donate_page = Blueprint('donate', __name__)
 

	
 

	
 
@donate_page.route('/')
 
def index():
 
    return render_template('donate/index.html')
 

	
 

	
 
@donate_page.route('/wiretransfer')
 
def wiretransfer():
 
    return render_template('donate/wiretransfer.html')
 

	
 

	
 
@donate_page.route('/snailmail')
 
def snailmail():
 
    return render_template('donate/snailmail.html')
 

	
 

	
 
@donate_page.route('/paypal')
 
def paypal():
 
    return render_template('donate/paypal.html')
 

	
 

	
 
@donate_page.route('/bitcoin')
 
def bitcoin():
 
    return render_template('donate/bitcoin.html')
 

	
 

	
 
@donate_page.route('/flattr')
 
def flattr():
 
    return render_template('donate/flattr.html')
 

	
 
@donate_page.route('/bpm')
 
def bpm():
 
    return render_template('donate/bpm.html')
 

	
 
@donate_page.route('/received',
 
                   methods=('GET', 'POST'))
 
def received():
 

	
 
    current_app.logger.info('Handling received')
 
    form = DateForm()
 

	
 
    current_app.logger.debug('Creating choices')
 
    choices = [name for name in get_choices()]
 
    choices.sort()
 
    form.date.choices = [(name, name) for name in choices]
 

	
 
    if not choices:
 
        current_app.logger.warn('No donations found!')
 
        return render_template('donate/received.html',
 
                               form=form, csv_file=None,
 
                               date=None)
 

	
 
    if request.method == 'POST':
 
        current_app.logger.debug('Validating form')
 
        if form.validate_on_submit():
 
            date = form.date.data
 
            return redirect(url_for('donate.received', date=date))
 
    else:
 
        if 'date' in request.args:
 
            date = request.args['date']
 
            if request.args['date'] in choices:
 
                current_app.logger.info('Showing date %s' % date)
 
                form.date.data = date
 
                csv_file = load_csv(date)
 
            else:
 
                current_app.logger.warn('Date %s not found' % date)
 
                return ('Date %s not found!' % date, 500,
 
                        {'Content-Type': 'text/plain'})
 
        else:
 
            current_app.logger.info('Showing last date %s' % choices[-1])
 
            form.date.data = choices[-1]
 
            csv_file = load_csv(choices[-1])
 
            date = choices[-1]
 

	
 
        current_app.logger.info('Return result')
 
        return render_template('donate/received.html',
 
                               form=form, csv_file=csv_file,
 
                               date=date)
ennstatus/templates/base.html
Show inline comments
 
{% extends "bootstrap/base.html" %}
 

	
 
{% block title %}
 
  Frënn vun der Ënn - {{ title }}
 
{% endblock %}
 

	
 
{% block metas %}
 
  {{ super() }}
 
  <meta charset="utf-8">
 
  <meta name="application-name" content="Ënnstatus">
 
  <meta name="author" content="Frënn vun der Ënn">
 
{% endblock %}
 

	
 
{% block styles %}
 
  {{ super() }}
 
  <link rel="stylesheet" href="{{ url_for('static', filename='css/ennstatus.css') }}" />
 
{% endblock %}
 

	
 
{% block body %}
 
<a href="#content" class="sr-only">Skip to main content</a>
 
<div class="container">
 
  {% block navbar %}
 
  <div class="navbar navbar-default">
 
    <div class="navbar-header">
 
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
 
        <span class="icon-bar"></span>
 
        <span class="icon-bar"></span>
 
        <span class="icon-bar"></span>
 
      </button>
 
      <a class="navbar-brand" href="{{ url_for('root.index') }}">Enn.lu</a>
 
    </div>
 
    <div class="navbar-collapse collapse">
 
      <ul class="nav navbar-nav">
 
        <li>
 
          <a href="{{ url_for('root.about') }}">About</a>
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.services') }}">Services</a>
 
        </li>
 
        <li class="dropdown">
 
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Donate <b class="caret"></b></a>
 
          <ul class="dropdown-menu">
 
            <li><a href="{{ url_for('donate.index') }}">Support us</a></li>
 
            <li><a href="{{ url_for('donate.wiretransfer') }}">Wiretransfer</a></li>
 
            <li><a href="{{ url_for('donate.snailmail') }}">Snailmail</a></li>
 
            <li><a href="{{ url_for('donate.paypal') }}">PayPal</a></li>
 
            <li><a href="{{ url_for('donate.bitcoin') }}">Bitcoin</a></li>
 
            <li><a href="{{ url_for('donate.flattr') }}">Flattr</a></li>
 
            <li><a href="{{ url_for('donate.bpm') }}">BPM</a></li>
 
            <li class="divider"></li>
 
            <li><a href="{{ url_for('donate.received') }}">Received Donations</a></li>
 
          </ul>
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.partners') }}">Partners</a>
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.contact') }}">Contact</a>
 
        </li>
 
        <li>
 
          <a href="{{ url_for('root.abuse') }}">Abuse</a>
 
        </li>
 
        <li>
 
          <a href="http://wiki.enn.lu">Wiki</a>
 
        </li>
 
        <li class="dropdown">
 
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Servers <b class="caret"></b></a>
 
          <ul class="dropdown-menu">
 
            <li><a href="{{ url_for('status.index') }}">All nodes</a></li>
 
            <li><a href="{{ url_for('status.exit') }}">Exit nodes</a></li>
 
            <li><a href="{{ url_for('status.relay') }}">Relay nodes</a></li>
 
            <li><a href="{{ url_for('status.bridge') }}">Bridge nodes</a></li>
 
            <li class="divider"></li>
 
            <li><a href="{{ url_for('status.about') }}">Ënnstatus About</a></li>
 
          </ul>
 
        </li>
 
     </ul>
 
    </div>
 
  </div>
 
  {% endblock %}
 
  <div class="row" id="content">
 
  {% block content %}
 
  {% endblock %}
 
  </div>
 
  <footer>
 
    <hr style="margin-bottom: 0.5%;">
 
    <div class="col-md-12">
 
      <a href="https://twitter.com/FrennVunDerEnn/" target="_blank"><img src="{{ url_for('static', filename='images/Twitter.png') }}" width="45" height="45"></img></a>
 
      <a class="pull-right" rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" /></a>
 
    </div>
 
    <div class="col-md-12 text-center" style="margin-top: 0.5%; margin-bottom: 0.5%;">
 
      <a href="{{ url_for('root.disclaimer') }}">Disclaimer</a>
 
    </div>
 
  </footer>
 
</div>
 

	
 
{% block scripts %}
ennstatus/templates/donate/bpm.html
Show inline comments
 
{% extends "base.html" %}
 

	
 
{% set title = "Donate - Flattr" %}
 
{% set title = "Donate - BPM" %}
 

	
 
{% block content %}
 
  <div class="col-md-4 text-center">
 
    <img src="{{ url_for('static', filename='images/bpm.gif') }}" class="img-rounded" alt="BPM"></img>
 
    <img src="{{ url_for('static', filename='images/BPM.gif') }}" class="img-rounded" alt="BPM"></img>
 
    <h2>BPM Points</h2>
 
  </div>
 
  <div class="col-md-8">
 
    <blockquote>
 
      <p>"<em>Privacy is not something that I'm merely entitled to, it's an absolute prerequisite.</em>"</p>
 
      <small>Marlon Brando<cite>brainyquote</cite></small>
 
    </blockquote>
 

	
 
    <p>We accept <strong>BPM</strong> points as they will be used for our BPM Parcel Station. The parcel station is used for receiving and sending mails and packages around the world!</p>
 
    <div class="alert-info text-center">
 
	    <a href="mailto:info@fvde.lu">Mail us your BPM voucher code!</a>
 
	    <a href="mailto:info@enn.lu">Mail us your BPM voucher code!</a>
 
    </div>
 
  </div>
 
{% endblock %}
ennstatus/templates/donate/index.html
Show inline comments
 
@@ -29,57 +29,57 @@
 
          <a class="btn btn-info" href="{{ url_for('donate.wiretransfer') }}">Take Action Now</a>
 
        </center>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <a href="{{ url_for('donate.snailmail') }}"><img src="{{ url_for('static', filename='images/SnailMail.png') }}" width="135" height="135"></img></a>
 
          <h5>SnailMail</h5>
 
          <p>As anonymous as possible.</p>
 
          <a class="btn btn-info" href="{{ url_for('donate.snailmail') }}">Take Action Now</a>
 
        </center>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <a href="{{ url_for('donate.paypal') }}"><img src="{{ url_for('static', filename='images/PayPal_Logo.png') }}" width="135" height="135"></img></a>
 
          <h5>PayPal</h5>
 
          <p>All major cards accepted.</p>
 
          <a class="btn btn-info" href="{{ url_for('donate.paypal') }}">Take Action Now</a>
 
        </center>
 
      </div>
 
    </div>
 
    <!-- Second row of possibilities -->
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <a href="{{ url_for('donate.bitcoin') }}"><img src="{{ url_for('static', filename='images/BitCoin_Logo.png') }}" width="135" height="135"></img></a>
 
          <h5>BitCoin</h5>
 
          <p>A free alternative method.</p>
 
          <a class="btn btn-info" href="{{ url_for('donate.bitcoin') }}">Take Action Now</a>
 
        </center>
 
      </div>
 
    </div>  
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <a href="{{ url_for('donate.flattr') }}"><img src="{{ url_for('static', filename='images/Flattr_Logo.png') }}" width="135" height="135"></img></a>
 
          <h5>Flattr</h5>
 
          <p>Flattr us!</p>
 
          <a class="btn btn-info" href="{{ url_for('donate.flattr') }}">Take Action Now</a>
 
        </center>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <a href="{{ url_for('root.contact') }}"><img src="{{ url_for('static', filename='images/BPM.gif') }}" width="135" height="135"></img></a>
 
          <a href="{{ url_for('donate.bpm') }}"><img src="{{ url_for('static', filename='images/BPM.gif') }}" width="135" height="135"></img></a>
 
          <h5>BPM Points</h5>
 
          <p>For our parcel station!</p>
 
          <a class="btn btn-info" href="{{ url_for('donate.bpm') }}">Take Action Now</a>
 
        </center>
 
      </div>
 
    </div>
 
  </div>
 
{% endblock %}
0 comments (0 inline, 0 general)