add progress bar to subscribe.html
This commit is contained in:
parent
27c3e97b91
commit
f423750248
@ -72,6 +72,15 @@ class sender():
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def pledged(self):
|
||||||
|
sum = 0
|
||||||
|
f = open("donors.txt", "r")
|
||||||
|
|
||||||
|
for line in f:
|
||||||
|
sum += int(line.split(",")[1])
|
||||||
|
|
||||||
|
return sum
|
||||||
|
|
||||||
class donor():
|
class donor():
|
||||||
'''
|
'''
|
||||||
Class that represents a donor
|
Class that represents a donor
|
||||||
|
@ -5,13 +5,16 @@ import donationcalc.donationconfig
|
|||||||
|
|
||||||
@app.route('/donations/subscribe/', methods=['POST', 'GET'])
|
@app.route('/donations/subscribe/', methods=['POST', 'GET'])
|
||||||
def subscribe():
|
def subscribe():
|
||||||
if request.method == 'GET':
|
|
||||||
return render_template('subscribe.html')
|
|
||||||
elif request.method == 'POST':
|
|
||||||
config = donationcalc.donationconfig.donationconfig()
|
config = donationcalc.donationconfig.donationconfig()
|
||||||
currency = config.currency
|
currency = config.currency
|
||||||
sender = donationcalc.models.sender()
|
|
||||||
|
|
||||||
|
sender = donationcalc.models.sender()
|
||||||
|
currentlypledged = sender.pledged()
|
||||||
|
currentpercent = round(currentlypledged/int(config.monthlycost), 2)
|
||||||
|
|
||||||
|
if request.method == 'GET':
|
||||||
|
return render_template('subscribe.html', monthlycost = int(config.monthlycost), pledged = currentlypledged, percent = currentpercent)
|
||||||
|
elif request.method == 'POST':
|
||||||
donoremail = request.form['email']
|
donoremail = request.form['email']
|
||||||
donormonthly = request.form['monthly']
|
donormonthly = request.form['monthly']
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
color: #3d3d3d;
|
color: #3d3d3d;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@ -19,6 +21,9 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main class="container">
|
<main class="container">
|
||||||
|
<h1 style="text-align:center;">Currently pledged to donate</h1>
|
||||||
|
<progress style="text-align:center;" id="donationprogress" max="{{ monthlycost }}" value="{{ pledged }}"> {{ percent }}% </progress>
|
||||||
|
|
||||||
<h1 style="text-align:center;">Subscribe for donation notifications</h1>
|
<h1 style="text-align:center;">Subscribe for donation notifications</h1>
|
||||||
<form action="/donations/subscribe/" method="POST" style="text-align:center;">
|
<form action="/donations/subscribe/" method="POST" style="text-align:center;">
|
||||||
<label for="email">email</label>
|
<label for="email">email</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user