moviewyrm/bookwyrm/templates/settings/link_domains/link_domains.html

121 lines
4.7 KiB
HTML
Raw Normal View History

2022-01-10 18:11:00 +00:00
{% extends 'settings/layout.html' %}
{% load humanize %}
{% load i18n %}
2022-01-10 18:38:05 +00:00
{% load utilities %}
2022-01-10 18:11:00 +00:00
{% block title %}{% trans "Link Domains" %}{% endblock %}
{% block header %}{% trans "Link Domains" %}{% endblock %}
{% block panel %}
<p class="notification block">
{% trans "Link domains must be approved before they are shown on book pages. Please make sure that the domains are not hosting spam, malicious code, or deceptive links before approving." %}
</p>
<div class="block">
<div class="tabs">
<ul>
{% url 'settings-link-domain' status='pending' as url %}
<li {% if request.path in url %}class="is-active" aria-current="page"{% endif %}>
<a href="{{ url }}">{% trans "Pending" %}</a>
</li>
{% url 'settings-link-domain' status='approved' as url %}
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
<a href="{{ url }}">{% trans "Approved" %}</a>
</li>
{% url 'settings-link-domain' status='blocked' as url %}
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
<a href="{{ url }}">{% trans "Blocked" %}</a>
</li>
</ul>
</div>
{% for domain in domains %}
2022-01-10 18:38:05 +00:00
{% join "domain" domain.id as domain_modal %}
2022-01-10 18:11:00 +00:00
<div class="box content">
<div class="columns is-mobile">
<header class="column">
2022-01-10 19:03:10 +00:00
<h2 class="title is-5">
2022-01-10 18:11:00 +00:00
{{ domain.name }}
(<a href="http://{{ domain.domain }}" target="_blank" rel="noopener">{{ domain.domain }}</a>)
2022-01-10 19:03:10 +00:00
</h2>
2022-01-10 18:11:00 +00:00
</header>
<div class="column is-narrow">
2022-01-10 18:38:05 +00:00
<button type="button" class="button" data-modal-open="{{ domain_modal }}">
<span class="icon icon-pencil m-0-mobile" aria-hidden="treu"></span>
<span>{% trans "Set display name" %}</span>
</button>
2022-01-10 18:11:00 +00:00
</div>
</div>
<div class="block">
<details class="details-panel">
<summary>
2022-01-10 19:03:10 +00:00
<h3 class="title is-6 mb-0">
2022-01-10 18:11:00 +00:00
{% trans "View links" %}
({{ domain.links.count }})
2022-01-10 19:03:10 +00:00
</h3>
2022-01-10 18:11:00 +00:00
<span class="details-close icon icon-x" aria-hidden></span>
</summary>
2022-01-10 19:03:10 +00:00
<div class="table-container mt-4">
<table class="is-striped">
<tr>
<th>{% trans "URL" %}</th>
<th>{% trans "Filetype" %}</th>
<th>{% trans "Book" %}</th>
</tr>
2022-01-10 18:11:00 +00:00
{% for link in domain.links.all|slice:10 %}
2022-01-10 19:03:10 +00:00
<tr>
<td>
<a href="{{ link.url }}" target="_blank" rel="noopener">{{ link.url }}</a>
</td>
<td>
{% if link.filelink.filetype %}
{{ link.filelink.filetype }}
{% endif %}
</td>
<td>
{% if link.filelink.filetype %}
{% with book=link.filelink.book %}
<a href="{{ book.local_path }}">{% include "snippets/book_titleby.html" with book=book %}</a>
{% endwith %}
{% endif %}
</td>
</tr>
2022-01-10 18:11:00 +00:00
{% endfor %}
2022-01-10 19:03:10 +00:00
</table>
</div>
2022-01-10 18:11:00 +00:00
</details>
</div>
2022-01-10 18:38:05 +00:00
{% include "settings/link_domains/edit_domain_modal.html" with domain=domain id=domain_modal %}
2022-01-10 18:11:00 +00:00
<form name="domain-{{ domain.id }}">
{% csrf_token %}
<div class="field has-addons">
<div class="control">
<button type="submit" class="button is-success is-light">{% trans "Approve" %}</button>
</div>
<div class="control">
<button type="submit" class="button is-danger is-light">{% trans "Block" %}</button>
</div>
</div>
</form>
</div>
{% endfor %}
{% if not domains.exists %}
{% if status == "approved" %}
<em>{% trans "No domains currently approved" %}</em>
{% elif status == "pending" %}
<em>{% trans "No domains currently pending" %}</em>
{% else %}
<em>{% trans "No domains currently blocked" %}</em>
{% endif %}
{% endif %}
</div>
{% endblock %}