Creates link template subdirectory
This commit is contained in:
43
bookwyrm/templates/book/file_links/add_link_modal.html
Normal file
43
bookwyrm/templates/book/file_links/add_link_modal.html
Normal file
@ -0,0 +1,43 @@
|
||||
{% extends 'components/modal.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block modal-title %}
|
||||
{% trans "Add file link" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-form-open %}
|
||||
<form name="add-link" method="POST" action="{% url 'file-link-add' book.id %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input type="hidden" name="added_by" value="{{ request.user.id }}">
|
||||
|
||||
<p class="notification">
|
||||
{% trans "Links from unknown domains will need to be approved by a moderator before they are added." %}
|
||||
</p>
|
||||
|
||||
<div class="columns">
|
||||
<div class="column is-four-fifths">
|
||||
<label class="label" for="id_url">{% trans "URL:" %}</label>
|
||||
<input type="url" name="url" maxlength="255" class="input" required="" id="id_url" value="{% firstof file_link_form.url.value "" %}" placeholder="https://..." aria-describedby="desc_name">
|
||||
{% include 'snippets/form_errors.html' with errors_list=file_link_form.url.errors id="desc_url" %}
|
||||
</div>
|
||||
<div class="column is-one-fifth">
|
||||
<label class="label" for="id_filetype">{% trans "File type:" %}</label>
|
||||
<input type="text" name="filetype" maxlength="5" class="input" required="" id="id_filetype" value="{% firstof file_link_form.filetype.value "" %}" placeholder="PDF">
|
||||
{% include 'snippets/form_errors.html' with errors_list=file_link_form.filetype.errors id="desc_filetype" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<button class="button is-primary" type="submit">{% trans "Save" %}</button>
|
||||
{% if not static %}
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
{% block modal-form-close %}</form>{% endblock %}
|
82
bookwyrm/templates/book/file_links/edit_links.html
Normal file
82
bookwyrm/templates/book/file_links/edit_links.html
Normal file
@ -0,0 +1,82 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
|
||||
{% block title %}{% trans "Edit links" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<header class="block content">
|
||||
<h1 class="title">
|
||||
{% blocktrans with title=book|book_title %}
|
||||
Links for "<em>{{ title }}</em>"
|
||||
{% endblocktrans %}
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
|
||||
<ul>
|
||||
<li><a href="{% url 'book' book.id %}">{{ book|book_title }}</a></li>
|
||||
<li class="is-active">
|
||||
<a href="#" aria-current="page">
|
||||
{% trans "Edit links" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<section class="block content">
|
||||
<div class="table-container">
|
||||
<table class="is-striped is-fullwidth">
|
||||
<tr>
|
||||
<th>{% trans "URL" %}</th>
|
||||
<th>{% trans "Added by" %}</th>
|
||||
<th>{% trans "Filetype" %}</th>
|
||||
<th>{% trans "Domain" %}</th>
|
||||
<th>{% trans "Actions" %}</th>
|
||||
</tr>
|
||||
{% for link in book.file_links.all %}
|
||||
<tr>
|
||||
<td class="overflow-wrap-anywhere">
|
||||
<a href="{{ link.url }}" target="_blank" rel="noopener">{{ link.url }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'user-feed' link.added_by.id %}">{{ link.added_by.display_name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ link.filelink.filetype }}
|
||||
</td>
|
||||
<td>
|
||||
{{ link.domain.name }} ({{ link.domain.get_status_display }})
|
||||
<p>
|
||||
<a href="{% url 'report-link' link.added_by.id link.id %}">{% trans "Report spam" %}</a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<form name="delete-link-{{ link.id }}" class="control" method="post" action="{% url 'file-link' book.id link.id %}">
|
||||
{% csrf_token %}
|
||||
<button class="button is-danger is-light" type="submit">Delete link</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if not book.file_links.exists %}
|
||||
<tr>
|
||||
<td colspan="5"><em>{% trans "No links available for this book." %}</em></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% url 'file-link-add' book.id as fallback_url %}
|
||||
<form name="add-link" method="get" action="{{ fallback_url }}">
|
||||
<button class="button" type="submit" data-modal-open="add-links">
|
||||
<span class="icon icon-plus m-0-mobile" aria-hidden="true"></span>
|
||||
<span class="is-sr-only-mobile">
|
||||
{% trans "Add link to file" %}
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
10
bookwyrm/templates/book/file_links/file_link_page.html
Normal file
10
bookwyrm/templates/book/file_links/file_link_page.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% extends 'layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}
|
||||
{% trans "File Links" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "book/file_links/add_link_modal.html" with book=book active=True static=True id="file-link" %}
|
||||
{% endblock %}
|
52
bookwyrm/templates/book/file_links/links.html
Normal file
52
bookwyrm/templates/book/file_links/links.html
Normal file
@ -0,0 +1,52 @@
|
||||
{% load i18n %}
|
||||
{% load bookwyrm_tags %}
|
||||
{% load utilities %}
|
||||
|
||||
{% get_book_file_links book as links %}
|
||||
{% if links.exists or request.user.is_authenticated %}
|
||||
<header class="columns is-mobile mb-0">
|
||||
<div class="column">
|
||||
<h2 class="title is-5">{% trans "Get a copy" %}</h2>
|
||||
</div>
|
||||
{% if can_edit_book %}
|
||||
<div class="column is-narrow">
|
||||
{% url 'file-link-add' book.id as fallback_url %}
|
||||
<form name="add-link" method="get" action="{{ fallback_url }}">
|
||||
<button class="button is-small" type="submit" data-modal-open="add-links">
|
||||
<span class="icon icon-plus">
|
||||
<span class="is-sr-only">
|
||||
{% trans "Add link to file" %}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</header>
|
||||
{% if links %}
|
||||
<ul class="mt-0">
|
||||
{% for link in links.all %}
|
||||
{% join "verify" link.id as verify_modal %}
|
||||
<li>
|
||||
<a href="{{ link.url }}" rel="noopener" target="_blank" title="{{ link.url }}" data-modal-open="{{ verify_modal }}">{{ link.name }}</a>
|
||||
({{ link.filetype }})
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% for link in links.all %}
|
||||
{% join "verify" link.id as verify_modal %}
|
||||
{% include "book/file_links/verification_modal.html" with id=verify_modal %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<em>{% trans "No links available" %}</em>
|
||||
{% endif %}
|
||||
|
||||
{% if can_edit_book and links.exists %}
|
||||
<a href="{% url 'file-link' book.id %}" class="is-pulled-right">
|
||||
<span class="icon icon-pencil" aria-hidden="true"></span>
|
||||
<span>{% trans "Edit links" %}</span>
|
||||
</a>
|
||||
{% include 'book/file_links/add_link_modal.html' with book=book id="add-links" %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
29
bookwyrm/templates/book/file_links/verification_modal.html
Normal file
29
bookwyrm/templates/book/file_links/verification_modal.html
Normal file
@ -0,0 +1,29 @@
|
||||
{% extends 'components/modal.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block modal-title %}
|
||||
{% trans "Leaving BookWyrm" %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block modal-body %}
|
||||
|
||||
{% blocktrans trimmed with link_url=link.url %}
|
||||
This link is taking you to: <code>{{ link_url }}</code>.<br>
|
||||
Is that where you'd like to go?
|
||||
{% endblocktrans %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block modal-footer %}
|
||||
<a href="{{ link.url }}" target="_blank" rel="noopener" class="button is-primary">{% trans "Continue" %}</a>
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
<div class="has-text-right is-flex-grow-1">
|
||||
<a href="{% url 'report-link' link.added_by.id link.id %}">{% trans "Report spam" %}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
Reference in New Issue
Block a user