Configure shop app, admin sidebar, media routing, and Stripe dependencies

This commit is contained in:
zach committed 2026-11-24 00:16:35 +00:00
commit 93d83a0d63
188 files changed
+9220

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
{% extends 'base.html' %}
{% block title %}Cart · Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell">
<h1>Shopping Cart</h1>
{% if items %}
<table style="width:100%;border-collapse:collapse;margin-bottom:1.5rem;">
<thead>
<tr><th align="left">Item</th><th align="left">Qty</th><th align="right">Total</th></tr>
</thead>
<tbody>
{% for row in items %}
<tr>
<td>{{ row.product.title }}</td>
<td>
<form method="post" action="{% url 'shop-cart-update' row.product.pk %}" style="display:inline-flex;gap:.4rem;">
{% csrf_token %}
<input type="number" name="quantity" value="{{ row.quantity }}" min="0" max="20" style="width:64px;">
<button type="submit">Update</button>
</form>
</td>
<td align="right">${{ row.line_total }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>Subtotal: <strong>${{ subtotal }}</strong></p>
{% if has_physical %}<p>Shipping: <strong>${{ shipping }}</strong></p>{% endif %}
<p style="font-size:1.25rem;">Total: <strong>${{ total }}</strong></p>
<form method="post" action="{% url 'shop-checkout' %}" style="margin-top:1.5rem;display:grid;gap:.75rem;max-width:380px;">
{% csrf_token %}
{% if not request.user.is_authenticated or not request.user.email %}
<label>Email (for receipt &amp; digital downloads)
<input type="email" name="email" required placeholder="you@example.com">
</label>
{% endif %}
{% if stripe_enabled %}
<button type="submit" name="gateway" value="stripe" class="btn">Checkout with Card / Apple Pay (Stripe)</button>
{% endif %}
{% if paypal_enabled %}
<button type="submit" name="gateway" value="paypal" class="btn">Checkout with PayPal</button>
{% endif %}
</form>
{% else %}
<p>Your cart is empty. <a href="{% url 'shop-index' %}">Browse the shop &rarr;</a></p>
{% endif %}
</main>
{% endblock %}
+40
View File
@@ -0,0 +1,40 @@
{% extends 'base.html' %}
{% block title %}Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell theme-shop">
<header class="section-head" style="display:flex;justify-content:space-between;align-items:center;gap:1rem;">
<h1>Shop</h1>
<a class="btn" href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a>
</header>
{% if request.GET.subscribed %}
<p class="notice">Thank you! Your subscription is processing and will activate momentarily.</p>
{% endif %}
<div class="shop-grid">
{% for product in products %}
<article class="card shop-product">
<a href="{% url 'shop-product' product.slug %}" style="text-decoration:none;color:inherit;display:block;padding:1rem 1rem 0;">
<div class="shop-image{% if product.image %} has-shop-image{% endif %}" data-shop-image>
{% if product.image %}
<img src="{{ product.image.url }}" alt="{{ product.title }}" onerror="this.style.display='none';this.parentElement.classList.remove('has-shop-image');">
{% endif %}
<div class="shop-image-placeholder">SLX</div>
</div>
</a>
<header>
<span class="badge">{{ product.get_kind_display }}</span>
<h2 style="margin-top:.4rem;"><a href="{% url 'shop-product' product.slug %}">{{ product.title }}</a></h2>
{% if product.summary %}<p>{{ product.summary }}</p>{% endif %}
</header>
<div class="shop-option" style="display:flex;justify-content:space-between;align-items:center;gap:.75rem;">
<strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong>
<a class="btn" href="{% url 'shop-product' product.slug %}">View Details</a>
</div>
</article>
{% empty %}
<p>No shop items are live yet. Check back soon.</p>
{% endfor %}
</div>
</main>
{% endblock %}
+21
View File
@@ -0,0 +1,21 @@
{% extends 'base.html' %}
{% block title %}Order {{ order.order_id|slice:":8" }} · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell">
<h1>Order #{{ order.order_id|slice:":8" }}</h1>
<p>Status: <strong>{{ order.get_status_display }}</strong> · Total: <strong>${{ order.total_usd }}</strong></p>
{% if order.tracking_number %}<p>Tracking: <strong>{{ order.tracking_number }}</strong></p>{% endif %}
<ul>
{% for item in order.items.all %}
<li>
{{ item.quantity }} &times; {{ item.title_snapshot }} (${{ item.line_total }})
{% if item.product.kind == 'digital' and order.status in 'paid,shipped,delivered' %}
— <a href="{% url 'shop-download' order.order_id item.pk %}"><strong>Download File</strong></a>
{% endif %}
</li>
{% endfor %}
</ul>
<p><a href="{% url 'shop-index' %}">&larr; Return to Shop</a></p>
</main>
{% endblock %}
+45
View File
@@ -0,0 +1,45 @@
{% extends 'base.html' %}
{% block title %}{{ product.title }} · Shop · SLUMP X LAND{% endblock %}
{% block content %}
<main class="page-shell">
<p><a href="{% url 'shop-index' %}">&larr; Back to Shop</a></p>
<article class="product-detail" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:2rem;">
{% if product.image %}
<div><img src="{{ product.image.url }}" alt="{{ product.title }}" style="width:100%;border-radius:8px;"></div>
{% endif %}
<div>
<span class="badge">{{ product.get_kind_display }}</span>
<h1>{{ product.title }}</h1>
<p style="font-size:1.35rem;"><strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong></p>
{% if product.description %}<div class="prose">{{ product.description|linebreaks }}</div>{% endif %}
{% if product.kind == 'subscription' %}
<form method="post" action="{% url 'shop-subscribe' product.slug %}" style="margin-top:1.5rem;display:grid;gap:.75rem;max-width:360px;">
{% csrf_token %}
{% if not request.user.is_authenticated or not request.user.email %}
<label>Email for membership receipts
<input type="email" name="email" required placeholder="you@example.com">
</label>
{% endif %}
{% if stripe_enabled %}
<button type="submit" name="gateway" value="stripe" class="btn">Subscribe with Card (Stripe)</button>
{% endif %}
{% if paypal_enabled and product.paypal_plan_id %}
<button type="submit" name="gateway" value="paypal" class="btn">Subscribe with PayPal</button>
{% endif %}
</form>
{% else %}
{% if product.in_stock %}
<form method="post" action="{% url 'shop-cart-add' product.pk %}" style="margin-top:1.5rem;display:flex;gap:.75rem;align-items:center;">
{% csrf_token %}
<input type="number" name="quantity" value="1" min="1" max="20" style="width:72px;">
<button type="submit" class="btn">Add to Cart</button>
</form>
{% else %}
<p><strong>Sold Out</strong></p>
{% endif %}
{% endif %}
</div>
</article>
</main>
{% endblock %}