Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Dec 23, 2021
1 parent 1f1a4b6 commit bdb503c
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions templates/macros/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
('/payment-processors', _('Payment Processors')),
('/teams', _('Teams')),
('/stats', _('Stats')),
('/alternatives', _('Alternatives')),
('/legal', _('Legal')),
('/privacy', _('Privacy')),
('/feeds', _('Follow Us')),
Expand Down
1 change: 1 addition & 0 deletions tests/py/test_browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def f(spt):
.replace('/%username/news/%action', '/%username/news/subscribe') \
.replace('/for/%name/', '/for/wonderland/') \
.replace('/for/wonderland/%action', '/for/wonderland/leave') \
.replace('/alternatives/%platform', '/alternatives') \
.replace('/%platform', '/github') \
.replace('/%user_name/', '/liberapay/') \
.replace('/%redirect_to', '/giving') \
Expand Down
60 changes: 60 additions & 0 deletions www/about/alternatives/%platform.spt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from itertools import chain

PLATFORM_NAMES = ['Ghost', 'Open Collective', 'Patreon', 'Tipeee']
PLATFORM_SLUGS = {name.replace(' ', '').lower(): name for name in PLATFORM_NAMES}
NAV_ITEMS = [
('/' + slug, name) for slug, name in PLATFORM_SLUGS.items()
]

[---]

platform_slug = request.path['platform']
platform_name = PLATFORM_SLUGS.get(platform_slug)
if platform_slug and not platform_name:
if platform_slug.lower() in PLATFORM_SLUGS:
raise response.redirect('/about/alternatives/' + platform_slug.lower())
raise response.error(404)

if platform_name:
title = platform_name
full_title = _("{platform1} versus {platform2} - A comparison",
platform1=platform_name, platform2='Liberapay')
else:
title = _("Alternatives")

[---] text/html
% extends "templates/layouts/about.html"

% from "templates/macros/nav.html" import nav with context

% block content

<ul class="nav nav-pills">{{ nav(chain(
(('/', _("Overview")),),
NAV_ITEMS
), base='/about/alternatives') }}</ul>
<br>

% if not platform_slug

<p>{{ _("TODO") }}</p>

% elif platform_slug == 'ghost'

<p>{{ _("TODO") }}</p>

% elif platform_slug == 'opencollective'

<p>{{ _("TODO") }}</p>

% elif platform_slug == 'patreon'

<p>{{ _("TODO") }}</p>

% elif platform_slug == 'tipeee'

<p>{{ _("TODO") }}</p>

% endif

% endblock

0 comments on commit bdb503c

Please sign in to comment.