|
| 1 | +{% extends "base.html" %} |
| 2 | + |
| 3 | +{% load i18n %} |
| 4 | +{% load static %} |
| 5 | + |
| 6 | +{% block title %}{% trans "Pay for your ad" %}{% endblock %} |
| 7 | + |
| 8 | +{% block extra_links %} |
| 9 | + <link rel="stylesheet" href="{% static 'payments/css/form.css' %}" /> |
| 10 | +{% endblock %} |
| 11 | + |
| 12 | +{% block extra_scripts %} |
| 13 | + <script src="https://js.stripe.com/v2/" type="text/javascript"></script> |
| 14 | + <script type="text/javascript" src="{% static 'vendor/knockout.js' %}"></script> |
| 15 | + <script type="text/javascript" src="{% static 'donate/js/donate.js' %}"></script> |
| 16 | + <script type="text/javascript"> |
| 17 | +var donate_views = require('donate/donate'); |
| 18 | +$(document).ready(function () { |
| 19 | + var key; |
| 20 | + //<![CDATA[ |
| 21 | + key = '{{ stripe_publishable }}'; |
| 22 | + //]]> |
| 23 | + |
| 24 | + var view = donate_views.DonateView.init({ |
| 25 | + key: key, |
| 26 | + form: $('form#donate-payment') |
| 27 | + }); |
| 28 | +}); |
| 29 | + </script> |
| 30 | +{% endblock %} |
| 31 | + |
| 32 | + |
| 33 | +{% block content %} |
| 34 | + <h2>Pay for your Sponsorship</h2> |
| 35 | + |
| 36 | + <p> |
| 37 | + This form can be used to pay for your sponsorship of Read the Docs. |
| 38 | + Thanks for helping make Open Source more sustainable! |
| 39 | + </p> |
| 40 | + |
| 41 | + <form action="" method="post" id="donate-payment" class="payment"> |
| 42 | + {% csrf_token %} |
| 43 | + |
| 44 | + {{ form.non_field_errors }} |
| 45 | + |
| 46 | + {% for field in form.fields_with_cc_group %} |
| 47 | + {% if field.is_cc_group %} |
| 48 | + <div class="subscription-card"> |
| 49 | + {% for groupfield in field.fields %} |
| 50 | + {% include 'core/ko_form_field.html' with field=groupfield %} |
| 51 | + {% endfor %} |
| 52 | + </div> |
| 53 | + {% elif field.name == 'dollars' %} |
| 54 | + {{ field.errors }} |
| 55 | + <p> |
| 56 | + <label for="{{ field.id_for_label }}">{{ field.label }}</label> |
| 57 | + <input |
| 58 | + type="hidden" |
| 59 | + name="{{ field.name }}" |
| 60 | + id="{{ field.id_for_label }}" |
| 61 | + data-bind="value: dollars" /> |
| 62 | + <input |
| 63 | + type="number" |
| 64 | + data-bind="textInput: dollars_input, visible: dollars_select() == 'custom'" |
| 65 | + value="50" |
| 66 | + id="id_dollars_input" |
| 67 | + style="display: none;" /> |
| 68 | + <select data-bind="value: dollars_select, visible: dollars_select() != 'custom'"> |
| 69 | + <option value="custom">{% trans "Custom amount" %}</option> |
| 70 | + <option value="2000">$2,000</option> |
| 71 | + <option value="3000">$3,000</option> |
| 72 | + <option value="5000" selected>$5,000</option> |
| 73 | + <option value="10000">$10,000</option> |
| 74 | + </select> |
| 75 | + {% if field.help_text %} |
| 76 | + <span class="helptext">{{ field.help_text }}</span> |
| 77 | + {% endif %} |
| 78 | + </p> |
| 79 | + {% else %} |
| 80 | + {% include 'core/ko_form_field.html' with field=field %} |
| 81 | + {% endif %} |
| 82 | + {% endfor %} |
| 83 | + |
| 84 | + {% trans "Pay" as form_submit_text %} |
| 85 | + <input type="submit" value="{{ form_submit_text }}" data-bind="click: process_form" /> |
| 86 | + <p> |
| 87 | + We do not store your credit card details, |
| 88 | + payment is processed directly through <a href="https://stripe.com">Stripe</a>. |
| 89 | + </p> |
| 90 | + </form> |
| 91 | +{% endblock %} |
0 commit comments