Adjusted donation state
This commit is contained in:
@@ -7,15 +7,15 @@ class ChargesController < ApplicationController
|
||||
begin
|
||||
@amount = Float(@amount).round(2)
|
||||
rescue
|
||||
flash[:error] = 'Bitte geben sie einen Betrag in CHF ein.'
|
||||
flash[:danger] = 'Bitte geben sie einen Betrag in CHF ein.'
|
||||
redirect_to donation_path
|
||||
return
|
||||
end
|
||||
|
||||
@amount = (@amount * 100).to_i # Must be an integer!
|
||||
|
||||
if @amount < 500
|
||||
flash[:error] = 'Ihre Spende muss mindestens 5.- CHF betragen.'
|
||||
if @amount < 1000
|
||||
flash[:danger] = 'Ihre Spende muss mindestens 10.- CHF betragen.'
|
||||
redirect_to donation_path
|
||||
return
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ javascript:
|
||||
});
|
||||
|
||||
h2 Spendenbarometer
|
||||
b Aktueller Stand: 93'000 CHF
|
||||
b Aktueller Stand: 101'250 CHF
|
||||
.row
|
||||
.col-xs-12
|
||||
.progress-target style="width: 20%"
|
||||
@@ -35,29 +35,31 @@ b Aktueller Stand: 93'000 CHF
|
||||
| 500'000 CHF
|
||||
|
||||
.progress
|
||||
.progress-bar.progress-bar-success role="progressbar" aria-valuenow="93000" aria-valuemin="0" aria-valuemax="500000" style="width: 18.6%"
|
||||
.progress-bar.progress-bar-success role="progressbar" aria-valuenow="101250" aria-valuemin="0" aria-valuemax="500000" style="width: 20.6%"
|
||||
|
||||
p Detailliertere Informationen, wie dieses Geld eingesetzt wird, findest du unter <a href="#{collection_concept_path}">«Wie macht man eine Volksinitiative?»</a>
|
||||
|
||||
h2 Via Kreditkarte online spenden
|
||||
= form_tag charges_path do
|
||||
= hidden_field_tag(:stripeToken)
|
||||
- if flash[:error].present?
|
||||
#error_explanation.text-danger
|
||||
= flash[:error]
|
||||
#error_explanation.text-danger.hidden
|
||||
= flash[:error] if flash[:error].present?
|
||||
.row
|
||||
.col-xs12.col-md-5
|
||||
button.donatebox.btn.btn-success onclick="donate(20)" 20 .-
|
||||
button.donatebox.btn.btn-success onclick="donate(50)" 50 .-
|
||||
button.donatebox.btn.btn-success onclick="donate(100)" 100 .-
|
||||
button.donatebox.btn.btn-success onclick="donate(200)" 200 .-
|
||||
button.donatebox.btn.btn-success onclick="donate(500)" 500 .-
|
||||
button.donatebox.btn.btn-success onclick="donate(1000)" 1000 .-
|
||||
|
||||
.col-xs12.col-md-6
|
||||
.form-group
|
||||
strong oder einen eigenen Betrag
|
||||
.form-group
|
||||
.input-group
|
||||
.input-group-addon CHF
|
||||
= text_field_tag(:amount, 50 , class: 'form-control')
|
||||
= text_field_tag(:amount, 100 , class: 'form-control')
|
||||
|
||||
.form-group
|
||||
button#donateButton.btn.btn-success Spenden übermitteln
|
||||
@@ -121,10 +123,12 @@ javascript:
|
||||
amount = parseFloat(amount);
|
||||
|
||||
if (isNaN(amount)) {
|
||||
$('#error_explanation').toggleClass('hidden')
|
||||
$('#error_explanation').html('<p>Bitte geben sie einen Betrag in CHF ein.</p>');
|
||||
}
|
||||
else if (amount < 5.00) {
|
||||
$('#error_explanation').html('<p>Ihre Spende muss mindestens 5.- CHF betragen.</p>');
|
||||
else if (amount < 10.00) {
|
||||
$('#error_explanation').toggleClass('hidden')
|
||||
$('#error_explanation').html('<p>Ihre Spende muss mindestens 10.- CHF betragen.</p>');
|
||||
}
|
||||
else {
|
||||
amount = amount * 100; // Needs to be an integer!
|
||||
|
||||
Reference in New Issue
Block a user