Skip to main content

max / makenotwork

4.8 KB · 101 lines History Blame Raw
1 {% extends "base.html" %}
2
3 {% block title %}{{ project.title }} - {{ creator_username }}{% endblock %}
4 {% block body_attrs %} class="{{ crate::shell::measure(crate::shell::Measure::Wide) }} project-paywall-page"{% endblock %}
5
6 {% block social_card %}
7 {% if let Some(img) = project.cover_image_url %}
8 <meta property="og:image" content="{{ img }}">
9 <meta name="twitter:card" content="summary_large_image">
10 <meta name="twitter:image" content="{{ img }}">
11 {% else %}
12 <meta name="twitter:card" content="summary">
13 {% endif %}
14 {% endblock %}
15
16 {% block head %}
17 <meta property="og:title" content="{{ project.title }} by {{ creator_username }}">
18 <meta property="og:description" content="{{ project.description }}">
19 <meta property="og:url" content="{{ host_url }}/p/{{ project.slug }}">
20 <link rel="canonical" href="{{ host_url }}/p/{{ project.slug }}">
21 {% endblock %}
22
23 {% block content %}
24 {% include "partials/site_header.html" %}
25
26 <div class="container">
27 <section class="paywall-section">
28 <div class="paywall-box">
29 {% if let Some(cover) = project.cover_image_url %}
30 <div class="paywall-cover">
31 <img src="{{ cover }}" alt="{{ project.title }}">
32 </div>
33 {% endif %}
34
35 <h1 class="paywall-title">{{ project.title }}<span class="dot">.</span></h1>
36 <p class="paywall-creator">by <a href="/u/{{ creator_username }}">{{ creator_username }}</a></p>
37
38 {% if !project.description.is_empty() %}
39 <p class="paywall-description">{{ project.description }}</p>
40 {% endif %}
41
42 {% if project.item_count > 0 %}
43 <p class="paywall-item-count">{{ project.item_count }} item{% if project.item_count != 1 %}s{% endif %} included</p>
44 {% endif %}
45
46 <div class="paywall-price">{{ price_display }}</div>
47
48 {% match checkout_type %}
49 {% when crate::pricing::CheckoutType::OneTime %}
50 {% if session_user.is_some() %}
51 <form method="POST" action="/stripe/checkout/project/{{ project.id }}">
52 <button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Purchase Access</button>
53 </form>
54 {% else %}
55 <a href="/login" class="btn-primary">Log in to Purchase</a>
56 {% endif %}
57
58 {% when crate::pricing::CheckoutType::PayWhatYouWant %}
59 {% if session_user.is_some() %}
60 <form method="POST" action="/stripe/checkout/project/{{ project.id }}">
61 <div class="form-group form-group--centered-narrow">
62 <label for="amount">Your price</label>
63 <input type="number" name="amount_dollars" id="amount" min="{{ pwyw_min_dollars }}" step="0.01" placeholder="0.00"
64 aria-describedby="amount-unit">
65 <span class="form-unit" id="amount-unit">USD</span>
66 </div>
67 <button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Purchase Access</button>
68 </form>
69 {% else %}
70 <a href="/login" class="btn-primary">Log in to Purchase</a>
71 {% endif %}
72
73 {% when crate::pricing::CheckoutType::Subscription %}
74 {% if !subscription_tiers.is_empty() %}
75 <div class="paywall-tiers">
76 {% for tier in subscription_tiers %}
77 <div class="card--bordered tier-card">
78 <h3>{{ tier.name }}</h3>
79 <div class="tier-price">{{ tier.price }}/mo</div>
80 {% if !tier.description.is_empty() %}
81 <p class="paywall-desc">{{ tier.description }}</p>
82 {% endif %}
83 {% if session_user.is_some() %}
84 <form method="POST" action="/stripe/subscribe/{{ tier.id }}">
85 <button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Subscribe</button>
86 </form>
87 {% else %}
88 <a href="/login" class="btn-primary button">Log in to Subscribe</a>
89 {% endif %}
90 </div>
91 {% endfor %}
92 </div>
93 {% endif %}
94
95 {% when crate::pricing::CheckoutType::None %}
96 {% endmatch %}
97 </div>
98 </section>
99 </div>
100 {% endblock %}
101