Skip to main content

max / makenotwork

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