Skip to main content

max / makenotwork

4.6 KB · 99 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_cents" id="amount" min="0" step="1" placeholder="0">
64 </div>
65 <button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Purchase Access</button>
66 </form>
67 {% else %}
68 <a href="/login" class="btn-primary">Log in to Purchase</a>
69 {% endif %}
70
71 {% when crate::pricing::CheckoutType::Subscription %}
72 {% if !subscription_tiers.is_empty() %}
73 <div class="paywall-tiers">
74 {% for tier in subscription_tiers %}
75 <div class="card--bordered tier-card">
76 <h3>{{ tier.name }}</h3>
77 <div class="tier-price">{{ tier.price }}/mo</div>
78 {% if !tier.description.is_empty() %}
79 <p class="paywall-desc">{{ tier.description }}</p>
80 {% endif %}
81 {% if session_user.is_some() %}
82 <form method="POST" action="/stripe/subscribe/{{ tier.id }}">
83 <button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Subscribe</button>
84 </form>
85 {% else %}
86 <a href="/login" class="btn-primary button">Log in to Subscribe</a>
87 {% endif %}
88 </div>
89 {% endfor %}
90 </div>
91 {% endif %}
92
93 {% when crate::pricing::CheckoutType::None %}
94 {% endmatch %}
95 </div>
96 </section>
97 </div>
98 {% endblock %}
99