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 % } >
2022-01-10 19:52:00 +00:00
< a href = "{{ url }}" > {% trans "Pending" %} ({{ counts.pending }})< / a >
2022-01-10 18:11:00 +00:00
< / li >
{% url 'settings-link-domain' status='approved' as url %}
< li { % if url in request . path % } class = "is-active" aria-current = "page" { % endif % } >
2022-01-10 19:52:00 +00:00
< a href = "{{ url }}" > {% trans "Approved" %} ({{ counts.approved }})< / a >
2022-01-10 18:11:00 +00:00
< / li >
{% url 'settings-link-domain' status='blocked' as url %}
< li { % if url in request . path % } class = "is-active" aria-current = "page" { % endif % } >
2022-01-10 19:52:00 +00:00
< a href = "{{ url }}" > {% trans "Blocked" %} ({{ counts.blocked }})< / a >
2022-01-10 18:11:00 +00:00
< / 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 20:30:24 +00:00
< span role = "heading" aria-level = "3" class = "title is-6 mb-0" >
2022-01-10 18:11:00 +00:00
{% trans "View links" %}
({{ domain.links.count }})
2022-01-10 20:30:24 +00:00
< / span >
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 >
2022-01-10 21:33:22 +00:00
< th > {% trans "Added by" %}< / th >
2022-01-10 19:03:10 +00:00
< 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 >
2022-01-10 21:33:22 +00:00
< td >
< a href = "{% url 'settings-user' link.added_by.id %}" > @{{ link.added_by|username }}< / a >
< / td >
2022-01-10 19:03:10 +00:00
< 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 19:19:20 +00:00
< div class = "field has-addons" >
{% if status != "approved" %}
< form
name="domain-{{ domains.id }}-approve"
class="control"
method="post"
action="{% url 'settings-link-domain-status' domain.id 'approved' %}"
>
{% csrf_token %}
< button type = "submit" class = "button is-success is-light" > {% trans "Approve" %}< / button >
< / form >
{% endif %}
{% if status != "blocked" %}
< form
name="domain-{{ domains.id }}-block"
class="control"
method="post"
action="{% url 'settings-link-domain-status' domain.id 'blocked' %}"
>
{% csrf_token %}
< button type = "submit" class = "button is-danger is-light" > {% trans "Block" %}< / button >
< / form >
{% endif %}
< / div >
2022-01-10 18:11:00 +00:00
< / 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 %}