| 1 |
{% extends "base.html" %} |
| 2 |
|
| 3 |
{% block title %}{{ project.title }} - {{ creator_username }}{% endblock %} |
| 4 |
{% block body_attrs %} class="padded-page 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 |
<div class="paywall-price">{{ price_display }}</div> |
| 41 |
|
| 42 |
{% match checkout_type %} |
| 43 |
{% when crate::pricing::CheckoutType::OneTime %} |
| 44 |
{% if session_user.is_some() %} |
| 45 |
<form method="POST" action="/stripe/checkout/project/{{ project.id }}"> |
| 46 |
<button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Purchase Access</button> |
| 47 |
</form> |
| 48 |
{% else %} |
| 49 |
<a href="/login" class="btn-primary">Log in to Purchase</a> |
| 50 |
{% endif %} |
| 51 |
|
| 52 |
{% when crate::pricing::CheckoutType::PayWhatYouWant %} |
| 53 |
{% if session_user.is_some() %} |
| 54 |
<form method="POST" action="/stripe/checkout/project/{{ project.id }}"> |
| 55 |
<div class="form-group form-group--centered-narrow"> |
| 56 |
<label for="amount">Your price ($)</label> |
| 57 |
<input type="number" name="amount_cents" id="amount" min="0" step="1" placeholder="0"> |
| 58 |
</div> |
| 59 |
<button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Purchase Access</button> |
| 60 |
</form> |
| 61 |
{% else %} |
| 62 |
<a href="/login" class="btn-primary">Log in to Purchase</a> |
| 63 |
{% endif %} |
| 64 |
|
| 65 |
{% when crate::pricing::CheckoutType::Subscription %} |
| 66 |
{% if !subscription_tiers.is_empty() %} |
| 67 |
<div class="paywall-tiers"> |
| 68 |
{% for tier in subscription_tiers %} |
| 69 |
<div class="tier-card"> |
| 70 |
<h3>{{ tier.name }}</h3> |
| 71 |
<div class="tier-price">{{ tier.price }}/mo</div> |
| 72 |
{% if !tier.description.is_empty() %} |
| 73 |
<p class="paywall-desc">{{ tier.description }}</p> |
| 74 |
{% endif %} |
| 75 |
{% if session_user.is_some() %} |
| 76 |
<form method="POST" action="/stripe/subscribe/{{ tier.id }}"> |
| 77 |
<button type="submit" class="btn-primary" data-loading-text="Redirecting to Stripe...">Subscribe</button> |
| 78 |
</form> |
| 79 |
{% else %} |
| 80 |
<a href="/login" class="btn-primary button">Log in to Subscribe</a> |
| 81 |
{% endif %} |
| 82 |
</div> |
| 83 |
{% endfor %} |
| 84 |
</div> |
| 85 |
{% endif %} |
| 86 |
|
| 87 |
{% when crate::pricing::CheckoutType::None %} |
| 88 |
{% endmatch %} |
| 89 |
</div> |
| 90 |
</section> |
| 91 |
</div> |
| 92 |
{% endblock %} |
| 93 |
|