Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document alternatives #1432

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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