Configure PayPal integration and cart checkout error display
No files matched your search
@@ -54,3 +54,33 @@ Open `http://127.0.0.1:8000/admin/`. Local mode uses SQLite. Run `python manage.
|
|||||||
## Updating Studio v1.0
|
## Updating Studio v1.0
|
||||||
|
|
||||||
Keep the same project directory, `.env`, `secrets/`, `data/`, and Docker volumes. After making a database backup, unpack the updated project files into that directory and run `docker compose up -d --build`. Startup applies the migration. It locks the displayed title to SLUMP X LAND and keeps existing chapters, editorial content, and site settings.
|
Keep the same project directory, `.env`, `secrets/`, `data/`, and Docker volumes. After making a database backup, unpack the updated project files into that directory and run `docker compose up -d --build`. Startup applies the migration. It locks the displayed title to SLUMP X LAND and keeps existing chapters, editorial content, and site settings.
|
||||||
|
|
||||||
|
### Pages, chapter samples and Fan Club checkout
|
||||||
|
|
||||||
|
- **Pages → Manage pages**: edit a page title, slug, navigation label/placement,
|
||||||
|
local destination, or plain-text body. Clear the destination to publish an
|
||||||
|
original content page. Select a published row and use **Use the selected
|
||||||
|
published page as homepage** to switch. **Restore the Sol’Terra map as homepage**
|
||||||
|
restores the map; the map is always available at `/map/`.
|
||||||
|
- **Chapters**: set **Chapter price (USD)** to $0.50 or more to enable a Stripe
|
||||||
|
one-time purchase. A paid order unlocks that chapter in the reader for the
|
||||||
|
signed-in purchaser. A physical book does not automatically unlock the reader.
|
||||||
|
- **Shop products**: select a **Sample chapter** on a listing. The storefront
|
||||||
|
links to that published chapter. The newest three published chapters are free in full; older chapters require access.
|
||||||
|
A physical product with that association appears in the reader's purchase options.
|
||||||
|
- The migration creates two inactive monthly Fan Club product records: **Early
|
||||||
|
Access** and **Studio Vault**. Replace the placeholder price with your real
|
||||||
|
monthly price and optionally set the matching same-mode Stripe recurring
|
||||||
|
Price ID before making each product active. If using a Price ID, match the
|
||||||
|
displayed Studio price to the amount charged by Stripe. Both tiers unlock the
|
||||||
|
published chapter library; member posts still follow tier requirements.
|
||||||
|
- In Stripe create an endpoint at
|
||||||
|
`https://slumpxland-official.com/shop/webhooks/stripe/` for
|
||||||
|
`checkout.session.completed`, `checkout.session.async_payment_succeeded`,
|
||||||
|
`customer.subscription.updated`, `customer.subscription.deleted`,
|
||||||
|
`invoice.paid`, `invoice.payment_failed`, and `charge.refunded`.
|
||||||
|
Set the new endpoint's signing secret in the live `.env` as
|
||||||
|
`SLX_COMMERCE_STRIPE_WEBHOOK_SECRET`. The existing Stripe API key and
|
||||||
|
`SLX_STRIPE_ORIGIN` can be reused. A separate endpoint signing secret keeps
|
||||||
|
the existing legacy checkout endpoint independent. Test in Stripe test mode
|
||||||
|
before accepting live payments, and don't put payment keys into this ZIP.
|
||||||
@@ -39,16 +39,22 @@ class Studio(admin.AdminSite):
|
|||||||
def each_context(self, request):
|
def each_context(self, request):
|
||||||
context = super().each_context(request)
|
context = super().each_context(request)
|
||||||
channels = [
|
channels = [
|
||||||
('SLUMP X LAND', [
|
('Publishing', [('▤', 'Chapters', 'chapter', None), ('▧', 'Blog', 'entry', Entry.Kind.NEWS),
|
||||||
('▤', 'Chapters', 'chapter', None),
|
('◎', 'Cast', 'entry', Entry.Kind.CAST), ('◇', 'World archive', 'entry', Entry.Kind.WORLD)]),
|
||||||
('▧', 'Blog', 'entry', Entry.Kind.NEWS),
|
('Website & navigation', [('▤', 'Pages & homepage', 'managedpage', None),
|
||||||
('◎', 'Cast', 'entry', Entry.Kind.CAST),
|
('◎', 'Map locations', 'maplocation', None), ('↗', 'Link previews', 'pagesharepreview', None)]),
|
||||||
('◇', 'World archive', 'entry', Entry.Kind.WORLD),
|
('Design & artwork', [('▧', 'Page backgrounds', 'pagebackground', None), ('✦', 'Floating artwork', 'floatingartwork', None)]),
|
||||||
]),
|
('Shop & orders', [('▤', 'Shop products', 'shop.product', None), ('◈', 'Orders', 'shop.order', None),
|
||||||
('Community', [('◎', 'Fan memberships', 'fanmembership', None), ('▧', 'Member content', 'memberpost', None), ('◈', 'Verified support', 'supportcredit', None), ('◉', 'Moderate comments', 'discussioncomment', None), ('★', 'Moderate chapter reviews', 'chapterreview', None), ('★', 'Moderate series reviews', 'seriesreview', None), ('◉', 'Stream comments', 'streamcomment', None)]),
|
('▤', 'Legacy book listings', 'booklisting', None), ('▧', 'Legacy shop orders', 'shoporder', None),
|
||||||
|
('◈', 'Chapter purchases', 'chapterpurchase', None)]),
|
||||||
|
('Memberships & collectors', [('◎', 'Subscriptions', 'shop.subscription', None),
|
||||||
|
('◎', 'Fan memberships', 'fanmembership', None), ('▧', 'Member content', 'memberpost', None),
|
||||||
|
('◈', 'Verified support', 'supportcredit', None), ('◆', 'Collector profiles', 'collectorprofile', None)]),
|
||||||
|
('Comments & reviews', [('◉', 'Discussion comments', 'discussioncomment', None),
|
||||||
|
('★', 'Chapter reviews', 'chapterreview', None), ('★', 'Series reviews', 'seriesreview', None),
|
||||||
|
('◉', 'Stream comments', 'streamcomment', None)]),
|
||||||
('Newsletter', [('✉', 'Campaigns', 'newslettercampaign', None), ('◎', 'Subscribers', 'newslettersubscriber', None)]),
|
('Newsletter', [('✉', 'Campaigns', 'newslettercampaign', None), ('◎', 'Subscribers', 'newslettersubscriber', None)]),
|
||||||
('Commerce', [('▤', 'Shop products', 'shop.product', None), ('◈', 'Orders', 'shop.order', None), ('◎', 'Subscriptions', 'shop.subscription', None), ('▤', 'Book listings', 'booklisting', None), ('▧', 'Legacy shop orders', 'shoporder', None), ('◈', 'Chapter purchases', 'chapterpurchase', None)]),
|
('General settings', [('◈', 'Site settings', 'sitesettings', None)]),
|
||||||
('Studio', [('◈', 'Site settings', 'sitesettings', None), ('▧', 'Page backgrounds', 'pagebackground', None), ('✦', 'Floating artwork', 'floatingartwork', None), ('↗', 'Link previews', 'pagesharepreview', None)]),
|
|
||||||
]
|
]
|
||||||
groups = []
|
groups = []
|
||||||
for name, items in channels:
|
for name, items in channels:
|
||||||
@@ -67,6 +73,19 @@ class Studio(admin.AdminSite):
|
|||||||
if links:
|
if links:
|
||||||
groups.append({'name': name, 'links': links})
|
groups.append({'name': name, 'links': links})
|
||||||
row = SiteSettings.objects.filter(pk=1).only('site_palette').first()
|
row = SiteSettings.objects.filter(pk=1).only('site_palette').first()
|
||||||
|
if self.can_edit_countdown(request, row):
|
||||||
|
shortcuts = [
|
||||||
|
('Website & navigation', '◉', 'Homepage countdown & map placement', 'homepage_countdown'),
|
||||||
|
('Website & navigation', '↗', 'Public menu', 'public_menu'),
|
||||||
|
('Design & artwork', '✦', 'Site and Studio colors', 'site_theme'),
|
||||||
|
]
|
||||||
|
for category, icon, title, route in shortcuts:
|
||||||
|
group = next((group for group in groups if group['name'] == category), None)
|
||||||
|
if group is None:
|
||||||
|
group = {'name': category, 'links': []}
|
||||||
|
groups.append(group)
|
||||||
|
url = reverse(f'admin:{route}')
|
||||||
|
group['links'].append({'icon': icon, 'title': title, 'url': url, 'active': request.path == url})
|
||||||
context['studio_theme_vars'] = css_variables(row.site_palette, STUDIO_KEYS) if row else ''
|
context['studio_theme_vars'] = css_variables(row.site_palette, STUDIO_KEYS) if row else ''
|
||||||
context['can_edit_theme'] = self.can_edit_countdown(request, row)
|
context['can_edit_theme'] = self.can_edit_countdown(request, row)
|
||||||
context['studio_groups'] = groups
|
context['studio_groups'] = groups
|
||||||
@@ -723,3 +742,60 @@ class SupportCreditAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
def has_delete_permission(self, request, obj=None):
|
def has_delete_permission(self, request, obj=None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
from .models import ManagedPage
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(ManagedPage, site=studio)
|
||||||
|
class ManagedPageAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'slug', 'published', 'show_in_menu', 'homepage')
|
||||||
|
prepopulated_fields = {'slug': ('title',)}
|
||||||
|
search_fields = ('title', 'slug', 'link')
|
||||||
|
|
||||||
|
actions = ('use_as_homepage', 'use_map_homepage')
|
||||||
|
|
||||||
|
@admin.action(description='Use the selected published page as homepage', permissions=['change'])
|
||||||
|
def use_as_homepage(self, request, queryset):
|
||||||
|
if queryset.count() != 1 or not queryset.first().published:
|
||||||
|
self.message_user(request, 'Select exactly one published page.', level='error')
|
||||||
|
return
|
||||||
|
with transaction.atomic():
|
||||||
|
ManagedPage.objects.filter(homepage=True).update(homepage=False)
|
||||||
|
queryset.update(homepage=True)
|
||||||
|
self.message_user(request, 'Homepage updated.')
|
||||||
|
|
||||||
|
@admin.action(description='Restore the Sol’Terra map as homepage', permissions=['change'])
|
||||||
|
def use_map_homepage(self, request, queryset):
|
||||||
|
ManagedPage.objects.filter(homepage=True).update(homepage=False)
|
||||||
|
self.message_user(request, 'The Sol’Terra map is the homepage.')
|
||||||
|
|
||||||
|
|
||||||
|
from .models import MapLocation
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(MapLocation, site=studio)
|
||||||
|
class MapLocationAdmin(admin.ModelAdmin):
|
||||||
|
change_form_template = 'admin/catalog/maplocation/change_form.html'
|
||||||
|
list_display = ('title', 'page', 'path', 'visible', 'position')
|
||||||
|
list_filter = ('visible',)
|
||||||
|
search_fields = ('title', 'key', 'path')
|
||||||
|
prepopulated_fields = {'key': ('title',)}
|
||||||
|
|
||||||
|
class Media:
|
||||||
|
js = ('studio-map-picker.js',)
|
||||||
|
|
||||||
|
from .models import CollectorProfile
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(CollectorProfile, site=studio)
|
||||||
|
class CollectorProfileAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('user', 'display_name', 'public')
|
||||||
|
readonly_fields = ('user', 'display_name', 'public', 'photo')
|
||||||
|
search_fields = ('user__username', 'display_name')
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def has_change_permission(self, request, obj=None):
|
||||||
|
return False
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
|
from .fans import live
|
||||||
|
from .models import Chapter
|
||||||
|
|
||||||
|
FREE_ARCHIVE_SIZE = 3
|
||||||
|
|
||||||
|
|
||||||
|
def rolling_chapter_ids():
|
||||||
|
return live(Chapter).order_by("-publish_at", "-number").values("pk")[:FREE_ARCHIVE_SIZE]
|
||||||
|
|
||||||
|
|
||||||
|
def stripe_live_mode():
|
||||||
|
return settings.SLX_STRIPE_SECRET_KEY.startswith(('sk_live_', 'rk_live_'))
|
||||||
|
|
||||||
|
|
||||||
|
def full_chapters(user):
|
||||||
|
from .membership import active_tier
|
||||||
|
from .models import ChapterPurchase
|
||||||
|
from shop.models import Order, OrderItem
|
||||||
|
|
||||||
|
chapters = live(Chapter)
|
||||||
|
if not user.is_authenticated or not user.is_active:
|
||||||
|
return chapters.filter(pk__in=rolling_chapter_ids())
|
||||||
|
if (user.is_staff and user.has_perm('catalog.view_chapter')) or active_tier(user):
|
||||||
|
return chapters
|
||||||
|
paid = ChapterPurchase.objects.filter(user=user, mode='sandbox' if settings.SLX_PAYPAL_MODE == 'sandbox' else 'live',
|
||||||
|
paid_at__isnull=False, revoked=False)
|
||||||
|
orders = OrderItem.objects.filter(order__user=user, order__gateway=Order.Gateway.STRIPE,
|
||||||
|
order__stripe_live=stripe_live_mode(), order__status__in=[
|
||||||
|
Order.Status.PAID, Order.Status.SHIPPED, Order.Status.DELIVERED])
|
||||||
|
return chapters.filter(Q(pk__in=rolling_chapter_ids()) | Q(pk__in=paid.values('chapter_id')) | Q(pk__in=orders.values('chapter_id')))
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
from django import forms
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.shortcuts import redirect, render
|
||||||
|
from django.views.decorators.cache import never_cache
|
||||||
|
from django.views.decorators.http import require_http_methods
|
||||||
|
|
||||||
|
from shop.models import Order
|
||||||
|
from .models import CollectorProfile
|
||||||
|
|
||||||
|
|
||||||
|
def recognized_collectors():
|
||||||
|
paid = Order.objects.filter(status__in=[Order.Status.PAID, Order.Status.SHIPPED, Order.Status.DELIVERED])
|
||||||
|
return CollectorProfile.objects.filter(public=True, user__is_active=True,
|
||||||
|
user_id__in=paid.values('user_id')).select_related('user').order_by('display_name', 'pk')
|
||||||
|
|
||||||
|
|
||||||
|
class CollectorForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = CollectorProfile
|
||||||
|
fields = ('public', 'display_name', 'photo')
|
||||||
|
labels = {'public': 'Show my public name and photo in the collector thank-you section'}
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@never_cache
|
||||||
|
@require_http_methods(['GET', 'POST'])
|
||||||
|
def preferences(request):
|
||||||
|
profile = CollectorProfile.objects.filter(user=request.user).first() or CollectorProfile(user=request.user)
|
||||||
|
form = CollectorForm(request.POST or None, request.FILES or None, instance=profile)
|
||||||
|
if request.method == 'POST' and form.is_valid():
|
||||||
|
form.save()
|
||||||
|
return redirect('collector-preferences')
|
||||||
|
return render(request, 'collector-preferences.html', {'form': form})
|
||||||
@@ -21,14 +21,14 @@ RANKS = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def rank_for(membership, total, config, now):
|
def rank_for(membership, total, config, now, stripe_active=False):
|
||||||
if (membership and membership.sol_seat) or (config.seat_threshold is not None and total >= config.seat_threshold):
|
if (membership and membership.sol_seat) or (config.seat_threshold is not None and total >= config.seat_threshold):
|
||||||
return RANKS[4]
|
return RANKS[4]
|
||||||
if total >= config.striker_threshold:
|
if total >= config.striker_threshold:
|
||||||
return RANKS[3]
|
return RANKS[3]
|
||||||
if total >= config.caster_threshold:
|
if total >= config.caster_threshold:
|
||||||
return RANKS[2]
|
return RANKS[2]
|
||||||
if membership and membership.subscriber_until and membership.subscriber_until > now:
|
if stripe_active or (membership and membership.subscriber_until and membership.subscriber_until > now):
|
||||||
return RANKS[1]
|
return RANKS[1]
|
||||||
return RANKS[0]
|
return RANKS[0]
|
||||||
|
|
||||||
@@ -41,4 +41,9 @@ def load_ranks(ids, config):
|
|||||||
sums = dict(SupportCredit.objects.filter(user_id__in=ids, voided=False).values('user_id')
|
sums = dict(SupportCredit.objects.filter(user_id__in=ids, voided=False).values('user_id')
|
||||||
.annotate(total=Sum('amount')).values_list('user_id', 'total'))
|
.annotate(total=Sum('amount')).values_list('user_id', 'total'))
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
return {pk: rank_for(memberships.get(pk), sums.get(pk, Decimal(0)), config, now) for pk in ids}
|
from .chapter_access import stripe_live_mode
|
||||||
|
from shop.models import Order, Subscription
|
||||||
|
active = set(Subscription.objects.filter(user_id__in=ids, gateway=Order.Gateway.STRIPE,
|
||||||
|
stripe_live=stripe_live_mode(), status=Subscription.Status.ACTIVE, current_period_end__gt=now,
|
||||||
|
entitlement_tier__isnull=False).values_list('user_id', flat=True))
|
||||||
|
return {pk: rank_for(memberships.get(pk), sums.get(pk, Decimal(0)), config, now, pk in active) for pk in ids}
|
||||||
@@ -4,7 +4,7 @@ from django.urls import reverse
|
|||||||
from .community import MENU
|
from .community import MENU
|
||||||
from .fans import unread_count
|
from .fans import unread_count
|
||||||
from .backgrounds import SAFE_ROUTES
|
from .backgrounds import SAFE_ROUTES
|
||||||
from .models import FloatingArtwork, PageBackground, TitleFollow
|
from .models import FloatingArtwork, PageBackground, TitleFollow, ManagedPage
|
||||||
from .newsletter import SignupForm, signup_open
|
from .newsletter import SignupForm, signup_open
|
||||||
from .views import settings_row
|
from .views import settings_row
|
||||||
from .theme import HEX_COLOR, css_variables
|
from .theme import HEX_COLOR, css_variables
|
||||||
@@ -46,14 +46,24 @@ def site_context(request):
|
|||||||
hidden = settings.hidden_menu if isinstance(settings.hidden_menu, list) else []
|
hidden = settings.hidden_menu if isinstance(settings.hidden_menu, list) else []
|
||||||
links = []
|
links = []
|
||||||
for key, label, route in MENU:
|
for key, label, route in MENU:
|
||||||
if key in hidden or (key == 'shop' and not settings.shop_url):
|
if key in hidden:
|
||||||
continue
|
continue
|
||||||
if key in ('library', 'notices') and not request.user.is_authenticated:
|
if key in ('library', 'notices') and not request.user.is_authenticated:
|
||||||
continue
|
continue
|
||||||
if key == 'account' and request.user.is_authenticated:
|
if key == 'account' and request.user.is_authenticated:
|
||||||
continue
|
continue
|
||||||
url = settings.shop_url if key == 'shop' else reverse(route, args=[key] if key in ('cast', 'world') else [])
|
url = (settings.shop_url or reverse('shop-index')) if key == 'shop' else reverse(route, args=[key] if key in ('cast', 'world') else [])
|
||||||
links.append({'key': key, 'label': label, 'url': url, 'active': key == active_nav})
|
links.append({'key': key, 'label': label, 'url': url, 'active': key == active_nav})
|
||||||
|
custom = list(ManagedPage.objects.filter(published=True, show_in_menu=True).order_by('pk'))
|
||||||
|
replacements = {page.menu_key: page for page in custom if page.menu_key}
|
||||||
|
for link in links:
|
||||||
|
page = replacements.pop(link['key'], None)
|
||||||
|
if page:
|
||||||
|
link.update(label=page.title, url=page.get_absolute_url(), active=request.path == page.get_absolute_url())
|
||||||
|
for page in custom:
|
||||||
|
if not page.menu_key:
|
||||||
|
links.append({'key': page.slug, 'label': page.title, 'url': page.get_absolute_url(),
|
||||||
|
'active': request.path == page.get_absolute_url()})
|
||||||
context['public_menu'] = links
|
context['public_menu'] = links
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
follow = TitleFollow.objects.filter(user=request.user).first()
|
follow = TitleFollow.objects.filter(user=request.user).first()
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class HomepageCountdownForm(forms.ModelForm):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SiteSettings
|
model = SiteSettings
|
||||||
fields = ['homepage_countdown_enabled', 'homepage_countdown_title', 'homepage_countdown_at',
|
fields = ['countdown_map_position', 'homepage_countdown_enabled', 'homepage_countdown_title', 'homepage_countdown_at',
|
||||||
'homepage_countdown_start_at', 'homepage_countdown_bar_color',
|
'homepage_countdown_start_at', 'homepage_countdown_bar_color',
|
||||||
'homepage_countdown_landing', 'homepage_countdown_cover', 'homepage_countdown_background',
|
'homepage_countdown_landing', 'homepage_countdown_cover', 'homepage_countdown_background',
|
||||||
'homepage_countdown_tint', 'homepage_countdown_tint_strength', 'homepage_countdown_note',
|
'homepage_countdown_tint', 'homepage_countdown_tint_strength', 'homepage_countdown_note',
|
||||||
|
|||||||
@@ -6,23 +6,53 @@ from django.views.decorators.http import require_safe
|
|||||||
from .models import FanMembership, MemberPost
|
from .models import FanMembership, MemberPost
|
||||||
|
|
||||||
|
|
||||||
|
def active_tier(user):
|
||||||
|
from .chapter_access import stripe_live_mode
|
||||||
|
from shop.models import Order, Subscription
|
||||||
|
|
||||||
|
if not user.is_authenticated or not user.is_active:
|
||||||
|
return 0
|
||||||
|
now = timezone.now()
|
||||||
|
manual = FanMembership.objects.filter(user=user, subscriber_until__gt=now).values_list('member_tier', flat=True).first()
|
||||||
|
stripe = Subscription.objects.filter(user=user, gateway=Order.Gateway.STRIPE, stripe_live=stripe_live_mode(),
|
||||||
|
status=Subscription.Status.ACTIVE, current_period_end__gt=now,
|
||||||
|
entitlement_tier__isnull=False).order_by('-entitlement_tier').values_list('entitlement_tier', flat=True).first()
|
||||||
|
return max(manual or 0, stripe or 0)
|
||||||
|
|
||||||
|
|
||||||
def accessible_posts(user):
|
def accessible_posts(user):
|
||||||
if not user.is_authenticated or not user.is_active:
|
if not user.is_authenticated or not user.is_active:
|
||||||
return MemberPost.objects.none()
|
return MemberPost.objects.none()
|
||||||
if user.is_staff and user.has_perm('catalog.view_memberpost'):
|
if user.is_staff and user.has_perm('catalog.view_memberpost'):
|
||||||
return MemberPost.objects.all()
|
return MemberPost.objects.all()
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
tier = FanMembership.objects.filter(user=user, subscriber_until__gt=now).values_list('member_tier', flat=True).first()
|
tier = active_tier(user)
|
||||||
return MemberPost.objects.filter(published=True, publish_at__lte=now, required_tier__lte=tier or 0)
|
return MemberPost.objects.filter(published=True, publish_at__lte=now, required_tier__lte=tier or 0)
|
||||||
|
|
||||||
|
|
||||||
@never_cache
|
@never_cache
|
||||||
@require_safe
|
@require_safe
|
||||||
def index(request):
|
def index(request):
|
||||||
return render(request, 'membership.html', {'posts': accessible_posts(request.user)})
|
from shop.models import Product
|
||||||
|
plans = Product.objects.filter(active=True, kind=Product.Kind.SUBSCRIPTION, member_tier__isnull=False)
|
||||||
|
return render(request, 'membership.html', {'posts': accessible_posts(request.user), 'plans': plans, 'comparison_rows': comparison_rows(plans)})
|
||||||
|
|
||||||
|
|
||||||
@never_cache
|
@never_cache
|
||||||
@require_safe
|
@require_safe
|
||||||
def detail(request, pk):
|
def detail(request, pk):
|
||||||
return render(request, 'member-post.html', {'post': get_object_or_404(accessible_posts(request.user), pk=pk)})
|
return render(request, 'member-post.html', {'post': get_object_or_404(accessible_posts(request.user), pk=pk)})
|
||||||
|
|
||||||
|
|
||||||
|
def comparison_rows(plans):
|
||||||
|
rows = {}
|
||||||
|
plans = list(plans)
|
||||||
|
for index, plan in enumerate(plans):
|
||||||
|
defaults = ['Published chapter library: Full access']
|
||||||
|
if plan.member_tier >= 2:
|
||||||
|
defaults.append('Draft pages and process notes: Included')
|
||||||
|
for line in (plan.comparison.splitlines() if plan.comparison else defaults):
|
||||||
|
title, sep, value = line.partition(':')
|
||||||
|
if sep and title.strip() and value.strip():
|
||||||
|
rows.setdefault(title.strip(), ['—'] * len(plans))[index] = value.strip()
|
||||||
|
return list(rows.items())
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 11:05
|
||||||
|
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('catalog', '0026_member_content'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='chapter',
|
||||||
|
name='price_usd',
|
||||||
|
field=models.DecimalField(blank=True, decimal_places=2, help_text='Set at least $0.50 for a Stripe chapter purchase. Leave blank if this chapter is only available to members.', max_digits=7, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Chapter price (USD)'),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ManagedPage',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=160)),
|
||||||
|
('map_slot', models.CharField(blank=True, editable=False, max_length=50)),
|
||||||
|
('slug', models.SlugField(unique=True)),
|
||||||
|
('body', models.TextField(blank=True)),
|
||||||
|
('link', models.CharField(blank=True, help_text='Optional local destination, such as /shop/. Leave blank to publish the page body.', max_length=240)),
|
||||||
|
('menu_key', models.CharField(blank=True, help_text='Optional existing menu key to replace, such as read, blog, or shop.', max_length=32)),
|
||||||
|
('published', models.BooleanField(default=False)),
|
||||||
|
('show_in_menu', models.BooleanField(default=False)),
|
||||||
|
('homepage', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'constraints': [models.UniqueConstraint(condition=models.Q(('homepage', True)), fields=('homepage',), name='slx_single_managed_home')],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def seed(apps, schema_editor):
|
||||||
|
Page = apps.get_model('catalog', 'ManagedPage')
|
||||||
|
rows = [
|
||||||
|
('solterra-map', 'Explore Sol’Terra', '/map/', ''),
|
||||||
|
('about', 'Series introduction', '/about/', ''),
|
||||||
|
('chapters', 'Read', '/chapters/', 'read'),
|
||||||
|
('blog', 'Blog', '/blog/', 'blog'),
|
||||||
|
('reviews', 'Reviews', '/reviews/', 'reviews'),
|
||||||
|
('upcoming', 'Upcoming', '/upcoming/', 'upcoming'),
|
||||||
|
('live', 'SLX Live', '/live/', 'live'),
|
||||||
|
('cast', 'Cast', '/cast/', 'cast'),
|
||||||
|
('world', 'World archive', '/world/', 'world'),
|
||||||
|
('shop', 'Shop', '/shop/', 'shop'),
|
||||||
|
('cart', 'Shopping cart', '/shop/cart/', ''),
|
||||||
|
('newsletter', 'Newsletter', '/newsletter/', ''),
|
||||||
|
('membership', 'Membership', '/membership/', 'membership'),
|
||||||
|
('library', 'My library', '/fan/library/', 'library'),
|
||||||
|
('countdown', 'Release countdown', '/coming-soon/', ''),
|
||||||
|
('djinnii', 'Djinnii', '/djinnii/', ''),
|
||||||
|
('community', 'Community', '/community/', 'community'),
|
||||||
|
('search', 'Search', '/search/', 'search'),
|
||||||
|
]
|
||||||
|
for slug, title, path, key in rows:
|
||||||
|
Page.objects.using(schema_editor.connection.alias).get_or_create(
|
||||||
|
slug=slug, defaults={'title':title, 'link':path, 'published':True, 'menu_key':key, 'map_slot':slug})
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [('catalog','0027_alter_chapter_price_usd_managedpage')]
|
||||||
|
operations = [migrations.RunPython(seed, migrations.RunPython.noop)]
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 11:24
|
||||||
|
|
||||||
|
import django.core.validators
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('catalog', '0028_default_managed_pages'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='MapLocation',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=80)),
|
||||||
|
('key', models.SlugField(unique=True)),
|
||||||
|
('path', models.CharField(blank=True, help_text='Optional override, e.g. /chapters/9/. Leave blank to follow the selected page.', max_length=240)),
|
||||||
|
('fallback_path', models.CharField(blank=True, editable=False, max_length=240)),
|
||||||
|
('x', models.DecimalField(decimal_places=5, max_digits=8, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)])),
|
||||||
|
('y', models.DecimalField(decimal_places=5, max_digits=8, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)])),
|
||||||
|
('visible', models.BooleanField(default=True)),
|
||||||
|
('position', models.PositiveIntegerField(default=0)),
|
||||||
|
('page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='catalog.managedpage')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['position', 'pk'],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
ROWS = [('about', 'start', '8.88672', '3.41880', 'Series introduction'), ('upcoming', 'upcoming', '55.46875', '6.58120', 'Next releases'), ('cast', 'cast', '66.65039', '17.09402', 'Meet the cast'), ('world', 'world', '88.47656', '26.66667', 'World archive'), ('blog', 'blog', '13.81836', '39.40171', 'Studio blog'), ('chapters', 'chapters', '35.44922', '43.33333', 'Read chapters'), ('reviews', 'reviews', '53.36914', '48.97436', 'Reader reviews'), ('live', 'live', '62.45117', '60.76923', 'SLX Live'), ('membership', 'membership', '41.55273', '67.43590', 'Membership'), ('shop', 'shop', '74.90234', '73.33333', 'Shop'), ('cart', 'cart', '96.53320', '73.58974', 'Shopping cart'), ('newsletter', 'newsletter', '11.37695', '81.11111', 'Newsletter'), ('library', 'library', '15.18555', '84.87179', 'My library'), ('countdown', 'release', '61.13281', '88.88889', 'Release countdown')]
|
||||||
|
|
||||||
|
|
||||||
|
def seed(apps, schema_editor):
|
||||||
|
Page = apps.get_model('catalog', 'ManagedPage')
|
||||||
|
Location = apps.get_model('catalog', 'MapLocation')
|
||||||
|
db = schema_editor.connection.alias
|
||||||
|
for position, (slot, key, x, y, title) in enumerate(ROWS):
|
||||||
|
page = Page.objects.using(db).filter(map_slot=slot).first()
|
||||||
|
fallback = {'cart': '/shop/cart/', 'library': '/fan/library/', 'release': '/coming-soon/'}.get(key, '/' + slot + '/')
|
||||||
|
Location.objects.using(db).get_or_create(key=key, defaults=dict(
|
||||||
|
title=title, x=x, y=y, page_id=page.pk if page else None,
|
||||||
|
fallback_path=fallback, position=position))
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [('catalog', '0029_map_location')]
|
||||||
|
operations = [migrations.RunPython(seed, migrations.RunPython.noop)]
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 12:55
|
||||||
|
|
||||||
|
import catalog.models
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('catalog', '0030_seed_map_locations'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='sitesettings',
|
||||||
|
name='countdown_map_position',
|
||||||
|
field=models.CharField(choices=[('above', 'Above countdown content'), ('below', 'Below countdown content')], default='below', max_length=6),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='CollectorProfile',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('display_name', models.CharField(blank=True, max_length=80)),
|
||||||
|
('photo', catalog.models.StudioImageField(blank=True, upload_to=catalog.models.image_path, validators=[catalog.models.validate_image])),
|
||||||
|
('public', models.BooleanField(default=False)),
|
||||||
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 13:54
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('catalog', '0031_sitesettings_countdown_map_position_collectorprofile'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='fanmembership',
|
||||||
|
name='member_tier',
|
||||||
|
field=models.PositiveSmallIntegerField(choices=[(1, 'Early Access'), (2, 'Studio Vault'), (3, 'Collector’s Circle')], default=1, verbose_name='Content tier'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='memberpost',
|
||||||
|
name='required_tier',
|
||||||
|
field=models.PositiveSmallIntegerField(choices=[(1, 'Early Access'), (2, 'Studio Vault'), (3, 'Collector’s Circle')], default=1),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -120,6 +120,8 @@ class PageSharePreview(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
class SiteSettings(models.Model):
|
class SiteSettings(models.Model):
|
||||||
|
countdown_map_position = models.CharField(max_length=6, default='below',
|
||||||
|
choices=[('above', 'Above countdown content'), ('below', 'Below countdown content')])
|
||||||
name = models.CharField(max_length=100, default='SLUMP X LAND', editable=False)
|
name = models.CharField(max_length=100, default='SLUMP X LAND', editable=False)
|
||||||
site_palette = models.JSONField(default=dict, blank=True)
|
site_palette = models.JSONField(default=dict, blank=True)
|
||||||
hidden_menu = models.JSONField(default=list, blank=True)
|
hidden_menu = models.JSONField(default=list, blank=True)
|
||||||
@@ -228,7 +230,7 @@ class Chapter(models.Model):
|
|||||||
title = models.CharField(max_length=180)
|
title = models.CharField(max_length=180)
|
||||||
cover = art_field(blank=True)
|
cover = art_field(blank=True)
|
||||||
price_usd = models.DecimalField('Chapter price (USD)', max_digits=7, decimal_places=2, null=True, blank=True,
|
price_usd = models.DecimalField('Chapter price (USD)', max_digits=7, decimal_places=2, null=True, blank=True,
|
||||||
validators=[MinValueValidator(0)], help_text='Leave blank or set to zero for a free chapter.')
|
validators=[MinValueValidator(0)], help_text='Set at least $0.50 for a Stripe chapter purchase. Leave blank if this chapter is only available to members.')
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
super().clean()
|
super().clean()
|
||||||
@@ -590,7 +592,7 @@ class StreamComment(models.Model):
|
|||||||
class FanMembership(models.Model):
|
class FanMembership(models.Model):
|
||||||
user = models.OneToOneField('auth.User', on_delete=models.CASCADE, related_name='slx_membership')
|
user = models.OneToOneField('auth.User', on_delete=models.CASCADE, related_name='slx_membership')
|
||||||
subscriber_until = models.DateTimeField('Subscription active through', null=True, blank=True)
|
subscriber_until = models.DateTimeField('Subscription active through', null=True, blank=True)
|
||||||
member_tier = models.PositiveSmallIntegerField('Content tier', choices=[(1, 'Early Access'), (2, 'Studio Vault')], default=1)
|
member_tier = models.PositiveSmallIntegerField('Content tier', choices=[(1, 'Early Access'), (2, 'Studio Vault'), (3, 'Collector’s Circle')], default=1)
|
||||||
sol_seat = models.BooleanField('Assign Sol Seat', default=False)
|
sol_seat = models.BooleanField('Assign Sol Seat', default=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -604,7 +606,7 @@ class MemberPost(models.Model):
|
|||||||
title = models.CharField(max_length=160)
|
title = models.CharField(max_length=160)
|
||||||
body = models.TextField(blank=True)
|
body = models.TextField(blank=True)
|
||||||
kind = models.CharField(max_length=12, choices=[('note','Creator note'),('early','Early chapter'),('draft','Draft pages')], default='note')
|
kind = models.CharField(max_length=12, choices=[('note','Creator note'),('early','Early chapter'),('draft','Draft pages')], default='note')
|
||||||
required_tier = models.PositiveSmallIntegerField(choices=[(1,'Early Access'),(2,'Studio Vault')],default=1)
|
required_tier = models.PositiveSmallIntegerField(choices=[(1,'Early Access'),(2,'Studio Vault'),(3,'Collector’s Circle')],default=1)
|
||||||
published = models.BooleanField(default=False)
|
published = models.BooleanField(default=False)
|
||||||
publish_at = models.DateTimeField(default=timezone.now)
|
publish_at = models.DateTimeField(default=timezone.now)
|
||||||
|
|
||||||
@@ -645,14 +647,27 @@ class TrafficDaily(models.Model):
|
|||||||
target_id = models.PositiveBigIntegerField(default=0)
|
target_id = models.PositiveBigIntegerField(default=0)
|
||||||
route = models.CharField(max_length=64)
|
route = models.CharField(max_length=64)
|
||||||
country = models.CharField(max_length=2, blank=True, default='')
|
country = models.CharField(max_length=2, blank=True, default='')
|
||||||
|
region = models.CharField(max_length=120, blank=True, default='')
|
||||||
|
city = models.CharField(max_length=120, blank=True, default='')
|
||||||
source = models.CharField(max_length=255, blank=True, default='')
|
source = models.CharField(max_length=255, blank=True, default='')
|
||||||
views = models.PositiveBigIntegerField(default=1)
|
views = models.PositiveBigIntegerField(default=1)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
constraints = [models.UniqueConstraint(fields=['day', 'kind', 'target_id', 'route', 'country', 'source'],
|
constraints = [
|
||||||
name='slx_traffic_daily_key')]
|
models.UniqueConstraint(
|
||||||
indexes = [models.Index(fields=['kind', 'target_id'], name='slx_traffic_item_idx')]
|
fields=[
|
||||||
|
'day', 'kind', 'target_id', 'route',
|
||||||
|
'country', 'region', 'city', 'source'
|
||||||
|
],
|
||||||
|
name='slx_traffic_daily_key'
|
||||||
|
)
|
||||||
|
]
|
||||||
|
indexes = [
|
||||||
|
models.Index(
|
||||||
|
fields=['kind', 'target_id'],
|
||||||
|
name='slx_traffic_item_idx'
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
class AIChapterReview(models.Model):
|
class AIChapterReview(models.Model):
|
||||||
chapter = models.OneToOneField(Chapter, on_delete=models.CASCADE, related_name='ai_editorial_review')
|
chapter = models.OneToOneField(Chapter, on_delete=models.CASCADE, related_name='ai_editorial_review')
|
||||||
@@ -730,3 +745,74 @@ class NewsletterDelivery(models.Model):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
constraints = [models.UniqueConstraint(fields=['campaign', 'subscriber'], name='slx_unique_newsletter_delivery')]
|
constraints = [models.UniqueConstraint(fields=['campaign', 'subscriber'], name='slx_unique_newsletter_delivery')]
|
||||||
|
|
||||||
|
|
||||||
|
class ManagedPage(models.Model):
|
||||||
|
title = models.CharField(max_length=160)
|
||||||
|
slug = models.SlugField(unique=True)
|
||||||
|
body = models.TextField(blank=True)
|
||||||
|
link = models.CharField(max_length=240, blank=True, help_text='Optional local destination, such as /shop/. Leave blank to publish the page body.')
|
||||||
|
map_slot = models.CharField(max_length=50, blank=True, editable=False)
|
||||||
|
menu_key = models.CharField(max_length=32, blank=True, help_text='Optional existing menu key to replace, such as read, blog, or shop.')
|
||||||
|
published = models.BooleanField(default=False)
|
||||||
|
show_in_menu = models.BooleanField(default=False)
|
||||||
|
homepage = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
constraints = [models.UniqueConstraint(fields=['homepage'], condition=models.Q(homepage=True), name='slx_single_managed_home')]
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
from urllib.parse import urlsplit
|
||||||
|
super().clean()
|
||||||
|
if self.link:
|
||||||
|
try:
|
||||||
|
parts = urlsplit(self.link)
|
||||||
|
except ValueError as exc:
|
||||||
|
raise ValidationError({'link': 'Enter a valid local path.'}) from exc
|
||||||
|
if not self.link.startswith('/') or self.link.startswith('//') or parts.netloc or (parts.path == '/' or parts.path.startswith('/pages/')) or '\\' in self.link or any(ord(c)<32 for c in self.link):
|
||||||
|
raise ValidationError({'link': 'Enter a local path other than the homepage, such as /shop/.'})
|
||||||
|
if self.homepage and not self.published:
|
||||||
|
raise ValidationError({'homepage': 'Publish this page before setting it as the homepage.'})
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
from django.urls import reverse
|
||||||
|
return reverse('managed-page', args=[self.slug])
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
|
||||||
|
class MapLocation(models.Model):
|
||||||
|
title = models.CharField(max_length=80)
|
||||||
|
key = models.SlugField(max_length=50, unique=True)
|
||||||
|
path = models.CharField(max_length=240, blank=True, help_text='Optional override, e.g. /chapters/9/. Leave blank to follow the selected page.')
|
||||||
|
page = models.ForeignKey(ManagedPage, null=True, blank=True, on_delete=models.SET_NULL)
|
||||||
|
fallback_path = models.CharField(max_length=240, blank=True, editable=False)
|
||||||
|
x = models.DecimalField(max_digits=8, decimal_places=5, validators=[MinValueValidator(0), MaxValueValidator(100)])
|
||||||
|
y = models.DecimalField(max_digits=8, decimal_places=5, validators=[MinValueValidator(0), MaxValueValidator(100)])
|
||||||
|
visible = models.BooleanField(default=True)
|
||||||
|
position = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['position', 'pk']
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
super().clean()
|
||||||
|
if self.path and (not self.path.startswith('/') or self.path.startswith('//') or
|
||||||
|
'\\' in self.path or any(c.isspace() or ord(c) < 32 for c in self.path)):
|
||||||
|
raise ValidationError({'path': 'Enter an internal path starting with one slash.'})
|
||||||
|
if self.visible and not (self.path or self.page_id or self.fallback_path):
|
||||||
|
raise ValidationError({'path': 'Choose a page or enter a path.'})
|
||||||
|
|
||||||
|
def destination(self):
|
||||||
|
return self.path or (self.page.get_absolute_url() if self.page_id and self.page.published else self.fallback_path)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
|
||||||
|
class CollectorProfile(models.Model):
|
||||||
|
user = models.OneToOneField('auth.User', on_delete=models.CASCADE)
|
||||||
|
display_name = models.CharField(max_length=80, blank=True)
|
||||||
|
photo = art_field(blank=True)
|
||||||
|
public = models.BooleanField(default=False)
|
||||||
@@ -10,25 +10,64 @@ from .models import Chapter, Entry, TrafficDaily
|
|||||||
def traffic_report(request):
|
def traffic_report(request):
|
||||||
days = request.GET.get('days', '30')
|
days = request.GET.get('days', '30')
|
||||||
days = int(days) if days in ('7', '30', '90') else 30
|
days = int(days) if days in ('7', '30', '90') else 30
|
||||||
|
|
||||||
kind = request.GET.get('kind', 'all')
|
kind = request.GET.get('kind', 'all')
|
||||||
if kind not in ('all', 'chapter', 'blog'):
|
if kind not in ('all', 'chapter', 'blog'):
|
||||||
kind = 'all'
|
kind = 'all'
|
||||||
qs = TrafficDaily.objects.filter(day__gte=timezone.localdate()-timedelta(days=days-1))
|
|
||||||
|
qs = TrafficDaily.objects.filter(
|
||||||
|
day__gte=timezone.localdate() - timedelta(days=days - 1)
|
||||||
|
)
|
||||||
|
|
||||||
if kind != 'all':
|
if kind != 'all':
|
||||||
qs = qs.filter(kind=kind)
|
qs = qs.filter(kind=kind)
|
||||||
|
|
||||||
def grouped(*fields):
|
def grouped(*fields):
|
||||||
return qs.values(*fields).annotate(views=Sum('views')).order_by('-views', *fields)
|
return qs.values(*fields).annotate(
|
||||||
|
views=Sum('views')
|
||||||
|
).order_by('-views', *fields)
|
||||||
|
|
||||||
counts = {row['kind']: row['views'] for row in grouped('kind')}
|
counts = {row['kind']: row['views'] for row in grouped('kind')}
|
||||||
|
|
||||||
countries = list(grouped('country'))
|
countries = list(grouped('country'))
|
||||||
|
regions = list(grouped('country', 'region')[:100])
|
||||||
|
cities = list(grouped('country', 'region', 'city')[:100])
|
||||||
|
|
||||||
sources = grouped('source')[:30]
|
sources = grouped('source')[:30]
|
||||||
series = list(grouped('day').order_by('day'))
|
series = list(grouped('day').order_by('day'))
|
||||||
top = list(qs.exclude(target_id=0).values('kind','target_id').annotate(views=Sum('views')).order_by('-views','target_id')[:25])
|
|
||||||
chapters = Chapter.objects.in_bulk(row['target_id'] for row in top if row['kind'] == 'chapter')
|
top = list(
|
||||||
posts = Entry.objects.in_bulk(row['target_id'] for row in top if row['kind'] == 'blog')
|
qs.exclude(target_id=0)
|
||||||
|
.values('kind', 'target_id')
|
||||||
|
.annotate(views=Sum('views'))
|
||||||
|
.order_by('-views', 'target_id')[:25]
|
||||||
|
)
|
||||||
|
|
||||||
|
chapters = Chapter.objects.in_bulk(
|
||||||
|
row['target_id'] for row in top if row['kind'] == 'chapter'
|
||||||
|
)
|
||||||
|
posts = Entry.objects.in_bulk(
|
||||||
|
row['target_id'] for row in top if row['kind'] == 'blog'
|
||||||
|
)
|
||||||
|
|
||||||
for row in top:
|
for row in top:
|
||||||
obj = (chapters if row['kind'] == 'chapter' else posts).get(row['target_id'])
|
obj = (
|
||||||
|
chapters if row['kind'] == 'chapter' else posts
|
||||||
|
).get(row['target_id'])
|
||||||
row['title'] = str(obj) if obj else 'Removed content'
|
row['title'] = str(obj) if obj else 'Removed content'
|
||||||
return {'days': days, 'kind': kind, 'total': sum(counts.values()), 'chapters': counts.get('chapter', 0),
|
|
||||||
'blogs': counts.get('blog', 0), 'countries': countries, 'sources': sources, 'top': top, 'series': series,
|
return {
|
||||||
'analytics_enabled': settings.SLX_ANALYTICS, 'geo_configured': bool(settings.SLX_GEOIP_DB)}
|
'days': days,
|
||||||
|
'kind': kind,
|
||||||
|
'total': sum(counts.values()),
|
||||||
|
'chapters': counts.get('chapter', 0),
|
||||||
|
'blogs': counts.get('blog', 0),
|
||||||
|
'countries': countries,
|
||||||
|
'regions': regions,
|
||||||
|
'cities': cities,
|
||||||
|
'sources': sources,
|
||||||
|
'top': top,
|
||||||
|
'series': series,
|
||||||
|
'analytics_enabled': settings.SLX_ANALYTICS,
|
||||||
|
'geo_configured': bool(settings.SLX_GEOIP_DB),
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
"""Reusable A–Z spelling in the Djinn-Sol alphabet."""
|
||||||
|
from string import ascii_lowercase
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.inclusion_tag("djinn-sol-glyphs.html")
|
||||||
|
def djinn_sol(text):
|
||||||
|
return {
|
||||||
|
"words": [
|
||||||
|
[f"djinn-sol/{letter}.png" for letter in word if letter in ascii_lowercase]
|
||||||
|
for word in str(text).lower().split()
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag(takes_context=True)
|
||||||
|
def map_destination(context, slug, default_url):
|
||||||
|
page = context.get('map_destinations', {}).get(slug)
|
||||||
|
return page.get_absolute_url() if page else default_url
|
||||||
@@ -45,20 +45,43 @@ def geo_reader(path):
|
|||||||
except maxminddb.InvalidDatabaseError as exc:
|
except maxminddb.InvalidDatabaseError as exc:
|
||||||
raise ValueError('Invalid country database') from exc
|
raise ValueError('Invalid country database') from exc
|
||||||
|
|
||||||
|
def location_for(request):
|
||||||
|
empty = {'country': '', 'region': '', 'city': ''}
|
||||||
|
|
||||||
def country_for(request):
|
|
||||||
if not settings.SLX_GEOIP_DB:
|
if not settings.SLX_GEOIP_DB:
|
||||||
return ''
|
return empty
|
||||||
header = 'HTTP_X_SLX_CLIENT_IP' if settings.SLX_TRUST_CADDY_IP else 'REMOTE_ADDR'
|
|
||||||
|
header = (
|
||||||
|
'HTTP_X_SLX_CLIENT_IP'
|
||||||
|
if settings.SLX_TRUST_CADDY_IP
|
||||||
|
else 'REMOTE_ADDR'
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ip = ipaddress.ip_address(request.META.get(header, ''))
|
ip = ipaddress.ip_address(request.META.get(header, ''))
|
||||||
|
|
||||||
if not ip.is_global:
|
if not ip.is_global:
|
||||||
return ''
|
return empty
|
||||||
|
|
||||||
row = geo_reader(settings.SLX_GEOIP_DB).get(str(ip)) or {}
|
row = geo_reader(settings.SLX_GEOIP_DB).get(str(ip)) or {}
|
||||||
code = row.get('country', {}).get('iso_code', '')
|
|
||||||
return code if re.fullmatch(r'[A-Z]{2}', code) else ''
|
country = row.get('country', {}).get('iso_code', '')
|
||||||
|
subdivisions = row.get('subdivisions') or []
|
||||||
|
|
||||||
|
region = ''
|
||||||
|
if subdivisions:
|
||||||
|
region = subdivisions[0].get('names', {}).get('en', '')
|
||||||
|
|
||||||
|
city = row.get('city', {}).get('names', {}).get('en', '')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'country': country if re.fullmatch(r'[A-Z]{2}', country) else '',
|
||||||
|
'region': region[:120],
|
||||||
|
'city': city[:120],
|
||||||
|
}
|
||||||
|
|
||||||
except (ValueError, OSError, ImportError, RuntimeError):
|
except (ValueError, OSError, ImportError, RuntimeError):
|
||||||
return ''
|
return empty
|
||||||
|
|
||||||
|
|
||||||
def view_total(kind, ident):
|
def view_total(kind, ident):
|
||||||
@@ -86,12 +109,27 @@ class TrafficMiddleware:
|
|||||||
or any('prefetch' in request.META.get(header, '').lower() for header in ('HTTP_SEC_PURPOSE', 'HTTP_PURPOSE'))
|
or any('prefetch' in request.META.get(header, '').lower() for header in ('HTTP_SEC_PURPOSE', 'HTTP_PURPOSE'))
|
||||||
or not request.META.get('HTTP_USER_AGENT') or BOT.search(request.META['HTTP_USER_AGENT'])):
|
or not request.META.get('HTTP_USER_AGENT') or BOT.search(request.META['HTTP_USER_AGENT'])):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
kind, target = getattr(request, 'slx_view_target', ('site', 0))
|
kind, target = getattr(request, 'slx_view_target', ('site', 0))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
row, created = TrafficDaily.objects.get_or_create(day=timezone.localdate(), kind=kind, target_id=target,
|
location = location_for(request)
|
||||||
route=match.url_name, country=country_for(request), source=source_origin(request))
|
|
||||||
|
row, created = TrafficDaily.objects.get_or_create(
|
||||||
|
day=timezone.localdate(),
|
||||||
|
kind=kind,
|
||||||
|
target_id=target,
|
||||||
|
route=match.url_name,
|
||||||
|
country=location['country'],
|
||||||
|
region=location['region'],
|
||||||
|
city=location['city'],
|
||||||
|
source=source_origin(request),
|
||||||
|
)
|
||||||
|
|
||||||
if not created:
|
if not created:
|
||||||
TrafficDaily.objects.filter(pk=row.pk).update(views=F('views') + 1)
|
TrafficDaily.objects.filter(pk=row.pk).update(views=F('views') + 1)
|
||||||
|
|
||||||
except DatabaseError:
|
except DatabaseError:
|
||||||
logger.warning('SLX traffic could not be recorded.')
|
logger.warning('SLX traffic could not be recorded.')
|
||||||
|
|
||||||
return response
|
return response
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
from math import floor
|
from math import floor
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
from django.conf import settings as config
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
@@ -9,7 +10,8 @@ from django.http import FileResponse, Http404, JsonResponse
|
|||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.decorators.cache import never_cache
|
from django.views.decorators.cache import never_cache
|
||||||
from django.views.decorators.http import require_safe
|
from django.views.decorators.http import require_POST, require_safe
|
||||||
|
from .chapter_access import full_chapters, rolling_chapter_ids
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from .models import SiteSettings, Chapter, Page, Entry, BookListing, StreamComment, DiscussionComment, PageBackground, FloatingArtwork, ProductVariant, PageSharePreview, MemberArtwork
|
from .models import SiteSettings, Chapter, Page, Entry, BookListing, StreamComment, DiscussionComment, PageBackground, FloatingArtwork, ProductVariant, PageSharePreview, MemberArtwork
|
||||||
from .fans import engagement, live
|
from .fans import engagement, live
|
||||||
@@ -47,7 +49,13 @@ def search(request):
|
|||||||
chapter_filter = Q(title__icontains=query) | Q(summary__icontains=query)
|
chapter_filter = Q(title__icontains=query) | Q(summary__icontains=query)
|
||||||
if query.lstrip('#').isascii() and query.lstrip('#').isdigit() and len(query.lstrip('#')) < 10:
|
if query.lstrip('#').isascii() and query.lstrip('#').isdigit() and len(query.lstrip('#')) < 10:
|
||||||
chapter_filter |= Q(number=int(query.lstrip('#')))
|
chapter_filter |= Q(number=int(query.lstrip('#')))
|
||||||
chapters = live(Chapter).filter(chapter_filter)[:20]
|
chapters = live(Chapter).filter(chapter_filter).annotate(
|
||||||
|
first_page_art=Subquery(Page.objects.filter(chapter_id=OuterRef('pk')).order_by('number').values('art')[:1]))[:20]
|
||||||
|
page_storage = Page._meta.get_field("art").storage
|
||||||
|
for chapter in chapters:
|
||||||
|
chapter.search_cover = chapter.cover.url if chapter.cover else (
|
||||||
|
page_storage.url(chapter.first_page_art) if chapter.first_upload_is_cover and chapter.first_page_art
|
||||||
|
and not chapter.publisher_url else '')
|
||||||
posts = live(Entry).filter(Q(title__icontains=query) | Q(summary__icontains=query) |
|
posts = live(Entry).filter(Q(title__icontains=query) | Q(summary__icontains=query) |
|
||||||
Q(category__icontains=query))[:20]
|
Q(category__icontains=query))[:20]
|
||||||
return render(request, 'search.html', {'query': query, 'chapters': chapters, 'items': posts})
|
return render(request, 'search.html', {'query': query, 'chapters': chapters, 'items': posts})
|
||||||
@@ -91,7 +99,8 @@ def stream(request):
|
|||||||
|
|
||||||
@require_safe
|
@require_safe
|
||||||
def community(request):
|
def community(request):
|
||||||
return render(request, 'community.html')
|
from .collectors import recognized_collectors
|
||||||
|
return render(request, 'community.html', {'collectors': recognized_collectors()})
|
||||||
|
|
||||||
|
|
||||||
@require_safe
|
@require_safe
|
||||||
@@ -135,50 +144,55 @@ def countdown_progress(site, now):
|
|||||||
|
|
||||||
@require_safe
|
@require_safe
|
||||||
def home(request):
|
def home(request):
|
||||||
settings = settings_row()
|
from .models import ManagedPage
|
||||||
now = timezone.now()
|
page = ManagedPage.objects.filter(published=True, homepage=True).first()
|
||||||
homepage_countdown = (
|
return render_managed_page(request, page) if page else map_landing(request)
|
||||||
settings.homepage_countdown_enabled
|
|
||||||
and settings.homepage_countdown_at
|
|
||||||
and settings.homepage_countdown_at > now
|
@require_safe
|
||||||
)
|
def map_landing(request):
|
||||||
countdown_context = {
|
from .models import MapLocation
|
||||||
'countdown_now': now,
|
|
||||||
'release_progress': countdown_progress(settings, now) if homepage_countdown else None,
|
locations = []
|
||||||
'countdown_chapters': countdown_chapter_shelf(request.user, now) if homepage_countdown else [],
|
for marker in MapLocation.objects.filter(visible=True).select_related('page'):
|
||||||
'countdown_social_color': settings.homepage_social_color if HEX_COLOR.fullmatch(settings.homepage_social_color) else '#ffdd00',
|
if url := marker.destination():
|
||||||
}
|
locations.append({'title': marker.title, 'key': marker.key, 'url': url,
|
||||||
if homepage_countdown and settings.homepage_countdown_landing and settings.homepage_countdown_cover:
|
'x': format(marker.x, 'f'), 'y': format(marker.y, 'f')})
|
||||||
tint = settings.homepage_countdown_tint
|
context = countdown_splash_context(request)
|
||||||
return render(request, 'countdown-landing.html', {
|
if context:
|
||||||
**countdown_context, 'settings': settings,
|
return render(request, 'countdown-landing.html', {**context, 'map_locations': locations, 'with_world_map': True})
|
||||||
'countdown_tint': tint if HEX_COLOR.fullmatch(tint) else '#0c1020',
|
return render(request, 'home.html', {'map_locations': locations})
|
||||||
'countdown_tint_strength': min(100, settings.homepage_countdown_tint_strength),
|
|
||||||
})
|
|
||||||
return render(request, 'home.html', {
|
def render_managed_page(request, page):
|
||||||
**countdown_context, 'homepage_countdown': homepage_countdown,
|
if page.link and page.link.split('?', 1)[0].split('#', 1)[0] != request.path:
|
||||||
'chapters': with_views(live(Chapter), 'chapter')[:6],
|
return redirect(page.link)
|
||||||
'upcoming': upcoming_chapters()[:3],
|
return render(request, 'managed-page.html', {'page': page})
|
||||||
'recent_reviews': published_reviews()[:5],
|
|
||||||
'news': with_views(live(Entry).filter(kind=Entry.Kind.NEWS), 'blog')[:6],
|
|
||||||
'cast': live(Entry).filter(kind=Entry.Kind.CAST)[:3],
|
@require_safe
|
||||||
'world': live(Entry).filter(kind=Entry.Kind.WORLD)[:3],
|
def managed_page(request, slug):
|
||||||
})
|
from .models import ManagedPage
|
||||||
|
return render_managed_page(request, get_object_or_404(ManagedPage, slug=slug, published=True))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@require_safe
|
@require_safe
|
||||||
def chapters(request):
|
def chapters(request):
|
||||||
return render(request, 'chapters.html', {'chapters': with_views(live(Chapter), 'chapter')})
|
return render(request, 'chapters.html', {'chapters': with_views(live(Chapter), 'chapter'), 'rolling_free_ids': set(rolling_chapter_ids().values_list('pk', flat=True)), 'show_archive_status': True})
|
||||||
|
|
||||||
|
|
||||||
@require_safe
|
@require_safe
|
||||||
@never_cache
|
@never_cache
|
||||||
def chapter(request, number):
|
def chapter(request, number):
|
||||||
item = get_object_or_404(live(Chapter), number=number)
|
item = get_object_or_404(live(Chapter), number=number)
|
||||||
|
if not full_chapters(request.user).filter(pk=item.pk).exists():
|
||||||
|
from shop.payments import stripe_ready
|
||||||
|
return render(request, 'chapter-locked.html', {
|
||||||
|
'chapter': item, 'stripe_enabled': stripe_ready() and bool(config.SLX_COMMERCE_STRIPE_WEBHOOK_SECRET),
|
||||||
|
})
|
||||||
if item.publisher_url:
|
if item.publisher_url:
|
||||||
return redirect(item.publisher_url)
|
return redirect(item.publisher_url)
|
||||||
if item.price_usd and not entitled_chapters(request.user).filter(pk=item.pk).exists():
|
|
||||||
return render(request, 'chapter-locked.html', {'chapter': item, 'paypal_ready': checkout_ready()})
|
|
||||||
request.slx_view_target = ('chapter', item.pk)
|
request.slx_view_target = ('chapter', item.pk)
|
||||||
item.public_views = view_total('chapter', item.pk)
|
item.public_views = view_total('chapter', item.pk)
|
||||||
pages = list(item.pages.all())
|
pages = list(item.pages.all())
|
||||||
@@ -187,7 +201,7 @@ def chapter(request, number):
|
|||||||
page.reactions = groups[page.pk]
|
page.reactions = groups[page.pk]
|
||||||
next_chapter = live(Chapter).filter(number__gt=number).order_by('number').first()
|
next_chapter = live(Chapter).filter(number__gt=number).order_by('number').first()
|
||||||
next_readable = bool(next_chapter and (
|
next_readable = bool(next_chapter and (
|
||||||
not next_chapter.price_usd or entitled_chapters(request.user).filter(pk=next_chapter.pk).exists()))
|
full_chapters(request.user).filter(pk=next_chapter.pk).exists()))
|
||||||
next_cover = None
|
next_cover = None
|
||||||
if next_readable:
|
if next_readable:
|
||||||
next_cover = next_chapter.cover
|
next_cover = next_chapter.cover
|
||||||
@@ -195,7 +209,11 @@ def chapter(request, number):
|
|||||||
first_page = next_chapter.pages.first()
|
first_page = next_chapter.pages.first()
|
||||||
next_cover = first_page.art if first_page else None
|
next_cover = first_page.art if first_page else None
|
||||||
previous_chapter = live(Chapter).filter(number__lt=number).first()
|
previous_chapter = live(Chapter).filter(number__lt=number).first()
|
||||||
return render(request, 'chapter.html', {'chapter': item, 'frames': reading_frames(item, pages),
|
from shop.models import Product
|
||||||
|
from shop.payments import stripe_ready
|
||||||
|
physical = Product.objects.filter(active=True, kind=Product.Kind.PHYSICAL, sample_chapter=item).first()
|
||||||
|
return render(request, 'chapter.html', {'chapter': item,
|
||||||
|
'physical_edition': physical, 'stripe_enabled': stripe_ready() and bool(config.SLX_COMMERCE_STRIPE_WEBHOOK_SECRET), 'frames': reading_frames(item, pages),
|
||||||
'next_chapter': next_chapter, 'next_readable': next_readable, 'next_cover': next_cover,
|
'next_chapter': next_chapter, 'next_readable': next_readable, 'next_cover': next_cover,
|
||||||
'previous_chapter': previous_chapter,
|
'previous_chapter': previous_chapter,
|
||||||
**chapter_fan_context(request, item)})
|
**chapter_fan_context(request, item)})
|
||||||
@@ -227,9 +245,30 @@ def entry(request, kind, slug):
|
|||||||
'share_image': request.build_absolute_uri(item.art.url) if item.art else ''})
|
'share_image': request.build_absolute_uri(item.art.url) if item.art else ''})
|
||||||
|
|
||||||
|
|
||||||
|
def countdown_splash_context(request):
|
||||||
|
settings = settings_row()
|
||||||
|
now = timezone.now()
|
||||||
|
if (settings.homepage_countdown_enabled and settings.homepage_countdown_landing
|
||||||
|
and settings.homepage_countdown_cover and settings.homepage_countdown_at
|
||||||
|
and settings.homepage_countdown_at > now):
|
||||||
|
tint = settings.homepage_countdown_tint
|
||||||
|
social = settings.homepage_social_color
|
||||||
|
return {
|
||||||
|
'settings': settings,
|
||||||
|
'countdown_now': now,
|
||||||
|
'release_progress': countdown_progress(settings, now),
|
||||||
|
'countdown_chapters': countdown_chapter_shelf(request.user, now),
|
||||||
|
'countdown_social_color': social if HEX_COLOR.fullmatch(social) else '#ffdd00',
|
||||||
|
'countdown_tint': tint if HEX_COLOR.fullmatch(tint) else '#0c1020',
|
||||||
|
'countdown_tint_strength': min(100, settings.homepage_countdown_tint_strength),
|
||||||
|
}
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
@require_safe
|
@require_safe
|
||||||
def coming_soon(request):
|
def coming_soon(request):
|
||||||
return render(request, 'soon.html')
|
context = countdown_splash_context(request)
|
||||||
|
return render(request, 'countdown-landing.html', context) if context else render(request, 'soon.html')
|
||||||
|
|
||||||
|
|
||||||
@require_safe
|
@require_safe
|
||||||
@@ -237,7 +276,11 @@ def image(request, key):
|
|||||||
# Chapter pages respect visibility and schedule even if a file URL is shared.
|
# Chapter pages respect visibility and schedule even if a file URL is shared.
|
||||||
name = f'images/{key}'
|
name = f'images/{key}'
|
||||||
from .membership import accessible_posts
|
from .membership import accessible_posts
|
||||||
|
from .collectors import recognized_collectors
|
||||||
|
from .models import CollectorProfile
|
||||||
sources = (
|
sources = (
|
||||||
|
(recognized_collectors(), 'photo'),
|
||||||
|
(CollectorProfile.objects.filter(user_id=request.user.pk), 'photo'),
|
||||||
(MemberArtwork.objects.filter(post__in=accessible_posts(request.user)), 'art'),
|
(MemberArtwork.objects.filter(post__in=accessible_posts(request.user)), 'art'),
|
||||||
(PageSharePreview.objects.all(), 'art'),
|
(PageSharePreview.objects.all(), 'art'),
|
||||||
(PageBackground.objects.filter(enabled=True), 'art'),
|
(PageBackground.objects.filter(enabled=True), 'art'),
|
||||||
@@ -257,7 +300,7 @@ def image(request, key):
|
|||||||
(scheduled_chapters() if settings_row().show_chapter_countdowns else Chapter.objects.none(), 'cover'),
|
(scheduled_chapters() if settings_row().show_chapter_countdowns else Chapter.objects.none(), 'cover'),
|
||||||
(live(Chapter), 'cover'),
|
(live(Chapter), 'cover'),
|
||||||
(live(Entry), 'art'),
|
(live(Entry), 'art'),
|
||||||
(Page.objects.filter(chapter__in=entitled_chapters(request.user), chapter__publisher_url=''), 'art'),
|
(Page.objects.filter(chapter__in=full_chapters(request.user), chapter__publisher_url=''), 'art'),
|
||||||
)
|
)
|
||||||
if can_watch_stream(request.user) or (request.user.is_staff and request.user.has_perm('catalog.view_sitesettings')):
|
if can_watch_stream(request.user) or (request.user.is_staff and request.user.has_perm('catalog.view_sitesettings')):
|
||||||
sources += ((SiteSettings.objects.filter(pk=1), 'stream_cover'),)
|
sources += ((SiteSettings.objects.filter(pk=1), 'stream_cover'),)
|
||||||
@@ -295,3 +338,37 @@ def health(request):
|
|||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
cursor.execute('SELECT 1')
|
cursor.execute('SELECT 1')
|
||||||
return JsonResponse({'status': 'ok', 'service': 'slx-studio'})
|
return JsonResponse({'status': 'ok', 'service': 'slx-studio'})
|
||||||
|
|
||||||
|
|
||||||
|
@require_POST
|
||||||
|
@login_required
|
||||||
|
def buy_chapter(request, number):
|
||||||
|
from django.conf import settings
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.db import transaction
|
||||||
|
from shop.models import Product, Order, OrderItem
|
||||||
|
from shop.payments import create_stripe_order_session, stripe_ready
|
||||||
|
|
||||||
|
item = get_object_or_404(live(Chapter), number=number, publisher_url='', price_usd__gte='0.50')
|
||||||
|
if full_chapters(request.user).filter(pk=item.pk).exists():
|
||||||
|
return redirect('chapter', number=number)
|
||||||
|
if not request.user.is_active or not request.user.email or not stripe_ready() or not settings.SLX_COMMERCE_STRIPE_WEBHOOK_SECRET:
|
||||||
|
messages.error(request, 'Chapter checkout needs an account email and an enabled Stripe checkout.')
|
||||||
|
return redirect('chapter', number=number)
|
||||||
|
try:
|
||||||
|
with transaction.atomic():
|
||||||
|
product, _ = Product.objects.get_or_create(slug=f'digital-chapter-{item.pk}', defaults={
|
||||||
|
'kind': Product.Kind.DIGITAL, 'title': item.title[:160], 'sample_chapter': item,
|
||||||
|
'price_usd': item.price_usd, 'active': False, 'track_stock': False,
|
||||||
|
})
|
||||||
|
if product.kind != Product.Kind.DIGITAL or product.sample_chapter_id != item.pk:
|
||||||
|
raise ValueError('Reserved chapter product slug already exists.')
|
||||||
|
order = Order.objects.create(user=request.user, email=request.user.email, gateway=Order.Gateway.STRIPE,
|
||||||
|
subtotal_usd=item.price_usd, total_usd=item.price_usd)
|
||||||
|
OrderItem.objects.create(order=order, product=product, chapter=item, title_snapshot=item.title[:160],
|
||||||
|
unit_price_usd=item.price_usd)
|
||||||
|
url = create_stripe_order_session(order)
|
||||||
|
except Exception:
|
||||||
|
messages.error(request, 'Checkout could not start. Please try again.')
|
||||||
|
return redirect('chapter', number=number)
|
||||||
|
return redirect(url)
|
||||||
@@ -5,16 +5,16 @@ from .models import Order, OrderItem, Product, Subscription
|
|||||||
|
|
||||||
@admin.register(Product, site=studio)
|
@admin.register(Product, site=studio)
|
||||||
class ProductAdmin(admin.ModelAdmin):
|
class ProductAdmin(admin.ModelAdmin):
|
||||||
list_display = ['title', 'kind', 'price_usd', 'stock', 'active', 'featured', 'position']
|
list_display = ['title', 'kind', 'price_usd', 'stock', 'active', 'featured', 'verified_by_seller', 'position']
|
||||||
list_filter = ['kind', 'active', 'featured']
|
list_filter = ['kind', 'active', 'featured', 'verified_by_seller']
|
||||||
list_editable = ['price_usd', 'stock', 'active', 'position']
|
list_editable = ['price_usd', 'stock', 'active', 'position']
|
||||||
search_fields = ['title', 'summary']
|
search_fields = ['title', 'summary']
|
||||||
prepopulated_fields = {'slug': ('title',)}
|
prepopulated_fields = {'slug': ('title',)}
|
||||||
fieldsets = [
|
fieldsets = [
|
||||||
('Product', {'fields': ['title', 'slug', 'kind', 'summary', 'description', 'image', 'price_usd', 'active', 'featured', 'position']}),
|
('Product', {'fields': ['title', 'slug', 'kind', 'summary', 'description', 'image', 'price_usd', 'active', 'featured', 'verified_by_seller', 'position']}),
|
||||||
('Physical Inventory & Shipping', {'fields': ['track_stock', 'stock', 'shipping_usd']}),
|
('Physical Inventory & Shipping', {'fields': ['track_stock', 'stock', 'shipping_usd']}),
|
||||||
('Digital Download', {'fields': ['digital_file']}),
|
('Digital Download', {'fields': ['digital_file', 'sample_chapter']}),
|
||||||
('Subscription Billing', {'fields': ['billing_interval', 'stripe_price_id', 'paypal_plan_id']}),
|
('Subscription Billing', {'fields': ['billing_interval', 'stripe_price_id', 'paypal_plan_id', 'member_tier', 'comparison']}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 01:31
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('shop', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='product',
|
||||||
|
name='verified_by_seller',
|
||||||
|
field=models.BooleanField(default=False, help_text='Show the Verified by Seller badge on this listing.'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 11:05
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('catalog', '0027_alter_chapter_price_usd_managedpage'),
|
||||||
|
('shop', '0002_product_verified_by_seller'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='order',
|
||||||
|
name='stripe_live',
|
||||||
|
field=models.BooleanField(editable=False, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='orderitem',
|
||||||
|
name='chapter',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='catalog.chapter'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='product',
|
||||||
|
name='member_tier',
|
||||||
|
field=models.PositiveSmallIntegerField(blank=True, choices=[(1, 'Early Access'), (2, 'Studio Vault')], null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='product',
|
||||||
|
name='sample_chapter',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='shop_editions', to='catalog.chapter'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='subscription',
|
||||||
|
name='entitlement_tier',
|
||||||
|
field=models.PositiveSmallIntegerField(editable=False, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='subscription',
|
||||||
|
name='stripe_live',
|
||||||
|
field=models.BooleanField(editable=False, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from decimal import Decimal
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def seed(apps, schema_editor):
|
||||||
|
Product = apps.get_model('shop', 'Product')
|
||||||
|
products = Product.objects.using(schema_editor.connection.alias)
|
||||||
|
for slug, label, tier in [('slx-monthly-early-access', 'Early Access', 1),
|
||||||
|
('slx-monthly-studio-vault', 'Studio Vault', 2)]:
|
||||||
|
if not products.filter(kind='subscription', member_tier=tier).exists():
|
||||||
|
products.get_or_create(slug=slug, defaults={
|
||||||
|
'title': f'Slump X Land Monthly · {label}', 'kind': 'subscription',
|
||||||
|
'billing_interval': 'month', 'member_tier': tier, 'price_usd': Decimal('0.50'),
|
||||||
|
'track_stock': False, 'active': False,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [('shop', '0003_order_stripe_live_orderitem_chapter_and_more')]
|
||||||
|
operations = [migrations.RunPython(seed, migrations.RunPython.noop)]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 12:55
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('shop', '0004_fan_club_products'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='product',
|
||||||
|
name='comparison',
|
||||||
|
field=models.TextField(blank=True, help_text='One benefit per line, using Feature: Details. Used on the membership comparison chart.', max_length=3000),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-26 13:54
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('shop', '0005_product_comparison'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='product',
|
||||||
|
name='member_tier',
|
||||||
|
field=models.PositiveSmallIntegerField(blank=True, choices=[(1, 'Early Access'), (2, 'Studio Vault'), (3, 'Collector’s Circle')], null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -24,7 +24,14 @@ class Product(models.Model):
|
|||||||
image = models.ImageField(upload_to='shop/products/', blank=True)
|
image = models.ImageField(upload_to='shop/products/', blank=True)
|
||||||
price_usd = models.DecimalField(max_digits=9, decimal_places=2, validators=[MinValueValidator(Decimal('0.50'))])
|
price_usd = models.DecimalField(max_digits=9, decimal_places=2, validators=[MinValueValidator(Decimal('0.50'))])
|
||||||
active = models.BooleanField(default=True)
|
active = models.BooleanField(default=True)
|
||||||
|
comparison = models.TextField(blank=True, max_length=3000,
|
||||||
|
help_text='One benefit per line, using Feature: Details. Used on the membership comparison chart.')
|
||||||
featured = models.BooleanField(default=False)
|
featured = models.BooleanField(default=False)
|
||||||
|
sample_chapter = models.ForeignKey('catalog.Chapter', null=True, blank=True, on_delete=models.SET_NULL,
|
||||||
|
related_name='shop_editions')
|
||||||
|
member_tier = models.PositiveSmallIntegerField(choices=[(1, 'Early Access'), (2, 'Studio Vault'), (3, 'Collector’s Circle')],
|
||||||
|
null=True, blank=True)
|
||||||
|
verified_by_seller = models.BooleanField(default=False, help_text="Show the Verified by Seller badge on this listing.")
|
||||||
position = models.PositiveIntegerField(default=0)
|
position = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
# Physical inventory & shipping
|
# Physical inventory & shipping
|
||||||
@@ -96,6 +103,7 @@ class Order(models.Model):
|
|||||||
# Gateway tracking
|
# Gateway tracking
|
||||||
gateway_session_id = models.CharField(max_length=200, blank=True, db_index=True)
|
gateway_session_id = models.CharField(max_length=200, blank=True, db_index=True)
|
||||||
gateway_payment_id = models.CharField(max_length=200, blank=True)
|
gateway_payment_id = models.CharField(max_length=200, blank=True)
|
||||||
|
stripe_live = models.BooleanField(null=True, editable=False)
|
||||||
paid_at = models.DateTimeField(null=True, blank=True)
|
paid_at = models.DateTimeField(null=True, blank=True)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
@@ -113,6 +121,7 @@ class Order(models.Model):
|
|||||||
class OrderItem(models.Model):
|
class OrderItem(models.Model):
|
||||||
order = models.ForeignKey(Order, on_delete=models.CASCADE, related_name='items')
|
order = models.ForeignKey(Order, on_delete=models.CASCADE, related_name='items')
|
||||||
product = models.ForeignKey(Product, on_delete=models.PROTECT)
|
product = models.ForeignKey(Product, on_delete=models.PROTECT)
|
||||||
|
chapter = models.ForeignKey('catalog.Chapter', null=True, blank=True, on_delete=models.PROTECT)
|
||||||
title_snapshot = models.CharField(max_length=160)
|
title_snapshot = models.CharField(max_length=160)
|
||||||
unit_price_usd = models.DecimalField(max_digits=9, decimal_places=2)
|
unit_price_usd = models.DecimalField(max_digits=9, decimal_places=2)
|
||||||
quantity = models.PositiveIntegerField(default=1)
|
quantity = models.PositiveIntegerField(default=1)
|
||||||
@@ -137,6 +146,8 @@ class Subscription(models.Model):
|
|||||||
gateway_sub_id = models.CharField(max_length=200, blank=True, db_index=True)
|
gateway_sub_id = models.CharField(max_length=200, blank=True, db_index=True)
|
||||||
gateway_customer_id = models.CharField(max_length=200, blank=True)
|
gateway_customer_id = models.CharField(max_length=200, blank=True)
|
||||||
status = models.CharField(max_length=20, choices=Status.choices, default=Status.PENDING)
|
status = models.CharField(max_length=20, choices=Status.choices, default=Status.PENDING)
|
||||||
|
stripe_live = models.BooleanField(null=True, editable=False)
|
||||||
|
entitlement_tier = models.PositiveSmallIntegerField(null=True, editable=False)
|
||||||
current_period_end = models.DateTimeField(null=True, blank=True)
|
current_period_end = models.DateTimeField(null=True, blank=True)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ from django.utils import timezone
|
|||||||
import stripe
|
import stripe
|
||||||
|
|
||||||
from catalog.paypal import CheckoutError, access_token, checkout_origin, request_json, safe_approval_url
|
from catalog.paypal import CheckoutError, access_token, checkout_origin, request_json, safe_approval_url
|
||||||
|
from catalog.shop_stripe import origin as stripe_origin
|
||||||
from .models import Order, Product, Subscription
|
from .models import Order, Product, Subscription
|
||||||
|
|
||||||
|
|
||||||
def stripe_ready():
|
def stripe_ready():
|
||||||
return bool(settings.SLX_STRIPE_SECRET_KEY and checkout_origin())
|
return bool(settings.SLX_STRIPE_SECRET_KEY and (stripe_origin() or checkout_origin()))
|
||||||
|
|
||||||
|
|
||||||
def paypal_ready():
|
def paypal_ready():
|
||||||
@@ -23,7 +24,7 @@ def paypal_ready():
|
|||||||
and checkout_origin())
|
and checkout_origin())
|
||||||
|
|
||||||
|
|
||||||
def fulfill_order(order, payment_id=''):
|
def fulfill_order(order, payment_id='', stripe_live=None):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
order = Order.objects.select_for_update().get(pk=order.pk)
|
order = Order.objects.select_for_update().get(pk=order.pk)
|
||||||
if order.status != Order.Status.PENDING:
|
if order.status != Order.Status.PENDING:
|
||||||
@@ -32,7 +33,8 @@ def fulfill_order(order, payment_id=''):
|
|||||||
order.paid_at = timezone.now()
|
order.paid_at = timezone.now()
|
||||||
if payment_id:
|
if payment_id:
|
||||||
order.gateway_payment_id = payment_id[:200]
|
order.gateway_payment_id = payment_id[:200]
|
||||||
order.save(update_fields=['status', 'paid_at', 'gateway_payment_id'])
|
order.stripe_live = stripe_live
|
||||||
|
order.save(update_fields=['status', 'paid_at', 'gateway_payment_id', 'stripe_live'])
|
||||||
|
|
||||||
for item in order.items.select_related('product'):
|
for item in order.items.select_related('product'):
|
||||||
prod = item.product
|
prod = item.product
|
||||||
@@ -47,7 +49,7 @@ def fulfill_order(order, payment_id=''):
|
|||||||
|
|
||||||
def create_stripe_order_session(order):
|
def create_stripe_order_session(order):
|
||||||
stripe.api_key = settings.SLX_STRIPE_SECRET_KEY
|
stripe.api_key = settings.SLX_STRIPE_SECRET_KEY
|
||||||
origin = checkout_origin()
|
origin = stripe_origin() or checkout_origin()
|
||||||
line_items = []
|
line_items = []
|
||||||
for item in order.items.select_related('product'):
|
for item in order.items.select_related('product'):
|
||||||
line_items.append({
|
line_items.append({
|
||||||
@@ -88,7 +90,7 @@ def create_stripe_order_session(order):
|
|||||||
|
|
||||||
def create_stripe_subscription_session(sub):
|
def create_stripe_subscription_session(sub):
|
||||||
stripe.api_key = settings.SLX_STRIPE_SECRET_KEY
|
stripe.api_key = settings.SLX_STRIPE_SECRET_KEY
|
||||||
origin = checkout_origin()
|
origin = stripe_origin() or checkout_origin()
|
||||||
prod = sub.product
|
prod = sub.product
|
||||||
if prod.stripe_price_id:
|
if prod.stripe_price_id:
|
||||||
line_item = {'price': prod.stripe_price_id, 'quantity': 1}
|
line_item = {'price': prod.stripe_price_id, 'quantity': 1}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ urlpatterns = [
|
|||||||
path('paypal/return/<uuid:order_id>/', views.paypal_return, name='shop-paypal-return'),
|
path('paypal/return/<uuid:order_id>/', views.paypal_return, name='shop-paypal-return'),
|
||||||
path('order/<uuid:order_id>/', views.order_detail, name='shop-order-detail'),
|
path('order/<uuid:order_id>/', views.order_detail, name='shop-order-detail'),
|
||||||
path('order/<uuid:order_id>/download/<int:item_id>/', views.download_digital, name='shop-download'),
|
path('order/<uuid:order_id>/download/<int:item_id>/', views.download_digital, name='shop-download'),
|
||||||
path('webhooks/stripe/', views.stripe_webhook, name='shop-stripe-webhook'),
|
path('webhooks/stripe/', views.stripe_webhook, name='commerce-stripe-webhook'),
|
||||||
path('webhooks/paypal/', views.paypal_webhook, name='shop-paypal-webhook'),
|
path('webhooks/paypal/', views.paypal_webhook, name='shop-paypal-webhook'),
|
||||||
path('<slug:slug>/', views.product_detail, name='shop-product'),
|
path('<slug:slug>/', views.product_detail, name='shop-product'),
|
||||||
]
|
]
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
|
from datetime import datetime, timezone as utc
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import json
|
import json
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.db import transaction
|
||||||
from django.http import FileResponse, Http404, HttpResponse, HttpResponseBadRequest
|
from django.http import FileResponse, Http404, HttpResponse, HttpResponseBadRequest
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
@@ -76,10 +79,16 @@ def index(request):
|
|||||||
def product_detail(request, slug):
|
def product_detail(request, slug):
|
||||||
product = get_object_or_404(Product, slug=slug, active=True)
|
product = get_object_or_404(Product, slug=slug, active=True)
|
||||||
cart_count = sum(_get_cart(request).values())
|
cart_count = sum(_get_cart(request).values())
|
||||||
|
from catalog.fans import live
|
||||||
|
from catalog.models import Chapter
|
||||||
|
chapter = live(Chapter).filter(pk=product.sample_chapter_id, publisher_url='').first()
|
||||||
return render(request, 'shop/product.html', {
|
return render(request, 'shop/product.html', {
|
||||||
|
'sample_chapter': chapter,
|
||||||
|
'editions': Product.objects.filter(active=True, kind=Product.Kind.PHYSICAL, sample_chapter=chapter).exclude(pk=product.pk) if chapter else (),
|
||||||
|
'related_products': Product.objects.filter(active=True).exclude(pk=product.pk)[:6],
|
||||||
'product': product,
|
'product': product,
|
||||||
'cart_count': cart_count,
|
'cart_count': cart_count,
|
||||||
'stripe_enabled': stripe_ready(),
|
'stripe_enabled': stripe_ready() and bool(settings.SLX_COMMERCE_STRIPE_WEBHOOK_SECRET),
|
||||||
'paypal_enabled': paypal_ready(),
|
'paypal_enabled': paypal_ready(),
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -173,9 +182,13 @@ def checkout_start(request):
|
|||||||
|
|
||||||
|
|
||||||
@require_POST
|
@require_POST
|
||||||
|
@login_required
|
||||||
def subscribe_start(request, slug):
|
def subscribe_start(request, slug):
|
||||||
product = get_object_or_404(Product, slug=slug, active=True, kind=Product.Kind.SUBSCRIPTION)
|
product = get_object_or_404(Product, slug=slug, active=True, kind=Product.Kind.SUBSCRIPTION)
|
||||||
gateway = request.POST.get('gateway', '').lower()
|
gateway = request.POST.get('gateway', '').lower()
|
||||||
|
if product.member_tier and (gateway != 'stripe' or not stripe_ready() or not settings.SLX_COMMERCE_STRIPE_WEBHOOK_SECRET):
|
||||||
|
messages.error(request, 'Fan Club subscriptions require Stripe checkout.')
|
||||||
|
return redirect('shop-product', slug=slug)
|
||||||
email = (request.user.email if request.user.is_authenticated and request.user.email else request.POST.get('email', '')).strip()
|
email = (request.user.email if request.user.is_authenticated and request.user.email else request.POST.get('email', '')).strip()
|
||||||
if not email or '@' not in email:
|
if not email or '@' not in email:
|
||||||
messages.error(request, 'Please enter a valid email address to subscribe.')
|
messages.error(request, 'Please enter a valid email address to subscribe.')
|
||||||
@@ -184,7 +197,7 @@ def subscribe_start(request, slug):
|
|||||||
sub = Subscription.objects.create(
|
sub = Subscription.objects.create(
|
||||||
user=request.user if request.user.is_authenticated else None,
|
user=request.user if request.user.is_authenticated else None,
|
||||||
email=email,
|
email=email,
|
||||||
product=product,
|
product=product, entitlement_tier=product.member_tier,
|
||||||
gateway=gateway if gateway in {'stripe', 'paypal'} else Order.Gateway.STRIPE,
|
gateway=gateway if gateway in {'stripe', 'paypal'} else Order.Gateway.STRIPE,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
@@ -229,24 +242,27 @@ def download_digital(request, order_id, item_id):
|
|||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@require_POST
|
@require_POST
|
||||||
def stripe_webhook(request):
|
def stripe_webhook(request):
|
||||||
if not settings.SLX_STRIPE_WEBHOOK_SECRET:
|
if not settings.SLX_COMMERCE_STRIPE_WEBHOOK_SECRET:
|
||||||
return HttpResponseBadRequest('Webhook secret not configured')
|
return HttpResponseBadRequest('Webhook secret not configured')
|
||||||
stripe.api_key = settings.SLX_STRIPE_SECRET_KEY
|
stripe.api_key = settings.SLX_STRIPE_SECRET_KEY
|
||||||
sig = request.META.get('HTTP_STRIPE_SIGNATURE', '')
|
sig = request.META.get('HTTP_STRIPE_SIGNATURE', '')
|
||||||
try:
|
try:
|
||||||
event = stripe.Webhook.construct_event(request.body, sig, settings.SLX_STRIPE_WEBHOOK_SECRET)
|
event = stripe.Webhook.construct_event(request.body, sig, settings.SLX_COMMERCE_STRIPE_WEBHOOK_SECRET)
|
||||||
except Exception:
|
except Exception:
|
||||||
return HttpResponseBadRequest('Invalid signature')
|
return HttpResponseBadRequest('Invalid signature')
|
||||||
|
|
||||||
|
from catalog.chapter_access import stripe_live_mode
|
||||||
|
if event.get('livemode') != stripe_live_mode():
|
||||||
|
return HttpResponseBadRequest('Stripe mode mismatch')
|
||||||
etype = event['type']
|
etype = event['type']
|
||||||
obj = event['data']['object']
|
obj = event['data']['object']
|
||||||
|
if etype in ('checkout.session.completed', 'checkout.session.async_payment_succeeded'):
|
||||||
if etype == 'checkout.session.completed':
|
|
||||||
meta = obj.get('metadata') or {}
|
meta = obj.get('metadata') or {}
|
||||||
if meta.get('kind') == 'order' and meta.get('order_id'):
|
if meta.get('kind') == 'order' and obj.get('payment_status') == 'paid':
|
||||||
order = Order.objects.filter(order_id=meta['order_id']).first()
|
order = Order.objects.filter(gateway=Order.Gateway.STRIPE, gateway_session_id=obj.get('id', '')).first()
|
||||||
if order:
|
if (order and str(order.order_id) == meta.get('order_id') and obj.get('currency') == 'usd'
|
||||||
shipping = obj.get('shipping_details') or {}
|
and obj.get('amount_total') == int(order.total_usd * 100)):
|
||||||
|
shipping = obj.get('shipping_details') or (obj.get('collected_information') or {}).get('shipping_details') or {}
|
||||||
addr = shipping.get('address') or {}
|
addr = shipping.get('address') or {}
|
||||||
if addr:
|
if addr:
|
||||||
order.full_name = (shipping.get('name') or order.full_name)[:160]
|
order.full_name = (shipping.get('name') or order.full_name)[:160]
|
||||||
@@ -260,23 +276,45 @@ def stripe_webhook(request):
|
|||||||
'full_name', 'shipping_line1', 'shipping_line2',
|
'full_name', 'shipping_line1', 'shipping_line2',
|
||||||
'shipping_city', 'shipping_state', 'shipping_postal', 'shipping_country'
|
'shipping_city', 'shipping_state', 'shipping_postal', 'shipping_country'
|
||||||
])
|
])
|
||||||
fulfill_order(order, payment_id=obj.get('payment_intent') or obj.get('id', ''))
|
fulfill_order(order, payment_id=obj.get('payment_intent') or obj['id'], stripe_live=event['livemode'])
|
||||||
elif meta.get('kind') == 'subscription' and meta.get('sub_id'):
|
elif meta.get('kind') == 'subscription' and obj.get('subscription'):
|
||||||
Subscription.objects.filter(sub_id=meta['sub_id']).update(
|
sync_stripe_subscription(obj['subscription'], event['livemode'], meta.get('sub_id'))
|
||||||
status=Subscription.Status.ACTIVE,
|
|
||||||
gateway_sub_id=obj.get('subscription') or '',
|
|
||||||
gateway_customer_id=obj.get('customer') or '',
|
|
||||||
)
|
|
||||||
|
|
||||||
elif etype in ('customer.subscription.deleted', 'invoice.payment_failed'):
|
elif etype == 'charge.refunded' and obj.get('refunded') and obj.get('payment_intent'):
|
||||||
sub_id = obj.get('id') if etype == 'customer.subscription.deleted' else obj.get('subscription')
|
Order.objects.filter(gateway=Order.Gateway.STRIPE, stripe_live=event['livemode'],
|
||||||
|
gateway_payment_id=obj['payment_intent']).update(status=Order.Status.REFUNDED)
|
||||||
|
elif etype in ('customer.subscription.updated', 'customer.subscription.deleted',
|
||||||
|
'invoice.paid', 'invoice.payment_failed'):
|
||||||
|
sub_id = obj.get('id') if etype.startswith('customer.subscription.') else (
|
||||||
|
obj.get('subscription') or ((obj.get('parent') or {}).get('subscription_details') or {}).get('subscription'))
|
||||||
if sub_id:
|
if sub_id:
|
||||||
new_status = Subscription.Status.CANCELED if etype == 'customer.subscription.deleted' else Subscription.Status.PAST_DUE
|
sync_stripe_subscription(sub_id, event['livemode'])
|
||||||
Subscription.objects.filter(gateway_sub_id=sub_id).update(status=new_status)
|
|
||||||
|
|
||||||
return HttpResponse('ok')
|
return HttpResponse('ok')
|
||||||
|
|
||||||
|
|
||||||
|
def sync_stripe_subscription(remote_id, live_mode, checkout_ref=None):
|
||||||
|
with transaction.atomic():
|
||||||
|
rows = Subscription.objects.select_for_update().filter(gateway=Order.Gateway.STRIPE)
|
||||||
|
sub = rows.filter(gateway_sub_id=remote_id, stripe_live=live_mode).first()
|
||||||
|
if sub is None and checkout_ref:
|
||||||
|
sub = rows.filter(sub_id=checkout_ref, gateway_sub_id='').first()
|
||||||
|
if not sub:
|
||||||
|
return
|
||||||
|
current = stripe.Subscription.retrieve(remote_id)
|
||||||
|
if current.get('livemode') != live_mode or (current.get('metadata') or {}).get('sub_id') != str(sub.sub_id):
|
||||||
|
return
|
||||||
|
state = current.get('status')
|
||||||
|
periods = [item.get('current_period_end') for item in (current.get('items') or {}).get('data', [])]
|
||||||
|
period = current.get('current_period_end') or min((v for v in periods if v), default=None)
|
||||||
|
sub.status = (Subscription.Status.ACTIVE if state == 'active' else Subscription.Status.CANCELED
|
||||||
|
if state in {'canceled', 'incomplete_expired'} else Subscription.Status.PAST_DUE)
|
||||||
|
sub.current_period_end = datetime.fromtimestamp(period, tz=utc.utc) if period else None
|
||||||
|
sub.gateway_sub_id = remote_id
|
||||||
|
sub.gateway_customer_id = current.get('customer') or ''
|
||||||
|
sub.stripe_live = live_mode
|
||||||
|
sub.save(update_fields=['status', 'current_period_end', 'gateway_sub_id', 'gateway_customer_id', 'stripe_live'])
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@require_POST
|
@require_POST
|
||||||
def paypal_webhook(request):
|
def paypal_webhook(request):
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import include, re_path
|
from django.urls import include, re_path
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
|
from django.views.generic import TemplateView
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import views as auth_views
|
||||||
from catalog import views, fans, reactions, reviews, paypal, streams, newsletter, shop_stripe, membership
|
from catalog import views, fans, reactions, reviews, paypal, streams, newsletter, shop_stripe, membership, collectors
|
||||||
from catalog.admin import studio
|
from catalog.admin import studio
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.home, name='home'),
|
path('', views.home, name='home'),
|
||||||
|
path('map/', views.map_landing, name='world-map'),
|
||||||
|
path('pages/<slug:slug>/', views.managed_page, name='managed-page'),
|
||||||
|
path('chapters/<int:number>/buy/', views.buy_chapter, name='buy-chapter'),
|
||||||
path('admin/', studio.urls),
|
path('admin/', studio.urls),
|
||||||
path('shop/', include('shop.urls')),
|
path('shop/', include('shop.urls')),
|
||||||
path('chapters/', views.chapters, name='chapters'),
|
path('chapters/', views.chapters, name='chapters'),
|
||||||
@@ -32,6 +36,7 @@ urlpatterns = [
|
|||||||
path('fan/login/', auth_views.LoginView.as_view(template_name='registration/fan-login.html'), name='fan-login'),
|
path('fan/login/', auth_views.LoginView.as_view(template_name='registration/fan-login.html'), name='fan-login'),
|
||||||
path('fan/logout/', auth_views.LogoutView.as_view(next_page='home'), name='fan-logout'),
|
path('fan/logout/', auth_views.LogoutView.as_view(next_page='home'), name='fan-logout'),
|
||||||
path('fan/signup/', fans.signup, name='fan-signup'),
|
path('fan/signup/', fans.signup, name='fan-signup'),
|
||||||
|
path('fan/collector-preferences/', collectors.preferences, name='collector-preferences'),
|
||||||
path('fan/library/', fans.library, name='library'),
|
path('fan/library/', fans.library, name='library'),
|
||||||
path('fan/follow/', fans.follow_title, name='fan-follow'),
|
path('fan/follow/', fans.follow_title, name='fan-follow'),
|
||||||
path('fan/notifications/', fans.notices, name='fan-notices'),
|
path('fan/notifications/', fans.notices, name='fan-notices'),
|
||||||
@@ -53,6 +58,8 @@ urlpatterns = [
|
|||||||
path('newsletter/confirm/<uuid:token>/', newsletter.confirm, name='newsletter-confirm'),
|
path('newsletter/confirm/<uuid:token>/', newsletter.confirm, name='newsletter-confirm'),
|
||||||
path('newsletter/unsubscribe/<uuid:token>/', newsletter.unsubscribe, name='newsletter-unsubscribe'),
|
path('newsletter/unsubscribe/<uuid:token>/', newsletter.unsubscribe, name='newsletter-unsubscribe'),
|
||||||
path('newsletter/one-click/<uuid:token>/', newsletter.one_click, name='newsletter-one-click'),
|
path('newsletter/one-click/<uuid:token>/', newsletter.one_click, name='newsletter-one-click'),
|
||||||
|
path('about/', TemplateView.as_view(template_name='series-intro.html'), name='series-intro'),
|
||||||
|
path('djinnii/', TemplateView.as_view(template_name='djinnii.html'), name='djinnii'),
|
||||||
path('<slug:kind>/', views.entries, name='entries'),
|
path('<slug:kind>/', views.entries, name='entries'),
|
||||||
path('<slug:kind>/<slug:slug>/', views.entry, name='entry'),
|
path('<slug:kind>/<slug:slug>/', views.entry, name='entry'),
|
||||||
]
|
]
|
||||||
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,9 @@
|
|||||||
|
(() => {
|
||||||
|
const reminder = document.querySelector('[data-archive-reminder]');
|
||||||
|
if (!reminder || typeof reminder.showModal !== 'function') return;
|
||||||
|
try {
|
||||||
|
if (sessionStorage.getItem('slx-archive-reminder')) return;
|
||||||
|
sessionStorage.setItem('slx-archive-reminder', 'seen');
|
||||||
|
} catch { /* The reminder still works when session storage is unavailable. */ }
|
||||||
|
if (!document.querySelector('dialog[open]')) reminder.showModal();
|
||||||
|
})();
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
.release-landing.countdown-showcase{padding:clamp(.75rem,2.5vw,2.25rem)}
|
||||||
|
.countdown-showcase .compact-release{width:min(100%,72rem);display:grid;grid-template-columns:minmax(0,.84fr) minmax(0,1.16fr);align-items:start;gap:clamp(.75rem,2vw,1.35rem)}
|
||||||
|
.compact-release .release-stage{grid-column:1/-1;padding:0 .25rem clamp(1rem,3.5vw,2rem)}
|
||||||
|
.compact-release .release-hover{width:min(100%,61rem);display:grid;justify-items:center}
|
||||||
|
.compact-release .release-cover{display:block;width:auto;height:auto;max-width:100%;max-height:min(59svh,42rem);object-fit:contain}
|
||||||
|
.compact-release .release-reflection{display:none}
|
||||||
|
.compact-release .release-copy,.compact-release .release-message{min-width:0;text-align:left}
|
||||||
|
.compact-release .release-timer-panel{padding:clamp(.85rem,2vw,1.35rem)}
|
||||||
|
.compact-release .release-timer-panel h1{font-size:clamp(1.5rem,3.3vw,2.85rem);line-height:1.1;margin:.45rem 0 .7rem}
|
||||||
|
.compact-release .release-clock .ticker{font-size:clamp(1.1rem,2.6vw,1.65rem)}
|
||||||
|
.compact-release .release-progress{margin-top:.7rem}
|
||||||
|
.compact-release .slx-author-note{margin:0;padding:clamp(.85rem,2vw,1.4rem)}
|
||||||
|
.compact-release .slx-author-note-copy{font-size:clamp(.95rem,1.5vw,1.08rem);line-height:1.5}
|
||||||
|
.compact-release .slx-author-note-copy p{margin:0 0 .65em}
|
||||||
|
.compact-release .slx-author-note-signoff{margin-top:.55rem}
|
||||||
|
.compact-release .slx-author-avatar{width:clamp(44px,6vw,76px);height:auto}
|
||||||
|
.compact-release .slx-author-signature{max-width:min(38%,9rem)}
|
||||||
|
@media(max-width:670px){
|
||||||
|
.countdown-showcase .compact-release{grid-template-columns:minmax(0,1fr);gap:.65rem}
|
||||||
|
.compact-release .release-stage{padding-bottom:.6rem}
|
||||||
|
.compact-release .release-cover{max-height:min(47svh,24rem)}
|
||||||
|
}
|
||||||
|
.compact-release .release-reflection{display:grid;justify-items:center;top:100%;height:20%;opacity:.16}
|
||||||
|
.compact-release .release-reflection img{display:block;width:auto;height:auto;max-width:100%;max-height:min(59svh,42rem);object-fit:contain}
|
||||||
|
@media(max-width:670px){.compact-release .release-reflection{display:none}}
|
||||||
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 300 B |
|
After Width: | Height: | Size: 387 B |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 124 B |
|
After Width: | Height: | Size: 368 B |
|
After Width: | Height: | Size: 251 B |
|
After Width: | Height: | Size: 446 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 327 B |
|
After Width: | Height: | Size: 367 B |
|
After Width: | Height: | Size: 200 B |
|
After Width: | Height: | Size: 346 B |
|
After Width: | Height: | Size: 370 B |
|
After Width: | Height: | Size: 264 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 295 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 302 B |
|
After Width: | Height: | Size: 184 B |
|
After Width: | Height: | Size: 305 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 411 B |
|
After Width: | Height: | Size: 505 B |
|
After Width: | Height: | Size: 346 B |
@@ -0,0 +1,4 @@
|
|||||||
|
header.site-header{position:relative;isolation:isolate}
|
||||||
|
header.site-header::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:url("solterra-map.jpg") center 44%/cover no-repeat;opacity:.16}
|
||||||
|
.djinnii-page{max-width:68rem;margin-inline:auto;padding-inline:1rem}
|
||||||
|
.djinnii-chart{display:block;width:100%;height:auto}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
.shop-grid .member-plan-with-art {
|
||||||
|
position: relative;
|
||||||
|
isolation: isolate;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #121928;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.shop-grid .member-plan-with-art > .member-plan-art,
|
||||||
|
.shop-grid .member-plan-with-art::before {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.shop-grid .member-plan-with-art > .member-plan-art {
|
||||||
|
display: block;
|
||||||
|
object-fit: cover;
|
||||||
|
opacity: .65;
|
||||||
|
z-index: -2;
|
||||||
|
}
|
||||||
|
.shop-grid .member-plan-with-art::before {
|
||||||
|
content: "";
|
||||||
|
background: linear-gradient(90deg, rgb(9 14 25 / .78), rgb(9 14 25 / .44));
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
.shop-grid .member-plan-with-art .member-plan-copy h2,
|
||||||
|
.shop-grid .member-plan-with-art .member-plan-copy p {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.plan-comparison{width:100%;border-collapse:collapse;text-align:left}
|
||||||
|
.plan-comparison caption{text-align:left;padding:.5rem}
|
||||||
|
.plan-comparison :is(th,td){border-bottom:1px solid currentColor;padding:.65rem;text-align:left}
|
||||||
|
After Width: | Height: | Size: 347 KiB |
@@ -0,0 +1,10 @@
|
|||||||
|
.slx-store{--store-ink:#122442;--store-paper:#fff;--store-card:#f1f3f7;color:var(--store-ink);background:var(--store-paper);max-width:76rem;margin:1.5rem auto;padding:clamp(.75rem,3vw,2rem)}
|
||||||
|
.slx-store a{color:inherit}.store-bar{display:flex;justify-content:space-between;gap:1rem;padding:.4rem 0}
|
||||||
|
.store-banner{text-align:center;background:var(--store-card);padding:1rem;margin:.5rem 0}
|
||||||
|
.store-banner h1,.store-detail h1{margin:.3rem 0}.store-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.5rem}
|
||||||
|
.store-card{background:var(--store-card);text-align:center;padding:.65rem;display:flex;flex-direction:column;align-items:center;gap:.35rem;min-width:0}
|
||||||
|
.store-card h2{font-size:1rem;margin:0;line-height:1.25}.store-stock{font-size:.85rem;margin:auto 0 0;padding-top:.35rem}.store-cover{width:100%;display:grid;place-items:center;aspect-ratio:3/4;overflow:hidden;background:#e5e9f2}.store-cover img{width:100%;height:100%;object-fit:contain}
|
||||||
|
.store-card form{width:100%;margin:0}.slx-store .store-button{display:inline-block;color:#fff;background:#092951;border:0;border-radius:.2rem;padding:.4rem .75rem;cursor:pointer;font:inherit;text-decoration:none}.store-card .store-button{width:100%}
|
||||||
|
.store-detail{display:grid;grid-template-columns:minmax(9rem,1fr) minmax(13rem,1.8fr) minmax(8rem,1fr);gap:1.5rem;align-items:start;margin:1rem 0 2rem}
|
||||||
|
.store-product-info form{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}.store-product-info input[type=number]{width:4rem}.store-price{font-size:1.35rem;font-weight:800}.store-format{padding:1rem;background:var(--store-card)}.store-format h2{font-size:1rem;margin:0}.store-section>h2{border-bottom:1px solid #092951;padding-bottom:.3rem}.store-sample details{margin:.5rem 0}.store-sample summary{cursor:pointer;font-weight:700}.store-sample img{display:block;max-width:min(100%,42rem);height:auto;margin:.5rem auto}
|
||||||
|
@media(max-width:720px){.store-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.store-detail{grid-template-columns:minmax(7rem,1fr) minmax(0,1.5fr);gap:.75rem}.store-format{grid-column:1/-1}}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const map = document.querySelector('[data-studio-map-picker]');
|
||||||
|
const pin = document.querySelector('[data-studio-map-pin]');
|
||||||
|
const x = document.getElementById('id_x');
|
||||||
|
const y = document.getElementById('id_y');
|
||||||
|
if (!map || !pin || !x || !y) return;
|
||||||
|
const refresh = () => {
|
||||||
|
pin.hidden = ![x, y].every(field => field.value !== '' && Number(field.value) >= 0 && Number(field.value) <= 100);
|
||||||
|
if (!pin.hidden) {
|
||||||
|
pin.style.left = x.value + '%';
|
||||||
|
pin.style.top = y.value + '%';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
map.addEventListener('click', event => {
|
||||||
|
const box = map.getBoundingClientRect();
|
||||||
|
const percent = (value, size) => Math.max(0, Math.min(100, 100 * value / size)).toFixed(5);
|
||||||
|
x.value = percent(event.clientX - box.left, box.width);
|
||||||
|
y.value = percent(event.clientY - box.top, box.height);
|
||||||
|
refresh();
|
||||||
|
});
|
||||||
|
x.addEventListener('input', refresh);
|
||||||
|
y.addEventListener('input', refresh);
|
||||||
|
refresh();
|
||||||
|
});
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
.slx-world-map,.slx-world-resources{position:relative;max-width:72rem;margin:2rem auto;padding:1rem;box-sizing:border-box}
|
||||||
|
.slx-world-map h2{margin:.25rem 0}
|
||||||
|
.slx-world-stage{position:relative;isolation:isolate}
|
||||||
|
.slx-world-stage img{display:block;width:100%;height:auto;border:0;filter:none;opacity:1}
|
||||||
|
.slx-world-marker{position:absolute;left:var(--x);top:var(--y);transform:translate(-50%,-50%);width:clamp(25px,4vw,44px);aspect-ratio:1;display:grid;place-items:center;border-radius:50%;color:#ffe141}
|
||||||
|
.slx-world-marker::before,.slx-world-marker::after{content:"";grid-area:1/1;border:2px solid currentColor;border-radius:50%;width:48%;aspect-ratio:1;box-shadow:0 0 4px #161009;pointer-events:none}
|
||||||
|
.slx-world-marker::after{animation:slx-map-scan 2.4s ease-out infinite}
|
||||||
|
.slx-world-marker:nth-of-type(even)::after{animation-delay:-1.2s}
|
||||||
|
.slx-world-marker:is(:hover,:focus-visible,[aria-current])::before{width:75%;border-width:3px}
|
||||||
|
.slx-world-marker:focus-visible{outline:2px solid currentColor;outline-offset:1px}
|
||||||
|
.slx-world-directory{display:flex;flex-wrap:wrap;gap:.4rem .85rem;list-style:none;margin:1rem 0 0;padding:0}
|
||||||
|
.slx-world-directory a{display:inline-block;padding:.3rem 0;text-decoration:underline}
|
||||||
|
.slx-world-resources{display:grid;gap:.65rem;grid-template-columns:repeat(auto-fit,minmax(min(100%,12rem),1fr))}
|
||||||
|
[id^="map-"]{scroll-margin-top:6rem}
|
||||||
|
[id^="map-"]:target{outline:2px solid #dfb900;outline-offset:3px}
|
||||||
|
@keyframes slx-map-scan{from{transform:scale(1);opacity:.9}to{transform:scale(1.8);opacity:0}}
|
||||||
|
@media(prefers-reduced-motion:reduce){.slx-world-marker::after{animation:none;display:none}}
|
||||||
|
.slx-world-stage{container-type:inline-size}
|
||||||
|
.slx-world-marker .slx-map-label{position:absolute;top:calc(50% + clamp(7px,1.1cqw,13px));left:50%;transform:translateX(-50%);display:grid;justify-items:center;gap:.2rem;width:max-content;max-width:21cqw;font-size:clamp(4px,1.05cqw,12px);padding:.2rem .3rem;background:#101522ed;border-radius:.3em;line-height:1}
|
||||||
|
.slx-world-marker[data-map-destination="cart"] .slx-map-label{left:calc(50% + 2.8cqw);transform:translateX(-100%)}
|
||||||
|
.slx-world-marker[data-map-destination="start"] .slx-map-label{left:calc(50% - 8.2cqw);transform:none}
|
||||||
|
.djinn-sol-word{display:inline-flex;align-items:center;gap:.11em}
|
||||||
|
.slx-world-stage img.djinn-sol-glyph{width:.62em;height:.81em;object-fit:contain;image-rendering:pixelated}
|
||||||
|
|
||||||
|
.slx-world-marker .djinn-sol-spelling{display:flex;gap:.28em;justify-content:center;flex-wrap:wrap}
|
||||||
|
.slx-map-english{color:#fff;font-size:clamp(9px,1.25cqw,14px);font-weight:700;text-align:center;line-height:1.1;text-wrap:balance}
|
||||||
|
.slx-world-marker:is(:hover,:focus-visible){z-index:2}
|
||||||
|
.slx-world-marker[data-map-destination="start"] .slx-map-label{left:calc(50% - 8.2cqw)}
|
||||||
|
@container (max-width: 540px){
|
||||||
|
.slx-world-marker[data-map-destination="newsletter"] .slx-map-label{left:calc(50% - 10cqw);transform:none}
|
||||||
|
.slx-world-marker[data-map-destination="library"] .slx-map-label{left:calc(50% + 6cqw);transform:none}
|
||||||
|
}
|
||||||
|
body.map-landing{margin:0;min-height:100svh;display:flex;flex-direction:column;background:#090e1a}
|
||||||
|
.map-landing .slx-page-backdrop{display:none}
|
||||||
|
.map-landing .site-header{flex:none}
|
||||||
|
.map-landing-main{flex:1;display:flex;flex-direction:column;min-width:0}
|
||||||
|
.map-landing .slx-world-map{flex:1;display:flex;flex-direction:column;width:100%;max-width:none;margin:0;padding:0;color:#f5f7ff}
|
||||||
|
.slx-map-controls{display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:.45rem 1rem}
|
||||||
|
.slx-map-controls h1{font-size:clamp(1rem,3vw,1.6rem);margin:0;color:inherit}
|
||||||
|
.slx-map-controls button,.slx-map-list summary{color:#f5f7ff;background:#192339;border:1px solid #61708b;border-radius:.35rem;padding:.3rem .6rem;cursor:pointer}
|
||||||
|
.slx-map-controls button[aria-pressed="false"]{opacity:.72}
|
||||||
|
.slx-map-viewport{flex:1;display:grid;place-items:center;min-width:0;container-type:inline-size}
|
||||||
|
.map-landing .slx-world-stage{width:min(100cqw,140svh);margin:auto}
|
||||||
|
.slx-map-list{padding:.35rem 1rem}
|
||||||
|
.slx-map-list summary{width:max-content}
|
||||||
|
.slx-map-list a{color:#fff}
|
||||||
|
@media(min-aspect-ratio: 4/3){.map-landing .slx-world-stage{width:min(100cqw,calc((100svh - 9rem) * 1.7504))}}
|
||||||
|
body.map-landing{height:100svh}
|
||||||
|
.map-landing .slx-map-viewport{container-type:size;min-height:10rem}
|
||||||
|
.map-landing .slx-world-stage{width:min(100cqw,175.04cqh)}
|
||||||
|
.map-landing .slx-map-list[open] .slx-world-directory{max-height:26svh;overflow:auto}
|
||||||
|
.slx-world-stage .slx-map-avatar{width:auto;height:clamp(39px,7cqw,77px);position:absolute;z-index:5;transform:translate(-50%,-94%);pointer-events:none;filter:drop-shadow(0 0 5px #b3eaff) drop-shadow(0 0 10px #3387ff);image-rendering:pixelated}
|
||||||
|
.slx-world-stage .slx-map-avatar[hidden]{display:none}
|
||||||
|
.slx-world-stage.has-avatar-pointer,.slx-world-stage.has-avatar-pointer .slx-world-marker{cursor:none}
|
||||||
|
.slx-world-marker{background:radial-gradient(circle at center,#e22118 0 3px,transparent 4px)}
|
||||||
|
.countdown-showcase .slx-world-map{position:relative;isolation:isolate;color:#f5f7ff;background:#090e1a;border-radius:1rem}
|
||||||
|
|
||||||
|
/* The embedded map takes its size from its image, not a fixed viewport. */
|
||||||
|
.countdown-showcase .slx-map-viewport{display:block;width:100%;container-type:normal}
|
||||||
|
.countdown-showcase .slx-world-stage{width:100%;aspect-ratio:2048 / 1170}
|
||||||
|
.countdown-showcase .slx-world-stage > img:first-child{width:100%;height:auto}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
(() => {
|
||||||
|
const map = document.querySelector('.slx-world-map');
|
||||||
|
const Audio = window.AudioContext || window.webkitAudioContext;
|
||||||
|
if (!map) return;
|
||||||
|
const stage = map.querySelector('.slx-world-stage');
|
||||||
|
const standing = stage.querySelector('.slx-map-avatar:not(.slx-map-avatar-selected)');
|
||||||
|
const selected = stage.querySelector('.slx-map-avatar-selected');
|
||||||
|
if (!standing || !selected) return;
|
||||||
|
let landed = false;
|
||||||
|
const move = (x,y) => {
|
||||||
|
const avatar = landed ? selected : standing;
|
||||||
|
avatar.style.left = x;
|
||||||
|
avatar.style.top = y;
|
||||||
|
avatar.hidden = false;
|
||||||
|
};
|
||||||
|
stage.addEventListener('pointermove', event => {
|
||||||
|
if (landed || event.pointerType === 'touch') return;
|
||||||
|
const bounds = stage.getBoundingClientRect();
|
||||||
|
move(`${event.clientX-bounds.left}px`, `${event.clientY-bounds.top}px`);
|
||||||
|
stage.classList.add('has-avatar-pointer');
|
||||||
|
});
|
||||||
|
stage.addEventListener('pointerleave', () => {
|
||||||
|
standing.hidden = true;
|
||||||
|
stage.classList.remove('has-avatar-pointer');
|
||||||
|
});
|
||||||
|
addEventListener('pageshow', () => { landed = false; standing.hidden = selected.hidden = true; stage.classList.remove('has-avatar-pointer'); });
|
||||||
|
|
||||||
|
const toggle = map.querySelector('[data-map-sound]');
|
||||||
|
let enabled = true;
|
||||||
|
try { enabled = localStorage.getItem('slx-map-sound') !== 'off'; } catch {}
|
||||||
|
const reflect = () => toggle.setAttribute('aria-pressed', String(enabled));
|
||||||
|
reflect();
|
||||||
|
toggle.hidden = !Audio;
|
||||||
|
toggle.addEventListener('click', () => {
|
||||||
|
enabled = !enabled;
|
||||||
|
reflect();
|
||||||
|
try { localStorage.setItem('slx-map-sound', enabled ? 'on' : 'off'); } catch {}
|
||||||
|
});
|
||||||
|
let audio, navigating = false;
|
||||||
|
map.addEventListener('click', event => {
|
||||||
|
const link = event.target.closest('.slx-world-marker');
|
||||||
|
if (!link || event.defaultPrevented || event.button !== 0 ||
|
||||||
|
event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
||||||
|
event.preventDefault();
|
||||||
|
if (navigating) return;
|
||||||
|
navigating = true;
|
||||||
|
landed = true;
|
||||||
|
standing.hidden = true;
|
||||||
|
move(link.style.getPropertyValue('--x'), link.style.getPropertyValue('--y'));
|
||||||
|
let timeout;
|
||||||
|
const go = () => {
|
||||||
|
if (!navigating) return;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
navigating = false;
|
||||||
|
location.assign(link.href);
|
||||||
|
};
|
||||||
|
timeout = setTimeout(go, enabled && Audio ? 420 : 280);
|
||||||
|
if (!enabled || !Audio) return;
|
||||||
|
try {
|
||||||
|
audio ||= new Audio();
|
||||||
|
audio.resume().then(() => {
|
||||||
|
if (!navigating) return;
|
||||||
|
const now = audio.currentTime;
|
||||||
|
const tone = audio.createOscillator();
|
||||||
|
const gain = audio.createGain();
|
||||||
|
tone.frequency.setValueAtTime(1090, now);
|
||||||
|
tone.frequency.exponentialRampToValueAtTime(510, now + .12);
|
||||||
|
gain.gain.setValueAtTime(.001, now);
|
||||||
|
gain.gain.exponentialRampToValueAtTime(.17, now + .014);
|
||||||
|
gain.gain.exponentialRampToValueAtTime(.001, now + .14);
|
||||||
|
tone.connect(gain).connect(audio.destination);
|
||||||
|
tone.onended = () => setTimeout(go, 130);
|
||||||
|
tone.start(now);
|
||||||
|
tone.stop(now + .15);
|
||||||
|
}).catch(() => {});
|
||||||
|
} catch { /* The navigation timer still runs without audio. */ }
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{% extends "admin/change_form.html" %}
|
||||||
|
{% load static %}
|
||||||
|
{% block after_field_sets %}
|
||||||
|
<h2>Place the marker</h2>
|
||||||
|
<p>Click or tap the map to set the position, or enter X and Y above as percentages.</p>
|
||||||
|
<div style="position:relative;max-width:900px">
|
||||||
|
<img data-studio-map-picker src="{% static 'solterra-map.jpg' %}" width="2048" height="1170" alt="Sol’Terra map" style="display:block;width:100%;height:auto;cursor:crosshair">
|
||||||
|
<span data-studio-map-pin aria-hidden="true" hidden style="position:absolute;width:16px;height:16px;border:3px solid #ffde31;border-radius:50%;background:#ad1414;transform:translate(-50%,-50%);pointer-events:none"></span>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="{% url 'admin:index' %}">Studio</a> › Homepage Countdown</div>{% endblock %}
|
{% block breadcrumbs %}<div class="breadcrumbs"><a href="{% url 'admin:index' %}">Studio</a> › Homepage Countdown</div>{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="studio-content-panel studio-timer">
|
<section class="studio-content-panel studio-timer">
|
||||||
<p>Show the timer beneath your hero or switch to a dedicated cover landing page. Both display your released chapters first. This does not change the separate Coming Soon page or schedule any chapters.</p>
|
<p>Enable the countdown cover landing and upload a cover to combine it with the Sol’Terra map. Choose whether the map appears above or below the countdown content.</p>
|
||||||
<form method="post" enctype="multipart/form-data">{% csrf_token %}
|
<form method="post" enctype="multipart/form-data">{% csrf_token %}
|
||||||
{{ form.non_field_errors }}
|
{{ form.non_field_errors }}
|
||||||
{% for hidden in form.hidden_fields %}{{ hidden }}{% endfor %}
|
{% for hidden in form.hidden_fields %}{{ hidden }}{% endfor %}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<section class="traffic-panel" aria-labelledby="traffic-map-heading">
|
<section class="traffic-panel" aria-labelledby="traffic-map-heading">
|
||||||
<h2 id="traffic-map-heading">Where readers are</h2>
|
<h2 id="traffic-map-heading">Where readers are</h2>
|
||||||
{% if not geo_configured %}<p>Connect a GeoLite Country database to locate new visits by country. Earlier and unresolved visits appear as Unknown.</p>{% endif %}
|
{% if not geo_configured %}<p>Connect a GeoLite2 City database to locate new visits by country. Earlier and unresolved visits appear as Unknown.</p>{% endif %}
|
||||||
<div data-world-map data-map-url="{% static 'world-countries.json' %}"></div>
|
<div data-world-map data-map-url="{% static 'world-countries.json' %}"></div>
|
||||||
<p data-map-status aria-live="polite">Select a highlighted country to see its pageviews.</p>
|
<p data-map-status aria-live="polite">Select a highlighted country to see its pageviews.</p>
|
||||||
{{ countries|json_script:"country-traffic" }}
|
{{ countries|json_script:"country-traffic" }}
|
||||||
@@ -24,6 +24,34 @@
|
|||||||
</tbody></table><small>Map boundaries: Natural Earth. Location is approximate.</small>
|
</tbody></table><small>Map boundaries: Natural Earth. Location is approximate.</small>
|
||||||
</section>
|
</section>
|
||||||
<div class="traffic-grid">
|
<div class="traffic-grid">
|
||||||
|
<section class="traffic-panel">
|
||||||
|
<h2>Regions and states</h2>
|
||||||
|
<table class="traffic-table">
|
||||||
|
<thead><tr><th scope="col">Country</th><th scope="col">Region / State</th><th scope="col">Views</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
{% for row in regions %}
|
||||||
|
<tr><td>{{ row.country|default:'Unknown' }}</td><td>{{ row.region|default:'Unknown' }}</td><td>{{ row.views }}</td></tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr><td colspan="3">No region data available yet.</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
<section class="traffic-panel">
|
||||||
|
<h2>Cities</h2>
|
||||||
|
<table class="traffic-table">
|
||||||
|
<thead><tr><th scope="col">City</th><th scope="col">Region</th><th scope="col">Country</th><th scope="col">Views</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
{% for row in cities %}
|
||||||
|
<tr><td>{{ row.city|default:'Unknown' }}</td><td>{{ row.region|default:'Unknown' }}</td><td>{{ row.country|default:'Unknown' }}</td><td>{{ row.views }}</td></tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr><td colspan="4">No city data available yet.</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="traffic-grid">
|
||||||
<section class="traffic-panel"><h2>Traffic sources</h2><p>Referring origins only. Direct visits and missing referrers are grouped together.</p>
|
<section class="traffic-panel"><h2>Traffic sources</h2><p>Referring origins only. Direct visits and missing referrers are grouped together.</p>
|
||||||
<table class="traffic-table"><thead><tr><th scope="col">Source</th><th scope="col">Views</th></tr></thead><tbody>
|
<table class="traffic-table"><thead><tr><th scope="col">Source</th><th scope="col">Views</th></tr></thead><tbody>
|
||||||
{% for row in sources %}<tr><td>{% if row.source == 'internal' %}SLX site{% elif row.source %}<a href="{{ row.source }}" rel="noreferrer noopener" target="_blank">{{ row.source }}</a>{% else %}Direct / unavailable{% endif %}</td><td>{{ row.views }}</td></tr>{% empty %}<tr><td colspan="2">No sources in this range yet.</td></tr>{% endfor %}
|
{% for row in sources %}<tr><td>{% if row.source == 'internal' %}SLX site{% elif row.source %}<a href="{{ row.source }}" rel="noreferrer noopener" target="_blank">{{ row.source }}</a>{% else %}Direct / unavailable{% endif %}</td><td>{{ row.views }}</td></tr>{% empty %}<tr><td colspan="2">No sources in this range yet.</td></tr>{% endfor %}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{% load static %}
|
||||||
|
<link rel="stylesheet" href="{% static 'manaa-reader.css' %}">
|
||||||
|
<dialog class="chapter-finish" data-archive-reminder aria-labelledby="archive-reminder-title">
|
||||||
|
<div class="chapter-finish-card"><div>
|
||||||
|
<p class="kicker">Slump X Land Monthly</p>
|
||||||
|
<h2 id="archive-reminder-title">Read the entire archive</h2>
|
||||||
|
<p>The newest three chapters are free to read in full. Create an account and join Slump X Land Monthly to unlock every chapter, new and old, as they’re published.</p>
|
||||||
|
<div class="actions">
|
||||||
|
<a class="cta" href="{% url 'fan-signup' %}">Create an account</a>
|
||||||
|
<a class="cta secondary" href="{% url 'membership' %}">See monthly plans</a>
|
||||||
|
<a href="{% url 'fan-login' %}">Sign in</a>
|
||||||
|
<form method="dialog"><button class="fan-button" autofocus>Keep browsing</button></form>
|
||||||
|
</div></div></div>
|
||||||
|
</dialog>
|
||||||
|
<script defer src="{% static 'archive-reminder.js' %}"></script>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{% load static slx_brand share_meta %}<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><title>{% block title %}SLUMP X LAND · Official{% endblock %}</title>{% share_metadata %}{% block meta %}{% endblock %}<link rel="stylesheet" href="{% static 'brand.css' %}"><link rel="stylesheet" href="{% static 'site.css' %}"><script defer src="{% static 'countdown.js' %}"></script>{% block scripts %}{% endblock %}<link rel="stylesheet" href="{% static 'site-theme.css' %}">{% if floating_top_art or floating_bottom_art %}<script defer src="{% static 'floating-artwork.js' %}"></script>{% endif %}{% if newsletter_popup_form %}<script defer src="{% static 'newsletter-popup.js' %}"></script>{% endif %}</head><body{% if page_backdrop %} class="has-page-background"{% endif %}{% if site_theme_vars or page_backdrop %} style="{{ site_theme_vars }}{% if page_backdrop %};--slx-page-color:{{ page_backdrop.color }};--slx-page-tint:{{ page_tint }}%{% endif %}"{% endif %}>
|
{% load static slx_brand share_meta %}<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><title>{% block title %}SLUMP X LAND · Official{% endblock %}</title>{% share_metadata %}{% block meta %}{% endblock %}<link rel="stylesheet" href="{% static 'brand.css' %}"><link rel="stylesheet" href="{% static 'site.css' %}"><script defer src="{% static 'countdown.js' %}"></script><link rel="stylesheet" href="{% static 'djinnii.css' %}">{% block scripts %}{% endblock %}<link rel="stylesheet" href="{% static 'site-theme.css' %}">{% if floating_top_art or floating_bottom_art %}<script defer src="{% static 'floating-artwork.js' %}"></script>{% endif %}{% if newsletter_popup_form %}<script defer src="{% static 'newsletter-popup.js' %}"></script>{% endif %}</head><body class="{% if page_backdrop %}has-page-background{% endif %}{% block body_class %}{% endblock %}"{% if site_theme_vars or page_backdrop %} style="{{ site_theme_vars }}{% if page_backdrop %};--slx-page-color:{{ page_backdrop.color }};--slx-page-tint:{{ page_tint }}%{% endif %}"{% endif %}>
|
||||||
{% if page_backdrop %}
|
{% if page_backdrop %}
|
||||||
<div class="slx-page-backdrop" aria-hidden="true">
|
<div class="slx-page-backdrop" aria-hidden="true">
|
||||||
{% if page_backdrop.art %}<img src="{{ page_backdrop.art.url }}" alt="" decoding="async"><span></span>{% endif %}
|
{% if page_backdrop.art %}<img src="{{ page_backdrop.art.url }}" alt="" decoding="async"><span></span>{% endif %}
|
||||||
@@ -11,14 +11,15 @@
|
|||||||
{% for tab in public_menu %}
|
{% for tab in public_menu %}
|
||||||
<a href="{{ tab.url }}"{% if tab.active %} aria-current="page"{% endif %}{% if tab.key == 'notices' %} aria-label="{{ tab.label }}{% if fan_unread %} ({{ fan_unread }} unread){% endif %}"{% endif %}>{% if tab.key == 'notices' %}♢{% if fan_unread %} <span class="notice-count">{{ fan_unread }}</span>{% endif %}{% else %}{{ tab.label }}{% endif %}</a>
|
<a href="{{ tab.url }}"{% if tab.active %} aria-current="page"{% endif %}{% if tab.key == 'notices' %} aria-label="{{ tab.label }}{% if fan_unread %} ({{ fan_unread }} unread){% endif %}"{% endif %}>{% if tab.key == 'notices' %}♢{% if fan_unread %} <span class="notice-count">{{ fan_unread }}</span>{% endif %}{% else %}{{ tab.label }}{% endif %}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<a href="{% url 'djinnii' %}"{% if request.resolver_match.url_name == 'djinnii' %} aria-current="page"{% endif %}>Djinnii</a>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block floating_top %}{% include 'floating-artwork.html' with band=floating_top_art position='top' only %}{% endblock %}
|
{% block floating_top %}{% include 'floating-artwork.html' with band=floating_top_art position='top' only %}{% endblock %}
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
{% include 'floating-artwork.html' with band=floating_bottom_art position='bottom' only %}
|
{% block floating_bottom %}{% include 'floating-artwork.html' with band=floating_bottom_art position='bottom' only %}{% endblock %}
|
||||||
{% block footer %}<footer>{{ "SLUMP X LAND"|slx_brand }} <span class="footer-separator">·</span> The official ManaA site{% if newsletter_signup_open %} <span class="footer-separator">·</span> <a href="{% url 'newsletter-signup' %}" data-newsletter-open>Newsletter</a>{% endif %}</footer>{% endblock %}
|
{% block footer %}<footer>{{ "SLUMP X LAND"|slx_brand }} <span class="footer-separator">·</span> The official ManaA site{% if newsletter_signup_open %} <span class="footer-separator">·</span> <a href="{% url 'newsletter-signup' %}" data-newsletter-open>Newsletter</a>{% endif %}</footer>{% endblock %}
|
||||||
{% if newsletter_popup_form %}{% include 'newsletter/popup.html' %}
|
{% block popups %}{% if newsletter_popup_form %}{% include 'newsletter/popup.html' %}
|
||||||
{% if settings.membership_popup and request.resolver_match.url_name == 'home' %}
|
{% if settings.membership_popup and request.resolver_match.url_name == 'home' %}
|
||||||
<dialog class="newsletter-popup" data-membership-popup aria-labelledby="membership-popup-title">
|
<dialog class="newsletter-popup" data-membership-popup aria-labelledby="membership-popup-title">
|
||||||
<div class="newsletter-popup-hero"><form method="dialog"><button class="newsletter-popup-close" autofocus aria-label="Close membership">×</button></form>
|
<div class="newsletter-popup-hero"><form method="dialog"><button class="newsletter-popup-close" autofocus aria-label="Close membership">×</button></form>
|
||||||
@@ -27,5 +28,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="newsletter-popup-body"><a class="read-manaa" href="{% url 'membership' %}">Explore membership →</a></div>
|
<div class="newsletter-popup-body"><a class="read-manaa" href="{% url 'membership' %}">Explore membership →</a></div>
|
||||||
</dialog>
|
</dialog>
|
||||||
{% endif %}{% endif %}
|
{% endif %}{% endif %}{% endblock %}
|
||||||
|
{% if not user.is_authenticated and request.resolver_match.url_name == 'chapters' or not user.is_authenticated and request.resolver_match.url_name == 'chapter' %}
|
||||||
|
{% include 'archive-reminder.html' %}
|
||||||
|
{% endif %}
|
||||||
</body></html>
|
</body></html>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{% if chapter.price_usd >= 0.50 and stripe_enabled %}
|
||||||
|
{% if user.is_authenticated %}<form method="post" action="{% url 'buy-chapter' chapter.number %}">{% csrf_token %}<button type="submit" class="cta">Buy digital chapter · ${{ chapter.price_usd|floatformat:2 }}</button></form>
|
||||||
|
{% else %}<a class="cta" href="{% url 'fan-login' %}?next={% url 'chapter' chapter.number %}">Sign in to buy · ${{ chapter.price_usd|floatformat:2 }}</a>{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if physical_edition %}<a class="cta secondary" href="{% url 'shop-product' physical_edition.slug %}">Buy the physical book</a>{% endif %}
|
||||||
|
<a class="cta secondary" href="{% url 'membership' %}">Join Slump X Land’s Monthly Fan Club</a>
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
{% load slx_brand %}
|
{% load slx_brand %}
|
||||||
<div class="cards">{% for chapter in chapters %}<article class="card chapter-card"><a class="card-main" href="{% url 'chapter' chapter.number %}">{% if chapter.cover %}<img src="{{ chapter.cover.url }}" alt="" loading="lazy">{% endif %}<div><span class="kicker">#{{ chapter.number|stringformat:"03d" }}</span><h3>{{ chapter.title|slx_brand }}</h3><time datetime="{{ chapter.publish_at|date:'c' }}">{{ chapter.publish_at|date:"M j, Y" }}</time> {% if chapter.public_views != None %}{% include "view-eye.html" with views=chapter.public_views %}{% endif %}</div></a><div class="card-foot"><a href="{% url 'chapter-discussion' chapter.number %}#discussion">Fan discussion →</a></div></article>{% empty %}<p>{{ empty_text|default:"Chapters will appear here when they’re published." }}</p>{% endfor %}</div>
|
<div class="cards">{% for chapter in chapters %}<article class="card chapter-card"><a class="card-main" href="{% url 'chapter' chapter.number %}">{% if chapter.search_cover %}<img src="{{ chapter.search_cover }}" alt="" loading="lazy">{% elif chapter.cover %}<img src="{{ chapter.cover.url }}" alt="" loading="lazy">{% endif %}<div><span class="kicker">#{{ chapter.number|stringformat:"03d" }}</span><h3>{{ chapter.title|slx_brand }}</h3>{% if show_archive_status %}<span class="badge">{% if chapter.pk in rolling_free_ids %}Free to read{% else %}Archive{% endif %}</span>{% endif %}<time datetime="{{ chapter.publish_at|date:'c' }}">{{ chapter.publish_at|date:"M j, Y" }}</time> {% if chapter.public_views != None %}{% include "view-eye.html" with views=chapter.public_views %}{% endif %}</div></a><div class="card-foot"><a href="{% url 'chapter-discussion' chapter.number %}#discussion">Fan discussion →</a></div></article>{% empty %}<p>{{ empty_text|default:"Chapters will appear here when they’re published." }}</p>{% endfor %}</div>
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
{% else %}<a class="cta secondary" href="{% url 'chapters' %}">Chapter archive</a>{% endif %}
|
{% else %}<a class="cta secondary" href="{% url 'chapters' %}">Chapter archive</a>{% endif %}
|
||||||
<form method="dialog"><button class="fan-button" type="submit">Back to page</button></form>
|
<form method="dialog"><button class="fan-button" type="submit">Back to page</button></form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
@@ -2,18 +2,12 @@
|
|||||||
{% block title %}{{ chapter.title }} · SLUMP X LAND{% endblock %}
|
{% block title %}{{ chapter.title }} · SLUMP X LAND{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main class="section article theme-shop">
|
<main class="section article theme-shop">
|
||||||
<p class="kicker">Chapter {{ chapter.number }} · Paid chapter</p><h1>{{ chapter.title|slx_brand }}</h1>
|
<p class="kicker">#{{ chapter.number|stringformat:"03d" }} · Rolling archive</p>
|
||||||
|
<h1>{{ chapter.title|slx_brand }}</h1>
|
||||||
{% if chapter.cover %}<img class="book-cover" src="{{ chapter.cover.url }}" alt="">{% endif %}
|
{% if chapter.cover %}<img class="book-cover" src="{{ chapter.cover.url }}" alt="">{% endif %}
|
||||||
{% if chapter.summary %}<p>{{ chapter.summary|slx_brand }}</p>{% endif %}
|
{% if chapter.summary %}<p>{{ chapter.summary|slx_brand }}</p>{% endif %}
|
||||||
<p><strong>${{ chapter.price_usd|floatformat:2 }} USD</strong> · One-time purchase</p>
|
<p>The newest three chapters are free. Sign in with an active Slump X Land Monthly membership to read the full archive.</p>
|
||||||
{% if paypal_ready %}
|
<div class="actions">{% include 'chapter-access-actions.html' %}{% if not user.is_authenticated %}<a class="cta secondary" href="{% url 'fan-signup' %}">Create an account</a><a href="{% url 'fan-login' %}?next={% url 'chapter' chapter.number %}">Sign in</a>{% endif %}</div>
|
||||||
{% if user.is_authenticated %}
|
<p><a href="{% url 'chapters' %}">See the latest free chapters →</a></p>
|
||||||
<form method="post" action="{% url 'paypal-start' chapter.number %}">{% csrf_token %}
|
|
||||||
<button class="cta" type="submit">Continue to PayPal →</button></form>
|
|
||||||
<p>PayPal will show the payment methods available to you.</p>
|
|
||||||
{% else %}<a class="cta" href="{% url 'fan-login' %}?next={% url 'chapter' chapter.number %}">Sign in to buy</a>
|
|
||||||
<p>New to SLX? <a href="{% url 'fan-signup' %}">Create a reader account</a>.</p>{% endif %}
|
|
||||||
{% else %}<p>Online checkout is currently unavailable.</p>{% endif %}
|
|
||||||
<p><a href="{% url 'chapter-discussion' chapter.number %}">Fan discussion</a> · <a href="{% url 'chapters' %}">All chapters</a></p>
|
|
||||||
</main>
|
</main>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% block title %}Collector recognition · SLUMP X LAND{% endblock %}
|
||||||
|
{% block content %}<main class="section"><h1>Collector recognition</h1><p>After a paid shop order, you can choose to appear on the public thank-you list. Leave the display name blank to use your username.</p>
|
||||||
|
<form method="post" enctype="multipart/form-data">{% csrf_token %}{{ form.as_p }}<button class="cta">Save preferences</button></form></main>{% endblock %}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<section class="section" aria-label="Collector appreciation"><h2>Thank You To Our Collectors, Investors & Readers</h2>
|
||||||
|
{% if collectors %}<ul style="display:flex;flex-wrap:wrap;gap:1rem;list-style:none;padding:0">
|
||||||
|
{% for collector in collectors %}<li class="card" style="display:flex;align-items:center;gap:.55rem;padding:.6rem">
|
||||||
|
{% if collector.photo %}<img src="{{ collector.photo.url }}" alt="" loading="lazy" width="48" height="48" style="width:48px;height:48px;border-radius:50%;object-fit:cover">{% else %}<span aria-hidden="true">◆</span>{% endif %}
|
||||||
|
<strong>{{ collector.display_name|default:collector.user.username }}</strong></li>{% endfor %}</ul>{% endif %}
|
||||||
|
{% if user.is_authenticated %}<p><a href="{% url 'collector-preferences' %}">Manage your collector recognition →</a></p>{% endif %}</section>
|
||||||
@@ -22,5 +22,5 @@
|
|||||||
<article class="card"><div><h3><span class="rank-badge rank-seat">Sol Seat</span></h3><p>{% if settings.seat_threshold %}${{ settings.seat_threshold|floatformat:2 }} in verified support, or designated by Studio.{% else %}Designated by Studio.{% endif %}</p></div></article>
|
<article class="card"><div><h3><span class="rank-badge rank-seat">Sol Seat</span></h3><p>{% if settings.seat_threshold %}${{ settings.seat_threshold|floatformat:2 }} in verified support, or designated by Studio.{% else %}Designated by Studio.{% endif %}</p></div></article>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
{% include 'collector-thanks.html' %}</main>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
{% load slx_brand %}
|
{% load slx_brand %}
|
||||||
{% if countdown_chapters %}
|
{% if countdown_chapters %}
|
||||||
<section class="chapter-shelf" data-chapter-shelf aria-labelledby="chapter-shelf-title">
|
<section{% if request.resolver_match.url_name == "home" %} id="map-chapters" tabindex="-1"{% endif %} class="chapter-shelf" data-chapter-shelf aria-labelledby="chapter-shelf-title">
|
||||||
<div class="chapter-shelf-header">
|
<div class="chapter-shelf-header">
|
||||||
<div><p class="kicker">{{ "SLUMP X LAND"|slx_brand }}</p><h2 id="chapter-shelf-title">Current chapters</h2></div>
|
<div><p class="kicker">{{ "SLUMP X LAND"|slx_brand }}</p><h2 id="chapter-shelf-title">Latest Chapters</h2></div>
|
||||||
<div class="chapter-shelf-actions">
|
<div class="chapter-shelf-actions">
|
||||||
<a href="{% url 'chapters' %}">Chapter archive</a>
|
<a href="{% url 'chapters' %}">Chapter archive</a>
|
||||||
<div class="chapter-shelf-controls" data-shelf-controls hidden>
|
<div class="chapter-shelf-controls" data-shelf-controls hidden>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load static slx_brand %}
|
{% load static slx_brand %}
|
||||||
{% block scripts %}<script defer src="{% static 'chapter-shelf.js' %}"></script>{% endblock %}
|
{% block scripts %}<link rel="stylesheet" href="{% static 'countdown-layout.css' %}">{% if with_world_map %}<link rel="stylesheet" href="{% static 'world-map.css' %}"><script defer src="{% static 'world-map.js' %}"></script>{% endif %}<script defer src="{% static 'chapter-shelf.js' %}"></script>{% endblock %}
|
||||||
{% block title %}Coming soon · SLUMP X LAND{% endblock %}
|
{% block title %}Coming soon · SLUMP X LAND{% endblock %}
|
||||||
{% block header %}{% endblock %}
|
{% block header %}{% if with_world_map %}{{ block.super }}{% endif %}{% endblock %}
|
||||||
{% block footer %}{% endblock %}
|
{% block footer %}{% endblock %}
|
||||||
{% block floating_top %}{% endblock %}
|
{% block floating_top %}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -13,9 +13,11 @@
|
|||||||
<div class="showcase-tint" style="background-color:{{ countdown_tint }};opacity:{{ countdown_tint_strength }}%"></div>
|
<div class="showcase-tint" style="background-color:{{ countdown_tint }};opacity:{{ countdown_tint_strength }}%"></div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if with_world_map and settings.countdown_map_position == 'above' %}{% include 'world-map.html' %}{% endif %}
|
||||||
{% include 'countdown-chapter-shelf.html' %}
|
{% include 'countdown-chapter-shelf.html' %}
|
||||||
|
|
||||||
{% include 'floating-artwork.html' with band=floating_top_art position='top' only %}
|
{% include 'floating-artwork.html' with band=floating_top_art position='top' only %}
|
||||||
<section class="showcase-release" aria-label="Release countdown">
|
<section id="map-start" tabindex="-1" class="showcase-release compact-release" aria-label="Release countdown">
|
||||||
<div class="release-stage">
|
<div class="release-stage">
|
||||||
<div class="release-hover">
|
<div class="release-hover">
|
||||||
<img class="release-cover" src="{{ settings.homepage_countdown_cover.url }}" alt="Chapter cover">
|
<img class="release-cover" src="{{ settings.homepage_countdown_cover.url }}" alt="Chapter cover">
|
||||||
@@ -23,18 +25,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="release-copy">
|
<div class="release-copy">
|
||||||
<div class="release-timer-panel">
|
<div id="map-release" tabindex="-1" class="release-timer-panel">
|
||||||
<p class="kicker">{{ "SLUMP X LAND"|slx_brand }} · UPCOMING RELEASE</p>
|
<p class="kicker">{{ "SLUMP X LAND"|slx_brand }} · UPCOMING RELEASE</p>
|
||||||
<h1>{{ settings.homepage_countdown_title|default:"Next release"|slx_brand }}</h1>
|
<h1>{{ settings.homepage_countdown_title|default:"Next release"|slx_brand }}</h1>
|
||||||
<p class="release-clock"><span class="countdown ticker" data-output aria-hidden="true"></span>
|
<p class="release-clock"><span class="countdown ticker" data-output aria-hidden="true"></span>
|
||||||
<time datetime="{{ settings.homepage_countdown_at|date:'c' }}" data-countdown data-reload-home data-server-now="{{ countdown_now|date:'c' }}">{{ settings.homepage_countdown_at|date:'M j, Y · g:i a T' }}</time></p>
|
<time datetime="{{ settings.homepage_countdown_at|date:'c' }}" data-countdown data-reload-home data-server-now="{{ countdown_now|date:'c' }}">{{ settings.homepage_countdown_at|date:'M j, Y · g:i a T' }}</time></p>
|
||||||
{% include 'countdown-progress.html' %}
|
{% include 'countdown-progress.html' %}
|
||||||
</div>
|
</div>
|
||||||
{% include 'author-comment.html' with comment=settings.homepage_countdown_note %}
|
|
||||||
{% include 'countdown-social.html' %}
|
{% include 'countdown-social.html' %}
|
||||||
{% if settings.homepage_countdown_cta_url %}<a class="cta release-cta" href="{{ settings.homepage_countdown_cta_url }}">{{ settings.homepage_countdown_cta_label|default:"Join the mailing list" }} →</a>{% elif newsletter_signup_open %}<a class="cta release-cta" href="{% url 'newsletter-signup' %}" data-newsletter-open>Join the newsletter</a>{% endif %}
|
{% if settings.homepage_countdown_cta_url %}<a class="cta release-cta" href="{{ settings.homepage_countdown_cta_url }}">{{ settings.homepage_countdown_cta_label|default:"Join the mailing list" }} →</a>{% elif newsletter_signup_open %}<a class="cta release-cta" href="{% url 'newsletter-signup' %}" data-newsletter-open>Join the newsletter</a>{% endif %}
|
||||||
<div class="actions">{% include 'read-manaa.html' %}</div>
|
<div class="actions">{% include 'read-manaa.html' %}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if settings.homepage_countdown_note %}<div class="release-message">
|
||||||
|
{% include 'author-comment.html' with comment=settings.homepage_countdown_note %}
|
||||||
|
</div>{% endif %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
{% if with_world_map and settings.countdown_map_position != 'above' %}{% include 'world-map.html' %}{% endif %}
|
||||||
</main>
|
</main>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{% load static %}<span class="djinn-sol-spelling" aria-hidden="true">{% for word in words %}{% if word %}<span class="djinn-sol-word">{% for glyph in word %}<img class="djinn-sol-glyph" src="{% static glyph %}" alt="" decoding="async">{% endfor %}</span>{% endif %}{% endfor %}</span>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
{% block title %}Djinnii · SLUMP X LAND{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<main class="section djinnii-page">
|
||||||
|
<p class="kicker">The languages of Sol’Terra</p>
|
||||||
|
<h1>Djinnii</h1>
|
||||||
|
<p>Djinnii is the spoken language. Djinn-Sol is its written alphabet. Use the chart to decode the lettering on the Sol’Terra map.</p>
|
||||||
|
<img class="djinnii-chart" src="{% static 'djinn-sol/chart.png' %}" width="1199" height="1312" alt="Djinn-Sol Pixel 12 alphabet decoder, showing the glyph for each letter from A to Z.">
|
||||||
|
<p><a href="{% url 'world-map' %}#explore-solterra">← Back to the Sol’Terra map</a></p>
|
||||||
|
</main>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{% load slx_community slx_brand %}
|
||||||
|
<div class="home-grid"><div class="home-primary">
|
||||||
|
{% if perms.catalog.watch_slx_live and settings.stream_status != 'offline' and settings.stream_provider %}<section class="section live-announcement" id="map-live" tabindex="-1"><div class="section-head"><h2>SLX Live</h2><span class="kicker">{{ settings.get_stream_status_display }}</span></div><div class="card"><div><h3>{{ settings.stream_title|default:'Behind the pages, live' }}</h3>{% if settings.stream_starts_at and settings.stream_status == 'upcoming' %}<p><time datetime="{{ settings.stream_starts_at|date:'c' }}">{{ settings.stream_starts_at|date:'M j, Y · g:i a T' }}</time></p>{% endif %}<p><a href="{% url 'stream' %}">Open the watch page →</a></p></div></div></section>{% endif %}
|
||||||
|
{% if news %}<section class="section" id="map-blog" tabindex="-1"><div class="section-head"><h2>Latest from the blog</h2><a href="{% url 'blog' %}">View all →</a></div>{% include "entry-cards.html" with items=news %}</section>{% endif %}
|
||||||
|
{% if not countdown_chapters and not chapters %}<section class="section" id="map-chapters" tabindex="-1"><div class="section-head"><h2>Chapters</h2><a href="{% url 'chapters' %}">View all →</a></div>{% include "chapter-cards.html" %}</section>{% endif %}
|
||||||
|
{% if upcoming %}<section class="section" id="map-upcoming" tabindex="-1"><div class="section-head"><h2>Next up</h2><a href="{% url 'upcoming' %}">Release forecast →</a></div>{% include 'upcoming-cards.html' %}</section>{% endif %}
|
||||||
|
{% if cast %}<section class="section" id="map-cast" tabindex="-1"><div class="section-head"><h2>Meet the cast</h2><a href="{% url 'entries' 'cast' %}">View all →</a></div>{% include "entry-cards.html" with items=cast %}</section>{% endif %}
|
||||||
|
{% if world %}<section class="section" id="map-world" tabindex="-1"><div class="section-head"><h2>World archive</h2><a href="{% url 'entries' 'world' %}">View all →</a></div>{% include "entry-cards.html" with items=world %}</section>{% endif %}
|
||||||
|
</div>
|
||||||
|
<aside class="home-reviews" id="map-reviews" tabindex="-1" aria-labelledby="home-review-heading">
|
||||||
|
{% if newsletter_signup_open %}<section class="newsletter-home" id="map-newsletter" tabindex="-1"><p class="kicker">Studio dispatch</p><h2>Get the next drop</h2><p>SLX chapter launches and studio news in your inbox.</p><a class="cta" href="{% url 'newsletter-signup' %}" data-newsletter-open>Join the newsletter</a></section>{% endif %}
|
||||||
|
<div class="home-reviews-head"><p class="kicker">Fan corner</p><h2 id="home-review-heading">Recent Reviews</h2><a href="{% url 'slx-series-reviews' %}">Series reviews →</a></div>
|
||||||
|
{% prime_ranks recent_reviews %}{% for review in recent_reviews %}
|
||||||
|
<article class="mini-review">
|
||||||
|
{% if review.chapter.cover %}<img src="{{ review.chapter.cover.url }}" alt="" loading="lazy">{% else %}<span class="mini-review-art" aria-hidden="true">SX</span>{% endif %}
|
||||||
|
<div><p class="kicker">Chapter #{{ review.chapter.number|stringformat:"03d" }}</p><h3><a href="{% url 'slx-review' review.chapter.number review.pk %}">{% if review.contains_spoilers %}Review with spoilers{% else %}{{ review.headline|slx_brand }}{% endif %}</a></h3><small><a href="{% url 'slx-profile' review.author_id %}">{{ review.author.username }}</a> {% rank_badge review.author %}</small></div>
|
||||||
|
<span class="review-score" aria-label="{{ review.score }} out of 5">{{ review.score }}/5</span>
|
||||||
|
</article>
|
||||||
|
{% empty %}<p class="muted-copy">The first reader reviews will appear here. <a href="{% url 'chapters' %}">Pick a chapter to review →</a></p>{% endfor %}
|
||||||
|
</aside></div>
|
||||||
@@ -1,53 +1,8 @@
|
|||||||
{% extends "base.html" %}{% load slx_community slx_brand static %}
|
{% extends "base.html" %}{% load static %}
|
||||||
{% block scripts %}{% if homepage_countdown %}<script defer src="{% static 'chapter-shelf.js' %}"></script>{% endif %}{% endblock %}
|
{% block body_class %} map-landing{% endblock %}
|
||||||
|
{% block scripts %}<link rel="stylesheet" href="{% static 'world-map.css' %}"><script defer src="{% static 'world-map.js' %}"></script>{% endblock %}
|
||||||
{% block floating_top %}{% endblock %}
|
{% block floating_top %}{% endblock %}
|
||||||
{% block content %}
|
{% block floating_bottom %}{% endblock %}
|
||||||
<main>
|
{% block footer %}{% endblock %}
|
||||||
{% if countdown_chapters %}
|
{% block popups %}{% endblock %}
|
||||||
{% include 'countdown-chapter-shelf.html' %}
|
{% block content %}<main class="map-landing-main">{% include "world-map.html" %}</main>{% endblock %}
|
||||||
{% elif chapters %}
|
|
||||||
<section class="section home-released-chapters" aria-labelledby="home-released-title">
|
|
||||||
<div class="section-head"><h2 id="home-released-title">Released chapters</h2><a href="{% url 'chapters' %}">View all →</a></div>
|
|
||||||
{% include "chapter-cards.html" %}
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
{% include 'floating-artwork.html' with band=floating_top_art position='top' only %}
|
|
||||||
<section class="hero{% if settings.blur_hero %} blurred{% endif %}">
|
|
||||||
{% if settings.hero_art and not page_backdrop %}<img class="hero-art" src="{{ settings.hero_art.url }}" alt="">{% endif %}
|
|
||||||
<div class="hero-copy"><p class="kicker">{{ settings.tagline|slx_brand }}</p><h1 class="hero-title">{{ "SLUMP X LAND"|slx_brand }}</h1><p class="credit">{{ settings.credit|slx_brand }}</p>{% if settings.intro %}<p class="intro">{{ settings.intro|slx_brand|linebreaksbr }}</p>{% endif %}
|
|
||||||
<div class="actions">{% include 'read-manaa.html' %}{% if settings.publisher_url %}<a class="cta secondary" href="{{ settings.publisher_url }}">Read on ONSOL-GO!</a>{% endif %}{% if settings.next_release_at %}<a class="cta secondary" href="{% url 'coming-soon' %}">Upcoming release</a>{% endif %}<a class="cta secondary" href="{% url 'library' %}">{% if following_title %}My SLX library{% else %}Follow <span class="slx-cta-wordmark">{{ "SLUMP X LAND"|slx_brand }}</span>{% endif %}</a></div></div>
|
|
||||||
</section>
|
|
||||||
{% if homepage_countdown %}
|
|
||||||
<section class="homepage-countdown" aria-labelledby="homepage-countdown-heading">
|
|
||||||
<div class="inline-timer-panel">
|
|
||||||
<div><p class="kicker">{{ "SLUMP X LAND"|slx_brand }} · COUNTDOWN</p><h2 id="homepage-countdown-heading">{{ settings.homepage_countdown_title|default:"Next release"|slx_brand }}</h2></div>
|
|
||||||
<div class="homepage-countdown-clock">
|
|
||||||
<span class="countdown ticker" data-output aria-hidden="true"></span>
|
|
||||||
<time datetime="{{ settings.homepage_countdown_at|date:'c' }}" data-countdown data-reload-home data-server-now="{{ countdown_now|date:'c' }}">{{ settings.homepage_countdown_at|date:'M j, Y · g:i a T' }}</time>
|
|
||||||
</div>
|
|
||||||
{% include 'countdown-progress.html' %}
|
|
||||||
</div>
|
|
||||||
{% if settings.homepage_countdown_note %}<div class="countdown-author-inline">{% include 'author-comment.html' with comment=settings.homepage_countdown_note %}</div>{% endif %}
|
|
||||||
{% include 'countdown-social.html' %}
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
<div class="home-grid"><div class="home-primary">
|
|
||||||
{% if perms.catalog.watch_slx_live and settings.stream_status != 'offline' and settings.stream_provider %}<section class="section live-announcement"><div class="section-head"><h2>SLX Live</h2><span class="kicker">{{ settings.get_stream_status_display }}</span></div><div class="card"><div><h3>{{ settings.stream_title|default:'Behind the pages, live' }}</h3>{% if settings.stream_starts_at and settings.stream_status == 'upcoming' %}<p><time datetime="{{ settings.stream_starts_at|date:'c' }}">{{ settings.stream_starts_at|date:'M j, Y · g:i a T' }}</time></p>{% endif %}<p><a href="{% url 'stream' %}">Open the watch page →</a></p></div></div></section>{% endif %}
|
|
||||||
{% if news %}<section class="section"><div class="section-head"><h2>Latest from the blog</h2><a href="{% url 'blog' %}">View all →</a></div>{% include "entry-cards.html" with items=news %}</section>{% endif %}
|
|
||||||
{% if not countdown_chapters and not chapters %}<section class="section"><div class="section-head"><h2>Chapters</h2><a href="{% url 'chapters' %}">View all →</a></div>{% include "chapter-cards.html" %}</section>{% endif %}
|
|
||||||
{% if upcoming %}<section class="section"><div class="section-head"><h2>Next up</h2><a href="{% url 'upcoming' %}">Release forecast →</a></div>{% include 'upcoming-cards.html' %}</section>{% endif %}
|
|
||||||
{% if cast %}<section class="section"><div class="section-head"><h2>Meet the cast</h2><a href="{% url 'entries' 'cast' %}">View all →</a></div>{% include "entry-cards.html" with items=cast %}</section>{% endif %}
|
|
||||||
{% if world %}<section class="section"><div class="section-head"><h2>World archive</h2><a href="{% url 'entries' 'world' %}">View all →</a></div>{% include "entry-cards.html" with items=world %}</section>{% endif %}
|
|
||||||
</div>
|
|
||||||
<aside class="home-reviews" aria-labelledby="home-review-heading">
|
|
||||||
{% if newsletter_signup_open %}<section class="newsletter-home"><p class="kicker">Studio dispatch</p><h2>Get the next drop</h2><p>SLX chapter launches and studio news in your inbox.</p><a class="cta" href="{% url 'newsletter-signup' %}" data-newsletter-open>Join the newsletter</a></section>{% endif %}
|
|
||||||
<div class="home-reviews-head"><p class="kicker">Fan corner</p><h2 id="home-review-heading">Recent Reviews</h2><a href="{% url 'slx-series-reviews' %}">Series reviews →</a></div>
|
|
||||||
{% prime_ranks recent_reviews %}{% for review in recent_reviews %}
|
|
||||||
<article class="mini-review">
|
|
||||||
{% if review.chapter.cover %}<img src="{{ review.chapter.cover.url }}" alt="" loading="lazy">{% else %}<span class="mini-review-art" aria-hidden="true">SX</span>{% endif %}
|
|
||||||
<div><p class="kicker">Chapter #{{ review.chapter.number|stringformat:"03d" }}</p><h3><a href="{% url 'slx-review' review.chapter.number review.pk %}">{% if review.contains_spoilers %}Review with spoilers{% else %}{{ review.headline|slx_brand }}{% endif %}</a></h3><small><a href="{% url 'slx-profile' review.author_id %}">{{ review.author.username }}</a> {% rank_badge review.author %}</small></div>
|
|
||||||
<span class="review-score" aria-label="{{ review.score }} out of 5">{{ review.score }}/5</span>
|
|
||||||
</article>
|
|
||||||
{% empty %}<p class="muted-copy">The first reader reviews will appear here. <a href="{% url 'chapters' %}">Pick a chapter to review →</a></p>{% endfor %}
|
|
||||||
</aside></div>
|
|
||||||
</main>{% endblock %}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{% extends 'base.html' %}{% load slx_community slx_brand %}{% block title %}Your library · SLUMP X LAND{% endblock %}
|
{% extends 'base.html' %}{% load slx_community slx_brand %}{% block title %}Your library · SLUMP X LAND{% endblock %}
|
||||||
{% block content %}<main class="section theme-account"><p class="kicker">The fan corner</p><h1>Your library</h1><p>Signed in as {{ user.username }} {% rank_badge user %}. <a href="{% url 'slx-profile' user.pk %}">View your reader profile →</a></p>
|
{% block content %}<main class="section theme-account"><p class="kicker">The fan corner</p><h1>Your library</h1><p>Signed in as {{ user.username }} {% rank_badge user %}. <a href="{% url 'slx-profile' user.pk %}">View your reader profile →</a></p>
|
||||||
|
<p><a href="{% url 'collector-preferences' %}">Collector recognition settings →</a></p>
|
||||||
{% for message in messages %}<p class="fan-message" role="status">{{ message|slx_brand }}</p>{% endfor %}
|
{% for message in messages %}<p class="fan-message" role="status">{{ message|slx_brand }}</p>{% endfor %}
|
||||||
<form method="post" action="{% url 'fan-follow' %}">{% csrf_token %}
|
<form method="post" action="{% url 'fan-follow' %}">{% csrf_token %}
|
||||||
<button class="cta" name="action" value="{% if following_title %}unfollow{% else %}follow{% endif %}">{% if following_title %}✓ Following <span class="slx-cta-wordmark">{{ "SLUMP X LAND"|slx_brand }}</span> · Unfollow{% else %}Follow <span class="slx-cta-wordmark">{{ "SLUMP X LAND"|slx_brand }}</span>{% endif %}</button>
|
<button class="cta" name="action" value="{% if following_title %}unfollow{% else %}follow{% endif %}">{% if following_title %}✓ Following <span class="slx-cta-wordmark">{{ "SLUMP X LAND"|slx_brand }}</span> · Unfollow{% else %}Follow <span class="slx-cta-wordmark">{{ "SLUMP X LAND"|slx_brand }}</span>{% endif %}</button>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{{ page.title }} · SLUMP X LAND{% endblock %}
|
||||||
|
{% block content %}<main class="section"><h1>{{ page.title }}</h1><div class="prose">{{ page.body|linebreaks }}</div></main>{% endblock %}
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}{% load static %}
|
||||||
|
{% block scripts %}<link rel="stylesheet" href="{% static 'membership-cards.css' %}">{% endblock %}
|
||||||
{% block title %}Slump X Land Monthly{% endblock %}
|
{% block title %}Slump X Land Monthly{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main class="section">
|
<main class="section">
|
||||||
<p class="kicker">MEMBER EDITION</p><h1>Slump X Land Monthly</h1>
|
<p class="kicker">MEMBER EDITION</p><h1>Slump X Land Monthly</h1>
|
||||||
|
<p>Both tiers unlock the full chapter library. Studio Vault also includes selected draft pages and process notes.</p>
|
||||||
<div class="shop-grid">
|
<div class="shop-grid">
|
||||||
<article class="card"><div><h2>Early Access</h2><p>Read new chapters before the public drop and get occasional creator notes.</p>
|
{% for plan in plans %}<article class="card member-plan{% if plan.image %} member-plan-with-art{% endif %}">{% if plan.image %}<img class="member-plan-art" src="{{ plan.image.url }}" alt="" decoding="async">{% endif %}<div class="member-plan-copy"><h2>{{ plan.title }}</h2><p>${{ plan.price_usd }} / {{ plan.billing_interval }}</p><a class="cta" href="{% url 'shop-product' plan.slug %}">View plan</a></div></article>
|
||||||
{% if settings.member_scout_url %}<a class="cta" href="{{ settings.member_scout_url }}">Choose Early Access</a>{% endif %}</div></article>
|
{% empty %}<p>Online membership checkout is not open yet.</p>{% endfor %}
|
||||||
<article class="card"><div><h2>Studio Vault</h2><p>Everything in Early Access, plus a curated selection of draft pages and process notes.</p>
|
|
||||||
{% if settings.member_vault_url %}<a class="cta" href="{{ settings.member_vault_url }}">Choose Studio Vault</a>{% endif %}</div></article>
|
|
||||||
</div>
|
</div>
|
||||||
{% if settings.member_vault_url or settings.member_scout_url %}
|
{% if comparison_rows %}<section class="section" id="compare-plans"><h2>Compare plans</h2><div style="overflow-x:auto"><table class="plan-comparison">
|
||||||
<p>Access is activated by the studio after payment is verified. Enter your SLX username at checkout if prompted.</p>
|
<caption>Benefits by membership plan</caption><thead><tr><th scope="col">Benefit</th>{% for plan in plans %}<th scope="col">{{ plan.title }}<br>${{ plan.price_usd }} / {{ plan.billing_interval }}</th>{% endfor %}</tr></thead>
|
||||||
{% endif %}
|
<tbody>{% for feature, values in comparison_rows %}<tr><th scope="row">{{ feature }}</th>{% for value in values %}<td>{{ value }}</td>{% endfor %}</tr>{% endfor %}</tbody></table></div></section>{% endif %}
|
||||||
{% if not user.is_authenticated %}<p><a href="{% url 'fan-login' %}?next={% url 'membership' %}">Sign in</a> or <a href="{% url 'fan-signup' %}">create an SLX account</a>.</p>{% endif %}
|
{% if not user.is_authenticated %}<p><a href="{% url 'fan-login' %}?next={% url 'membership' %}">Sign in</a> or <a href="{% url 'fan-signup' %}">create an SLX account</a>.</p>{% endif %}
|
||||||
{% if posts %}<h2>Your member content</h2><ul>{% for post in posts %}<li>{{ post.get_kind_display }} · <a href="{% url 'member-post' post.pk %}">{{ post.title }}</a></li>{% endfor %}</ul>{% endif %}
|
{% if posts %}<h2>Your member content</h2><ul>{% for post in posts %}<li>{{ post.get_kind_display }} · <a href="{% url 'member-post' post.pk %}">{{ post.title }}</a></li>{% endfor %}</ul>{% endif %}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{% extends "base.html" %}{% load slx_brand %}
|
||||||
|
{% block title %}Series introduction · SLUMP X LAND{% endblock %}
|
||||||
|
{% block content %}<main><section id="map-start" tabindex="-1" class="hero{% if settings.blur_hero %} blurred{% endif %}">
|
||||||
|
{% if settings.hero_art and not page_backdrop %}<img class="hero-art" src="{{ settings.hero_art.url }}" alt="">{% endif %}
|
||||||
|
<div class="hero-copy"><p class="kicker">{{ settings.tagline|slx_brand }}</p><h1 class="hero-title">{{ "SLUMP X LAND"|slx_brand }}</h1><p class="credit">{{ settings.credit|slx_brand }}</p>{% if settings.intro %}<p class="intro">{{ settings.intro|slx_brand|linebreaksbr }}</p>{% endif %}
|
||||||
|
<div class="actions">{% include 'read-manaa.html' %}{% if settings.publisher_url %}<a class="cta secondary" href="{{ settings.publisher_url }}">Read on ONSOL-GO!</a>{% endif %}{% if settings.next_release_at %}<a class="cta secondary" href="{% url 'coming-soon' %}">Upcoming release</a>{% endif %}<a class="cta secondary" href="{% url 'library' %}">{% if following_title %}My SLX library{% else %}Follow <span class="slx-cta-wordmark">{{ "SLUMP X LAND"|slx_brand }}</span>{% endif %}</a></div></div>
|
||||||
|
</section>
|
||||||
|
</main>{% endblock %}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{% if product.verified_by_seller %}
|
||||||
|
<span style="display:inline-block;border:1px solid #a7f3d0;border-radius:999px;background:#064e3b;color:#ecfdf5;padding:.2rem .55rem;font-size:.8rem;font-weight:700;"><span aria-hidden="true">✓</span> Verified by Seller</span>
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<article class="store-card">
|
||||||
|
<a class="store-cover" href="{% url 'shop-product' product.slug %}">{% if product.image %}<img src="{{ product.image.url }}" alt="{{ product.title }}" loading="lazy">{% else %}<span>SLX</span>{% endif %}</a>
|
||||||
|
<h2><a href="{% url 'shop-product' product.slug %}">{{ product.title }}</a></h2>
|
||||||
|
<small>{{ product.get_kind_display }}</small>
|
||||||
|
{% include 'shop/_seller_badge.html' %}
|
||||||
|
<p class="store-stock">{% if product.kind == 'physical' %}{% if product.in_stock %}In stock{% else %}Sold out{% endif %}{% elif product.kind == 'digital' %}Digital edition{% else %}Fan Club{% endif %}</p>
|
||||||
|
<strong>${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</strong>
|
||||||
|
{% if product.kind != 'subscription' and product.in_stock %}<form method="post" action="{% url 'shop-cart-add' product.pk %}">{% csrf_token %}<input type="hidden" name="quantity" value="1"><button class="store-button">Add to cart</button></form>
|
||||||
|
{% else %}<a class="store-button" href="{% url 'shop-product' product.slug %}">View details</a>{% endif %}
|
||||||
|
</article>
|
||||||
@@ -1,40 +1,9 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}{% load static %}
|
||||||
|
{% block scripts %}<link rel="stylesheet" href="{% static 'storefront.css' %}">{% endblock %}
|
||||||
{% block title %}Shop · SLUMP X LAND{% endblock %}
|
{% block title %}Shop · SLUMP X LAND{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main class="page-shell theme-shop">
|
<main class="section slx-store"><div class="store-bar"><a href="{% url 'world-map' %}">← Sol’Terra map</a><a href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a></div>
|
||||||
<header class="section-head" style="display:flex;justify-content:space-between;align-items:center;gap:1rem;">
|
<header class="store-banner"><h1>Slump X Land Shop</h1><p>Books, digital editions, and the Monthly Fan Club.</p></header>
|
||||||
<h1>Shop</h1>
|
{% if request.GET.subscribed %}<p>Your access will update after Stripe confirms the subscription.</p>{% endif %}
|
||||||
<a class="btn" href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a>
|
<div class="store-grid">{% for product in products %}{% include 'shop/card.html' %}{% empty %}<p>No products are available yet.</p>{% endfor %}</div></main>
|
||||||
</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 %}
|
{% endblock %}
|
||||||
@@ -10,12 +10,13 @@
|
|||||||
{% for item in order.items.all %}
|
{% for item in order.items.all %}
|
||||||
<li>
|
<li>
|
||||||
{{ item.quantity }} × {{ item.title_snapshot }} (${{ item.line_total }})
|
{{ item.quantity }} × {{ item.title_snapshot }} (${{ item.line_total }})
|
||||||
{% if item.product.kind == 'digital' and order.status in 'paid,shipped,delivered' %}
|
{% if item.chapter %} — <a href="{% url 'chapter' item.chapter.number %}">Open chapter reader</a>{% elif item.product.digital_file and order.status in 'paid,shipped,delivered' %}
|
||||||
— <a href="{% url 'shop-download' order.order_id item.pk %}"><strong>Download File</strong></a>
|
— <a href="{% url 'shop-download' order.order_id item.pk %}"><strong>Download File</strong></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% if user.is_authenticated and order.user_id == user.pk %}<p><a href="{% url 'collector-preferences' %}">Choose how you appear on the collector thank-you list →</a></p>{% endif %}
|
||||||
<p><a href="{% url 'shop-index' %}">← Return to Shop</a></p>
|
<p><a href="{% url 'shop-index' %}">← Return to Shop</a></p>
|
||||||
</main>
|
</main>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -1,45 +1,28 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}{% load static %}
|
||||||
|
{% block scripts %}<link rel="stylesheet" href="{% static 'storefront.css' %}">{% endblock %}
|
||||||
{% block title %}{{ product.title }} · Shop · SLUMP X LAND{% endblock %}
|
{% block title %}{{ product.title }} · Shop · SLUMP X LAND{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main class="page-shell">
|
<main class="section slx-store">
|
||||||
<p><a href="{% url 'shop-index' %}">← Back to Shop</a></p>
|
<div class="store-bar"><a href="{% url 'shop-index' %}">← Back to Shop</a><a href="{% url 'shop-cart' %}">Cart ({{ cart_count }})</a></div>
|
||||||
<article class="product-detail" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:2rem;">
|
<article class="store-detail">
|
||||||
{% if product.image %}
|
<div class="store-cover">{% if product.image %}<img src="{{ product.image.url }}" alt="{{ product.title }}">{% else %}<span>SLX</span>{% endif %}</div>
|
||||||
<div><img src="{{ product.image.url }}" alt="{{ product.title }}" style="width:100%;border-radius:8px;"></div>
|
<div class="store-product-info"><h1>{{ product.title }}</h1><p>{{ product.get_kind_display }}</p>{% include "shop/_seller_badge.html" %}
|
||||||
{% endif %}
|
<p>{{ product.summary }}</p><p class="store-price">${{ product.price_usd }}{% if product.kind == 'subscription' %} / {{ product.billing_interval }}{% endif %}</p>
|
||||||
<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' %}
|
{% 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;">
|
<p><a href="{% url 'membership' %}#compare-plans">Compare Fan Club plans →</a></p>
|
||||||
{% csrf_token %}
|
{% if not user.is_authenticated %}<a class="store-button" href="{% url 'fan-login' %}?next={% url 'shop-product' product.slug %}">Sign in to subscribe</a>
|
||||||
{% if not request.user.is_authenticated or not request.user.email %}
|
{% else %}<form method="post" action="{% url 'shop-subscribe' product.slug %}">{% csrf_token %}
|
||||||
<label>Email for membership receipts
|
{% if not user.email %}<label>Email for receipts <input type="email" name="email" required></label>{% endif %}
|
||||||
<input type="email" name="email" required placeholder="you@example.com">
|
{% if stripe_enabled %}<button name="gateway" value="stripe" class="store-button">Subscribe with Stripe</button>{% endif %}
|
||||||
</label>
|
{% if not product.member_tier and paypal_enabled and product.paypal_plan_id %}<button name="gateway" value="paypal" class="store-button">Subscribe with PayPal</button>{% endif %}
|
||||||
{% endif %}
|
</form>{% endif %}
|
||||||
{% if stripe_enabled %}
|
{% elif product.in_stock %}
|
||||||
<button type="submit" name="gateway" value="stripe" class="btn">Subscribe with Card (Stripe)</button>
|
<form method="post" action="{% url 'shop-cart-add' product.pk %}">{% csrf_token %}<label>Quantity <input type="number" name="quantity" value="1" min="1" max="20"></label><button class="store-button">Add to cart</button></form>
|
||||||
{% endif %}
|
{% else %}<p>Sold out</p>{% 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>
|
</div>
|
||||||
|
<aside class="store-format"><h2>Format & delivery</h2>{% if product.kind == 'physical' %}<p>Ships to you · {% if product.in_stock %}In stock{% else %}Sold out{% endif %}</p>{% elif product.kind == 'digital' %}<p>Digital edition</p>{% else %}<p>Recurring membership · {{ product.get_member_tier_display }}</p>{% endif %}{% if sample_chapter %}<a href="{% url 'chapter' sample_chapter.number %}">Open chapter reader →</a>{% endif %}</aside>
|
||||||
</article>
|
</article>
|
||||||
|
{% if product.description %}<section class="store-section"><h2>Overview</h2><div>{{ product.description|linebreaks }}</div></section>{% endif %}
|
||||||
|
{% if related_products %}<section class="store-section"><h2>You may also like</h2><div class="store-grid">{% for product in related_products %}{% include 'shop/card.html' %}{% endfor %}</div></section>{% endif %}
|
||||||
</main>
|
</main>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<section class="section slx-world-resources" aria-label="More from Slump X Land">
|
||||||
|
{% if not upcoming %}<div class="card" id="map-upcoming" tabindex="-1"><a href="{% url 'upcoming' %}">Next releases →</a></div>{% endif %}
|
||||||
|
{% if not cast %}<div class="card" id="map-cast" tabindex="-1"><a href="{% url 'entries' 'cast' %}">Meet the cast →</a></div>{% endif %}
|
||||||
|
{% if not world %}<div class="card" id="map-world" tabindex="-1"><a href="{% url 'entries' 'world' %}">World archive →</a></div>{% endif %}
|
||||||
|
{% if not news %}<div class="card" id="map-blog" tabindex="-1"><a href="{% url 'blog' %}">Studio blog →</a></div>{% endif %}
|
||||||
|
{% if perms.catalog.watch_slx_live and settings.stream_status != 'offline' and settings.stream_provider %}{% else %}<div class="card" id="map-live" tabindex="-1"><a href="{% url 'stream' %}">SLX Live →</a></div>{% endif %}
|
||||||
|
<div class="card" id="map-membership" tabindex="-1"><a href="{% url 'membership' %}">Membership →</a></div>
|
||||||
|
<div class="card" id="map-shop" tabindex="-1"><a href="{% url 'shop-index' %}">Shop →</a></div>
|
||||||
|
<div class="card" id="map-cart" tabindex="-1"><a href="{% url 'shop-cart' %}">Shopping cart →</a></div>
|
||||||
|
{% if not newsletter_signup_open %}<div class="card" id="map-newsletter" tabindex="-1"><span>Newsletter signup is currently closed.</span></div>{% endif %}
|
||||||
|
<div class="card" id="map-library" tabindex="-1"><a href="{% url 'library' %}">My library →</a></div>
|
||||||
|
{% if not homepage_countdown %}<div class="card" id="map-release" tabindex="-1"><a href="{% url 'coming-soon' %}">Release countdown →</a></div>{% endif %}
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{% load static djinn_sol %}
|
||||||
|
<nav id="explore-solterra" class="slx-world-map" aria-labelledby="slx-world-title">
|
||||||
|
<div class="slx-map-controls"><h1 id="slx-world-title">Explore Sol’Terra</h1><button type="button" data-map-sound aria-pressed="true" hidden>Radar sound</button></div>
|
||||||
|
<div class="slx-map-viewport">
|
||||||
|
<div class="slx-world-stage"><img src="{% static 'solterra-map.jpg' %}" width="2048" height="1170" alt="Original Slump X Land map of Sol’Terra" decoding="async">
|
||||||
|
{% for marker in map_locations %}
|
||||||
|
<a class="slx-world-marker" href="{{ marker.url }}" data-map-destination="{{ marker.key }}" style="--x:{{ marker.x }}%;--y:{{ marker.y }}%" aria-label="{{ marker.title }}" title="{{ marker.title }}"><span class="slx-map-label" aria-hidden="true">{% djinn_sol marker.title %}<span class="slx-map-english">{{ marker.title }}</span></span></a>
|
||||||
|
{% endfor %}
|
||||||
|
<img class="slx-map-avatar" src="{% static 'ahkai-map-standing.png' %}" alt="" aria-hidden="true" hidden>
|
||||||
|
<img class="slx-map-avatar slx-map-avatar-selected" src="{% static 'ahkai-map-selected.png' %}" alt="" aria-hidden="true" hidden>
|
||||||
|
</div></div>
|
||||||
|
<details class="slx-map-list"><summary>Destinations</summary><ul class="slx-world-directory">
|
||||||
|
{% for marker in map_locations %}<li><a href="{{ marker.url }}">{{ marker.title }}</a></li>{% endfor %}
|
||||||
|
<li><a href="{% url 'djinnii' %}">Djinnii alphabet decoder</a></li>
|
||||||
|
</ul></details>
|
||||||
|
</nav>
|
||||||