/
component.html
330 lines (294 loc) · 12.2 KB
/
component.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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
{% extends "base.html" %}
{% load i18n %}
{% load permissions %}
{% load translations %}
{% load crispy_forms_tags %}
{% load metrics %}
{% block breadcrumbs %}
{% path_object_breadcrumbs path_object %}
<a class="pull-right flip" href="{{ object.get_widgets_url }}">
<img src="{% url 'widget-image' path=object.get_url_path widget='svg' color='badge' extension='svg' %}?native=1" />
</a>
{% endblock %}
{% block content %}
{% announcements component=object %}
{% include "snippets/component/state.html" %}
{% include "snippets/watch-dropdown.html" with project=object.project component=object %}
{% perm 'meta:vcs.status' object as user_can_see_repository_status %}
{% perm 'project.permissions' object as user_can_manage_acl %}
{% perm 'reports.view' object as user_can_view_reports %}
{% perm 'translation.add' object as user_can_add_translation %}
{% perm 'component.edit' object as user_can_edit_component %}
<ul class="nav nav-pills">
<li class="active"><a href="#translations" data-toggle="tab">{% trans "Languages" %}</a></li>
<li><a href="#information" data-toggle="tab">{% trans "Info" %}</a></li>
{% if alerts %}
<li><a href="#alerts" data-toggle="tab">{% trans "Alerts" %}</a></li>
{% endif %}
<li><a href="#search" data-toggle="tab">{% trans "Search" %}</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
{% trans "Insights" %} <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#history" data-toggle="tab">{% trans "History" %}</a></li>
<li><a href="{% url 'export_stats' path=object.get_url_path %}?format=csv">{% trans "Download statistics (CSV)" %}</a></li>
<li><a href="{% url 'export_stats' path=object.get_url_path %}?format=json">{% trans "Download statistics (JSON)" %}</a></li>
{% if user.is_authenticated %}
<li><a href="#reports" data-toggle="tab">{% trans "Translation reports" %}</a></li>
{% endif %}
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
{% trans "Files" %} <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="{% url 'download' path=object.get_url_path %}?format=zip" title="{% trans "Download for offline translation." %}">{% blocktrans %}Download translation files as ZIP file{% endblocktrans %}</a></li>
<li><a href="{% url 'download' path=object.get_url_path %}?format=zip:csv" title="{% trans "Download for offline translation." %}">{% blocktrans %}Download translations as CSV in a ZIP file{% endblocktrans %}</a></li>
<li><a href="{% url 'download' path=object.get_url_path %}?format=zip:xliff11" title="{% trans "Download for offline translation." %}">{% blocktrans %}Download translations as XLIFF 1.1 in a ZIP file{% endblocktrans %}</a></li>
<li><a href="{% url 'download' path=object.get_url_path %}?format=zip:xlsx" title="{% trans "Download for offline translation." %}">{% blocktrans %}Download translations as XLSX in a ZIP file{% endblocktrans %}</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
{% trans "Tools" %} <span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% if replace_form %}
<li><a href="#replace" data-toggle="tab">{% trans "Search and replace" %}</a></li>
{% endif %}
{% if bulk_state_form %}
<li><a href="#bulk-edit" data-toggle="tab">{% trans "Bulk edit" %}</a></li>
{% endif %}
<li><a href="{% url 'data_project' project=object.project.slug %}">{% trans "Data exports" %}</a></li>
<li><a href="{% url 'checks' path=object.get_url_path %}">{% trans "Failing checks" %}</a></li>
<li><a href="{% url 'matrix' path=object.get_url_path %}">{% trans "Matrix view" %}</a></li>
{% if user_can_add_translation %}
<li><a href="{% url "new-language" path=object.get_url_path %}">{% trans "Start new translation" %}</a></li>
{% endif %}
</ul>
</li>
{% if user.is_authenticated %}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
{% trans "Manage" %} <span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% if user_can_see_repository_status %}
<li><a href="#repository" data-toggle="tab" data-href="{% url 'git_status' path=object.get_url_path %}">{% trans "Repository maintenance" %}</a></li>
<li role="separator" class="divider"></li>
{% endif %}
<li><a href="{% url 'screenshots' path=object.get_url_path %}">{% trans "Screenshots" %}</a></li>
<li><a href="{% url 'memory' project=object.project.slug %}">{% trans "Translation memory" %}</a></li>
{% if announcement_form %}
<li><a href="#announcement" data-toggle="tab">{% trans "Post announcement" %}</a></li>
{% endif %}
{% if user_can_manage_acl %}
<li><a href="{% url 'manage-access' project=object.project.slug %}">{% trans "Users" %}</a></li>
{% endif %}
{% if user_can_edit_component %}
<li><a href="{% url 'guide' path=object.get_url_path %}">{% trans "Community localization checklist" %}</a></li>
<li><a href="{% url 'addons' path=object.get_url_path %}">{% trans "Add-ons" %}</a></li>
{% endif %}
{% if delete_form or rename_form or user_can_edit_component %}
<li role="separator" class="divider"></li>
{% if user_can_edit_component %}
<li><a href="{% url 'settings' path=object.get_url_path %}">{% trans "Settings" %}</a></li>
{% endif %}
{% if delete_form or rename_form %}
<li><a href="#organize" data-toggle="tab">{% trans "Organize or remove" %}</a></li>
{% endif %}
{% endif %}
</ul>
</li>
{% endif %}
{% include "snippets/share-menu.html" with object=object %}
</ul>
<div class="tab-content">
<div class="tab-pane active" id="translations">
{% include "snippets/list-objects.html" with objects=translations name_source="language" label=_("Language") is_glossary=object.is_glossary add_link="translation" %}
</div>
<div class="tab-pane" id="alerts">
{% if user.is_authenticated %}
{% for alert in alerts %}
<div class="panel panel-default">
<div class="panel-heading">
{% if alert.obj.doc_page %}
{% documentation_icon alert.obj.doc_page alert.obj.doc_anchor right=True %}
{% endif %}
{{ alert }}
{% if alert.dismissed %}
<span class="badge">{% trans "dismissed" %}</span>
{% endif %}
</div>
<div class="panel-body">{% render_alert alert %}</div>
<form action="{% url "dismiss-alert" path=object.get_url_path %}" method="post">
<div class="panel-footer">
{% comment %}Translators: Component alert footer, first and last contain localized human readable time span, for example 5 days ago{% endcomment %}
{% blocktrans with first=alert.timestamp|naturaltime last=alert.updated|naturaltime %}Appeared {{ first }}, last seen {{ last }}{% endblocktrans %}
{% if user_can_edit_component and alert.obj.dismissable %}
{% csrf_token %}
<input type="hidden" value="{{ alert.name }}" name="dismiss" />
<input type="submit" value="{% trans "Dismiss" %}" class="pull-right flip btn btn-danger" />
<div class="clearfix"></div>
{% endif %}
</div>
</form>
</div>
{% endfor %}
{% else %}
{% trans "Please sign in to see the alerts." as msg %}
{% show_message "error" msg %}
{% endif %}
</div>
<div class="tab-pane" id="information">
{% include "snippets/info.html" with project=object.project component=object stats=object.stats metrics=object|metrics show_source=True %}
</div>
<div class="tab-pane" id="search">
<form action="{% url 'search' path=object.get_url_path %}" method="GET" data-persist="search-component">
{% include "snippets/search-form.html" %}
</form>
</div>
{% if replace_form %}
<div class="tab-pane" id="replace">
<form action="{% url 'replace' path=object.get_url_path %}" method="post" enctype="multipart/form-data">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title">
{% documentation_icon 'user/translating' 'search-replace' right=True %}
{% trans "Search and replace" %}
</h4></div>
<div class="panel-body">
{% crispy replace_form %}
</div>
<div class="panel-footer">
<input type="submit" value="{% trans "Replace" %}" class="btn btn-primary" />
</div>
</div>
</form>
</div>
{% endif %}
{% if bulk_state_form %}
<div class="tab-pane" id="bulk-edit">
<form action="{% url 'bulk-edit' path=object.get_url_path %}" method="post" enctype="multipart/form-data">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title">
{% documentation_icon 'user/translating' 'bulk-edit' right=True %}
{% trans "Bulk edit" %}
</h4></div>
<div class="panel-body">
{% crispy bulk_state_form %}
</div>
<div class="panel-footer">
<input type="submit" value="{% trans "Apply" %}" class="btn btn-primary" />
</div>
</div>
</form>
</div>
{% endif %}
<div class="tab-pane" id="history">
{% include "last-changes-content.html" %}
<a class="btn btn-primary" href="{% url 'changes' path=object.get_url_path %}">{% trans "Browse all component changes" %}</a>
</div>
{% if announcement_form %}
<div class="tab-pane" id="announcement">
<form action="{% url 'announcement' path=object.get_url_path %}" method="post">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title">
{% documentation_icon 'admin/announcements' right=True %}
{% trans "Post announcement" %}
</h4></div>
<div class="panel-body">
{% csrf_token %}
{{ announcement_form|crispy }}
<p class="help-block">{% trans "The message is shown for all translations within the component, until its given expiry, or permanently until it is deleted." %}</p>
</div>
<div class="panel-footer">
<input type="submit" value="{% trans "Add" %}" class="btn btn-primary" />
</div>
</form>
</div>
</div>
{% endif %}
{% if rename_form or delete_form %}
<div class="tab-pane" id="organize">
{% if rename_form %}
<form method="post" action="{% url 'rename' path=object.get_url_path %}">
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title">{% trans "Organize component" %}</h4></div>
<div class="panel-body">
<div class="form-group">
<div class="alert alert-warning" role="alert">
{% trans "Moving or renaming the component will also change its URLs." %}
{% trans "Users will need to update their bookmarks, references in cloned repositories, or API calls!" %}
</div>
</div>
{% crispy rename_form %}
</div>
<div class="panel-footer">
<input type="submit" class="btn btn-warning" value="{% trans "Organize" %}">
</div>
</div>
</form>
{% endif %}
{% if delete_form %}
{% include "trans/delete-form.html" %}
{% endif %}
</div>
{% endif %}
{% if user_can_see_repository_status %}
<div class="tab-pane" id="repository">
<p>{% trans "Loading…" %}</p>
</div>
{% endif %}
{% if user.is_authenticated %}
<div class="tab-pane" id="reports">
{% if not user_can_view_reports %}
{% trans "You don't have permission to view reports for all users, only your contributions will be listed." as msg %}
{% show_message "warning" msg %}
{% endif %}
<div class="row">
<div class="col-lg-6">
<form action="{% url 'credits' path=object.get_url_path %}" method="post" enctype="multipart/form-data">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
{% documentation_icon 'devel/reporting' 'credits' right=True %}
{% trans "Credits" %}
</h4>
</div>
<div class="panel-body">
<p>{% trans "Lists all translators contributing to this component in a given time period. Useful for inclusion in documentation or the app itself, to thank translators and generate feedback to them." %}</p>
{% crispy reports_form %}
</div>
<div class="panel-footer">
<input type="submit" value="{% trans "Generate" %}" class="btn btn-primary" />
</div>
</div>
</form>
</div>
<div class="col-lg-6">
<form action="{% url 'counts' path=object.get_url_path %}" method="post" enctype="multipart/form-data">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
{% documentation_icon 'devel/reporting' 'stats' right=True %}
{% trans "Contributor stats" %}
</h4>
</div>
<div class="panel-body">
<p>{% trans "Reports the number of strings and words translated by each translator." %}</p>
{% crispy reports_form %}
</div>
<div class="panel-footer">
<input type="submit" value="{% trans "Generate" %}" class="btn btn-primary" />
</div>
</div>
</form>
</div>
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}