diff --git a/config.ini.example b/config.ini.example index 0e7a3e7..ada3730 100644 --- a/config.ini.example +++ b/config.ini.example @@ -26,3 +26,9 @@ connection-string=postgresql://postgres@localhost/fosspay # Click here first: https://dashboard.stripe.com/account/bitcoin/enable enable-bitcoin=no + +# Pick between 5, 10, 20, or 50 +default-amount=10 + +# Pick between "monthly" and "once" +default-type=monthly diff --git a/fosspay/app.py b/fosspay/app.py index 08f031d..e8cc6a9 100644 --- a/fosspay/app.py +++ b/fosspay/app.py @@ -72,5 +72,6 @@ def inject(): 'file_link': file_link, 'user': current_user, '_cfg': _cfg, + '_cfgi': _cfgi, 'debug': app.debug } diff --git a/scripts/index.js b/scripts/index.js index 4afb174..513b8d5 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,7 +1,7 @@ (function() { var donation = { - type: "monthly", - amount: 1000, // cents + type: window.default_type, + amount: window.default_amount * 100, // cents project: null, comment: null }; diff --git a/templates/index.html b/templates/index.html index 2f2c7f5..5c36f06 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,6 +5,8 @@ window.stripe_key = "{{ _cfg("stripe-publish") }}"; window.avatar = "{{ avatar }}"; window.your_name = "{{ _cfg("your-name") }}"; window.bitcoin = "{{ _cfg("enable-bitcoin") }}" === "yes"; +window.default_amount = {{ _cfg("default-amount") }}; +window.default_type = "{{ _cfg("default-type") }}"; @@ -49,16 +51,24 @@ window.bitcoin = "{{ _cfg("enable-bitcoin") }}" === "yes";
- +
- +
- +
- +
@@ -87,11 +97,13 @@ window.bitcoin = "{{ _cfg("enable-bitcoin") }}" === "yes";
+ class="btn btn-default {{"active" if _cfg("default-type")=="once" else ""}}"> + Once
+ class="btn btn-default {{"active" if _cfg("default-type")=="monthly" else ""}}"> + Monthly