This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 309
/
Copy path%package.spt
148 lines (136 loc) · 5.7 KB
/
%package.spt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import requests
from aspen import Response
from gratipay.utils import icons, markdown, truncate
from gratipay.models.package import Package
from gratipay.models.package.emails import PRIMARY, VERIFIED, UNVERIFIED, UNLINKED, OTHER
[---]
package_name = request.path['package']
if package_name.endswith('/'):
website.redirect(request.path.raw[:-1]) # no trailing slash
package = Package.from_names('npm', package_name)
if package is None:
raise Response(404)
elif package.team:
website.redirect(package.team.url_path)
page_id = "package"
suppress_sidebar = True
banner = package.name
if user.participant:
emails = package.classify_emails_for_participant(user.participant)
[---] text/html
{% extends "templates/base.html" %}
{% block banner %}
<a class="elsewhere" href="{{ package.remote_human_url }}">
<div class="avatar">
<img class="avatar" src="{{ website.asset('package-default-large.png') }}" />
<img class="platform" src="{{ website.asset('npm-n.png') }}" />
</div>
{{ super() }}
</a>
{% endblock %}
{% block scripts %}
<script>
$(document).ready(function() {
Gratipay.packages.initSingle();
});
</script>
{{ super() }}
{% endblock %}
{% block content %}
{% if package.description %}
<p class="description important-thing-at-the-top{% if len(package.description) > 256 %} long{% endif %}">{{ package.description }}</p>
{% else %}
<p class="sorry important-thing-at-the-top">{{ _("No description available.") }}</p>
{% endif %}
{% if user.ANON %}
<p class="instructions">
{{ _( 'Claim the {package_link} npm package on Gratipay:'
, package_link='<a href="%s">%s</a>'|safe % (package.remote_human_url, package.name)
) }}
</p>
<div class="important-button">
{{ sign_in_using(button_class='large') }}
</div>
{% else %}
<p class="instructions">
{{ _( 'Apply to accept payments for the {package_link} npm package:'
, package_link='<a href="%s">%s</a>'|safe % (package.remote_human_url, package.name)
) }}
</p>
{% if len(emails) == 0 %}
<p class="sorry">{{ _("No email addresses on file.") }}</p>
{% else %}
<input type="hidden" name="package_id" value="{{ package.id }}">
<div class="gratipay-select">
<ul>
{% for i, (email, group) in enumerate(emails, start=1) %}
<li class="{% if group == OTHER %}disabled{% endif %}
{% if i == 1 %}selected{% endif %}"
data-action="{{ 'apply' if group in (PRIMARY, VERIFIED) else
'resend' if group == UNVERIFIED else
'verify' if group == UNLINKED else
'none' }}">
<input type="radio" name="email" value="{{ email }}" id="email-{{i}}"
{% if i == 1 %}checked{% endif %}>
<span class="icon"></span>
<div class="listing-wrapper">
<label class="listing-name" for="email-{{ i }}">{{ email }}</label>
<div class="listing-details">
<span class="i">{{ i }}</span>
<span>·
{% if group == OTHER %}
<span class="status-icon failure">
{{ icons.STATUS_ICONS['failure']|safe }}</span>
{{ _('Linked to a different account') }}
{% else %}
{% if group == PRIMARY %}
<span class="status-icon feature">
{{ icons.STATUS_ICONS['feature']|safe }}</span>
{{ _('Your primary email address') }}
{% elif group == VERIFIED %}
<span class="status-icon success">
{{ icons.STATUS_ICONS['success']|safe }}</span>
{{ _('Linked to your account') }}
{% elif group == UNVERIFIED %}
<span class="status-icon warning">
{{ icons.STATUS_ICONS['warning']|safe }}</span>
{{ _('Verification pending') }}
{% elif group == UNLINKED %}
<span class="status-icon warning">
{{ icons.STATUS_ICONS['warning']|safe }}</span>
{{ _('Unverified') }}
{% endif %}
{% endif %}
</div>
</div>
<span class="arrow up"></span>
<span class="arrow down"></span>
</li>
{% endfor %}
</ul>
</div>
<div class="important-button">
<button type="submit" class="selected large disabled">
<span class="apply">{{ _('Apply to accept payments') }}</span>
<span class="resend">{{ _('Resend verification') }}</span>
<span class="verify">{{ _('Verify email address') }}</span>
<span class="dead-end">{{ _('Dead-end, sorry') }}</span>
</button>
</div>
{% endif %}
<p class="fine-print">
{{ _( 'Addresses are from {a}{code}maintainers{_code}{_a}.'
, a='<a href="%s">'|safe % package.remote_api_url
, _a='</a>'|safe
, code='<code>'|safe
, _code='</code>'|safe
) }}
</p>
<p class="fine-print">
{{ _( 'Out of date? Update {a}at npm{_a} and refresh.'
, a='<a href="%s">'|safe % package.remote_human_url
, _a='</a>'|safe
) }}
</p>
{% endif %}
{% endblock %}