Adds link confirmation modal

This commit is contained in:
Mouse Reeve
2022-01-10 11:47:52 -08:00
parent 4dfe9fd714
commit 8ba3a4ab00
4 changed files with 32 additions and 3 deletions

View File

@ -0,0 +1,22 @@
{% 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>. 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>
{% endblock %}

View File

@ -1,5 +1,7 @@
{% load i18n %}
{% load bookwyrm_tags %}
{% load utilities %}
{% get_book_file_links book as links %}
<header class="columns is-mobile mb-0">
<div class="column">
@ -21,12 +23,17 @@
{% 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 }}">{{ link.name }}</a>
<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/link_verification_modal.html" with id=verify_modal %}
{% endfor %}
{% endif %}
{% if can_edit_book %}