Skip to main content

max / makenotwork

1.3 KB · 24 lines History Blame Raw
1 {% if tips_enabled %}
2 {% if session_user.is_some() %}
3 <div class="tip-section">
4 <button type="button" class="tip-toggle" onclick="this.nextElementSibling.classList.toggle('hidden')">Support</button>
5 <form class="tip-form hidden" method="post" action="/stripe/checkout/tip/{{ creator_id }}">
6 {% if let Some(token) = csrf_token %}<input type="hidden" name="_csrf" value="{{ token }}">{% endif %}
7 {% if let Some(pid) = tip_project_id %}<input type="hidden" name="project_id" value="{{ pid }}">{% endif %}
8 <div class="tip-amount-row">
9 <label for="tip-amount" class="sr-only">Tip amount</label>
10 <span class="pricing-currency">$</span>
11 <input type="number" id="tip-amount" name="amount_dollars" min="1" max="9999" value="5" step="1" class="tip-amount-input" required>
12 </div>
13 <label for="tip-message" class="sr-only">Message (optional)</label>
14 <textarea id="tip-message" name="message" maxlength="280" placeholder="Add a message (optional)" class="tip-message-input" rows="2"></textarea>
15 <button type="submit" class="tip-submit" data-loading-text="Redirecting to Stripe…">Send tip</button>
16 </form>
17 </div>
18 {% else %}
19 <div class="tip-section">
20 <a href="/login" class="tip-toggle">Support</a>
21 </div>
22 {% endif %}
23 {% endif %}
24