mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-27 10:30:32 +00:00
Form to edit link domain display names
This commit is contained in:
parent
32e3fdb438
commit
f580a51f24
4 changed files with 45 additions and 3 deletions
|
@ -216,6 +216,12 @@ class CoverForm(CustomForm):
|
|||
help_texts = {f: None for f in fields}
|
||||
|
||||
|
||||
class LinkDomainForm(CustomForm):
|
||||
class Meta:
|
||||
model = models.LinkDomain
|
||||
fields = ["id", "name"]
|
||||
|
||||
|
||||
class FileLinkForm(CustomForm):
|
||||
class Meta:
|
||||
model = models.FileLink
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
{% extends 'components/modal.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block modal-title %}
|
||||
{% blocktrans with url=domain.domain %}Set display name for {{ url }}{% endblocktrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-form-open %}
|
||||
<form name="edit-domain-{{ domain.id }}" method="post" action="{% url 'settings-link-domain' %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
{% csrf_token %}
|
||||
<label class="label" for="id_name">{% trans "Name:" %}</label>
|
||||
<div class="control">
|
||||
<input type="text" id="id_name" class="input" value="{{ domain.name }}">
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<button type="submit" class="button is-primary">{% trans "Set" %}</button>
|
||||
<button type="button" class="button" data-modal-close>{% trans "Cancel" %}</button>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-form-close %}</form>{% endblock %}
|
|
@ -1,6 +1,7 @@
|
|||
{% extends 'settings/layout.html' %}
|
||||
{% load humanize %}
|
||||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
|
||||
{% block title %}{% trans "Link Domains" %}{% endblock %}
|
||||
|
||||
|
@ -30,6 +31,7 @@
|
|||
</div>
|
||||
|
||||
{% for domain in domains %}
|
||||
{% join "domain" domain.id as domain_modal %}
|
||||
<div class="box content">
|
||||
<div class="columns is-mobile">
|
||||
<header class="column">
|
||||
|
@ -39,8 +41,10 @@
|
|||
</h3>
|
||||
</header>
|
||||
<div class="column is-narrow">
|
||||
{% trans "Set name" as button_text %}
|
||||
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_domain" controls_uid=domain.id focus="id_description" %}
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
|
@ -66,6 +70,8 @@
|
|||
</details>
|
||||
</div>
|
||||
|
||||
{% include "settings/link_domains/edit_domain_modal.html" with domain=domain id=domain_modal %}
|
||||
|
||||
<form name="domain-{{ domain.id }}">
|
||||
{% csrf_token %}
|
||||
<div class="field has-addons">
|
||||
|
|
|
@ -154,7 +154,12 @@ urlpatterns = [
|
|||
name="settings-email-blocks-delete",
|
||||
),
|
||||
re_path(
|
||||
r"^setting/link-domains/(?P<status>(pending|approved|blocked))/?",
|
||||
r"^setting/link-domains/(?P<status>(pending|approved|blocked|))/?",
|
||||
views.LinkDomain.as_view(),
|
||||
name="settings-link-domain",
|
||||
),
|
||||
re_path(
|
||||
r"^setting/link-domains/?",
|
||||
views.LinkDomain.as_view(),
|
||||
name="settings-link-domain",
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue