/
package.html
299 lines (267 loc) · 10 KB
/
package.html
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
{% extends "base.html" %}
{% load i18n %}
{% load package_tags %}
{% block head_title %}{{ package.title }}{% endblock %}
{% block extra_head %}
<meta name="description" content="{{ package.repo_description }}" />
<meta name="keywords" content="{{ package.grid_set.all|join:',' }}" />
{{ block.super }}
{% endblock %}
{% block body %}
{% comment %}
<!--TODO block until we get things sorted out -->
{% if warnings %}
<ul class="messages">
{% if pypi_ancient %}
<li class="warning">WARNING: This package's most recent PyPI release is from over a year ago and may no longer be maintained.</li>
{% endif %}
{% if no_development %}
<li class="warning">WARNING: This package has not seen any development in over a year and may no longer be maintained.</li>
{% endif %}
{% if pypi_no_release %}
<li class="note">NOTE: This package is not available for download from PyPI. It may be using a third-party site to host its downloadable package files.</li>
{% endif %}
</ul>
{% endif %}
{% endcomment %}
<h2><a href="{% url 'home' %}">{% trans "home" %}</a> / <a href="{% url 'packages' %}">{% trans "packages" %}</a> / {{ package.title }}
<a href="{% url 'edit_package' package.slug %}"><span class="glyphicon glyphicon-pencil"></span></a>
</h2>
<div class="row">
<div class="col-md-6">
<p>
{{ package.repo_description }}
</p>
<!-- start Usage panel -->
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">Usage</h3>
</div>
<table class="table">
<thead>
<tr>
<th>{% trans "Category" %}</th>
<th>{% trans "# Using This" %}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="{% url 'category' package.category.slug %}">{{ package.category }}</a>
</td>
<td>
{{ package.usage.count }}
{% with package as package %}
{% usage_button %}
{% endwith %}
</td>
</tr>
</tbody>
</table>
</div>
<!-- end Usage panel -->
<!-- start PyPI panel -->
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">PyPI</h3>
</div>
{% if package.pypi_url and package.pypi_url != "http://pypi.python.org/pypi/" %}
<div class="panel-body">
<p><a href="{{ package.pypi_url }}">{{ package.pypi_url }}</a></p>
<p>
<a href="https://pypi.python.org/pypi/{{ package.pypi_name }}/" rel="nofollow"><img src="https://img.shields.io/pypi/dm/{{ package.pypi_name }}.svg"></a>
</p>
</div>
<table class="table">
<thead>
<tr>
<th>{% trans "Version" %}</th>
<th>{% trans "License" %}</th>
<th>{% trans "Released" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Python 3?" %}</th>
</tr>
</thead>
<tbody>
{% for version in package.version_set.by_version_not_hidden %}
<tr>
<td>{{ version.number }}</td>
<td>{{ version.pretty_license|default:"none" }}</td>
<td>{{ version.upload_time|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ version.pretty_status }}</td>
<td>
{% if version.supports_python3 %}
<span class="glyphicon glyphicon-ok"></span>
{% else %}
<span class="glyphicon glyphicon-remove"></span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="panel-body">
<p>{% trans "No PyPI release" %}</p>
</div>
{% endif %}
</div>
<!-- end PyPI panel -->
<!-- start Participants panel -->
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">{% trans "Participants" %}</h3>
</div>
<div class="panel-body">
<p>
{% for participant in package.participant_list %}
<a href="{% participant_url package.repo participant %}">{{ participant }}</a>
{% endfor %}
</p>
</div>
</div>
<!-- end Participants panel -->
</div> <!-- end six column section -->
<div class="col-md-6">
<!-- start Documentation panel -->
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">{% trans "Documentation" %}</h3>
<div class="pull-right">
{% if request.user.is_authenticated %}
<a href="{% url 'edit_documentation' package.slug %}"><span class="glyphicon glyphicon-plus"></span></a>
{% endif %}
</div>
</div>
<div class="panel-body">
<p>{{ package.documentation_url|urlize }}</p>
</div>
</div>
<!-- end Documentation panel -->
<!-- start Repo panel -->
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">Repo Activity</h3>
<div class="pull-right" id="fetch-cell">
{% if package.last_fetched %}
Last fetched: {{ package.last_fetched|timesince }} ago
{% endif %}
<a class="btn btn-default btn-xs" href="{% url 'post_package_data' package.slug %}">{% trans "Fetch latest data" %}</a>
{% comment %}
{% if repo.title != "Github" %}
<a class="btn btn-default btn-xs" href="{% url 'fetch_package_data' package.slug %}">{% trans "Fetch latest data" %}</a>
{% else %}{# if repo.title == "Github" #}
<a class="btn btn-default btn-xs" href="#">{% trans "Fetch latest data" %}</a>
{% endif %}
{% endcomment %}
</div>
</div>
<div class="panel-body">
<p>
<strong>Repo Hosting:</strong> {{ package.repo.title }}
</p>
</div>
<table class="table">
<thead>
<tr>
<th>{% trans "Repo URL" %}</th>
<th>{% trans "Commits" %}</th>
<th><span class="glyphicon glyphicon-star"></span></th>
<th><span class="glyphicon glyphicon-random"></span></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="{{ package.repo_url }}">{{ package.repo_url }}</a></td>
<td><img src="https://chart.googleapis.com/chart?cht=bvg&chs=105x20&chd=t:{{package.commits_over_52}}&chco=666666&chbh=1,1,1&chds=0,20" /></td>
<td>{{ package.repo_watchers|default:"n/a" }}</td>
<td>{{ package.repo_forks|default:"n/a" }}</td>
</tr>
</tbody>
</table>
</div>
<!-- end Repo panel -->
<!-- start Grids panel -->
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">{% trans "Comparison Grids" %}</h3>
<div class="pull-right">
{% if request.user.is_authenticated and profile.can_add_grid %}
<a id="find-a-grid" href="#"><span class="glyphicon glyphicon-plus"></span></a>
{% endif %}
</div>
</div>
<div class="panel-body">
{% for grid in package.grids %}
<a href="{% url 'grid' grid.slug %}" title="{{ grid.description }}">{{ grid }}</a>
{% endfor %}
{% if request.user.is_authenticated and profile.can_add_grid %}
{% include "package/includes/_attach_grid.html" %}
{% endif %}
</div>
</div>
<!-- end Grids panel -->
<!-- start Examples panel -->
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">{% trans "Sites using this package" %}</h3>
<div class="pull-right">
{% if request.user.is_authenticated %}
<a href="{% url 'add_example' package.slug %}"><span class="glyphicon glyphicon-plus"></span></a>
{% endif %}
</div>
</div>
<div class="panel-body">
{% with package.active_examples as examples %}
{% if examples %}
<ol>
{% for example in examples %}
<li>
<a href="{{ example.pretty_url }}">{{ example.title }}</a>
{% if request.user.is_authenticated %}
<a href="{% url 'edit_example' package.slug example.id %}"><span class="glyphicon glyphicon-pencil"></span></a>
{% endif %}
</li>
{% endfor %}
</ol>
{% else %}
<p>No sites using this package have been listed yet.</p>
{% endif %}
{% endwith %}
</div>
</div>
<!-- end Examples panel -->
</div> <!-- end six column section -->
</div> <!-- end twelve_column section -->
{% endblock %}
{% block javascript %}
{{ block.super }}
<script src="{{ STATIC_URL }}js/underscore.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}js/gh3.js" type="text/javascript"></script>
{% endblock %}
{% block extra_body %}
<script type="text/javascript">
$(function() {
$('#find-a-grid').click(function(e) {
e.preventDefault();
$('#find-a-grid').hide();
$('#find-a-grid-form').show();
$('#find-a-grid-input').focus();
$('#find-a-grid-input').keyup(function() {
var search_text = $('input#find-a-grid-input').val();
var search_text = '{% url 'ajax_grid_list' %}?q=' + search_text + '&package_id={{ package.id }}';
console.log(search_text);
$.get(search_text, function(data) {
$('#target').html(data).show("slow");
});
});
$("#find-a-grid-form").keypress(function(e) {
if (e.which == 13) {
return false;
};
});
});
});
</script>
{% endblock %}