forked from mirrors/bookwyrm
Brings federation page html in line with html validator
This commit is contained in:
parent
65d7f50811
commit
2befef7deb
2 changed files with 43 additions and 51 deletions
|
@ -19,18 +19,14 @@
|
||||||
<h2 class="title is-4">{% trans "Details" %}</h2>
|
<h2 class="title is-4">{% trans "Details" %}</h2>
|
||||||
<div class="box is-flex-grow-1 content">
|
<div class="box is-flex-grow-1 content">
|
||||||
<dl>
|
<dl>
|
||||||
<div class="is-flex">
|
<dt class="is-pulled-left mr-5">{% trans "Software:" %}</dt>
|
||||||
<dt>{% trans "Software:" %}</dt>
|
<dd>{{ server.application_type }}</dd>
|
||||||
<dd>{{ server.application_type }}</dd>
|
|
||||||
</div>
|
<dt class="is-pulled-left mr-5">{% trans "Version:" %}</dt>
|
||||||
<div class="is-flex">
|
<dd>{{ server.application_version }}</dd>
|
||||||
<dt>{% trans "Version:" %}</dt>
|
|
||||||
<dd>{{ server.application_version }}</dd>
|
<dt class="is-pulled-left mr-5">{% trans "Status:" %}</dt>
|
||||||
</div>
|
<dd>{{ server.get_status_display }}</dd>
|
||||||
<div class="is-flex">
|
|
||||||
<dt>{% trans "Status:" %}</dt>
|
|
||||||
<dd>{{ server.get_status_display }}</dd>
|
|
||||||
</div>
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -39,38 +35,32 @@
|
||||||
<h2 class="title is-4">{% trans "Activity" %}</h2>
|
<h2 class="title is-4">{% trans "Activity" %}</h2>
|
||||||
<div class="box is-flex-grow-1 content">
|
<div class="box is-flex-grow-1 content">
|
||||||
<dl>
|
<dl>
|
||||||
<div class="is-flex">
|
<dt class="is-pulled-left mr-5">{% trans "Users:" %}</dt>
|
||||||
<dt>{% trans "Users:" %}</dt>
|
<dd>
|
||||||
<dd>
|
{{ users.count }}
|
||||||
{{ users.count }}
|
{% if server.user_set.count %}(<a href="{% url 'settings-users' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
||||||
{% if server.user_set.count %}(<a href="{% url 'settings-users' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
</dd>
|
||||||
</dd>
|
|
||||||
</div>
|
<dt class="is-pulled-left mr-5">{% trans "Reports:" %}</dt>
|
||||||
<div class="is-flex">
|
<dd>
|
||||||
<dt>{% trans "Reports:" %}</dt>
|
{{ reports.count }}
|
||||||
<dd>
|
{% if reports.count %}(<a href="{% url 'settings-reports' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
||||||
{{ reports.count }}
|
</dd>
|
||||||
{% if reports.count %}(<a href="{% url 'settings-reports' %}?server={{ server.server_name }}">{% trans "View all" %}</a>){% endif %}
|
|
||||||
</dd>
|
<dt class="is-pulled-left mr-5">{% trans "Followed by us:" %}</dt>
|
||||||
</div>
|
<dd>
|
||||||
<div class="is-flex">
|
{{ followed_by_us.count }}
|
||||||
<dt>{% trans "Followed by us:" %}</dt>
|
</dd>
|
||||||
<dd>
|
|
||||||
{{ followed_by_us.count }}
|
<dt class="is-pulled-left mr-5">{% trans "Followed by them:" %}</dt>
|
||||||
</dd>
|
<dd>
|
||||||
</div>
|
{{ followed_by_them.count }}
|
||||||
<div class="is-flex">
|
</dd>
|
||||||
<dt>{% trans "Followed by them:" %}</dt>
|
|
||||||
<dd>
|
<dt class="is-pulled-left mr-5">{% trans "Blocked by us:" %}</dt>
|
||||||
{{ followed_by_them.count }}
|
<dd>
|
||||||
</dd>
|
{{ blocked_by_us.count }}
|
||||||
</div>
|
</dd>
|
||||||
<div class="is-flex">
|
|
||||||
<dt>{% trans "Blocked by us:" %}</dt>
|
|
||||||
<dd>
|
|
||||||
{{ blocked_by_us.count }}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -86,14 +76,13 @@
|
||||||
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_notes" %}
|
{% include 'snippets/toggle/open_button.html' with text=button_text icon_with_text="pencil" controls_text="edit_notes" %}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{% if server.notes %}
|
{% trans "<em>No notes</em>" as null_text %}
|
||||||
<div class="box" id="hide_edit_notes">{{ server.notes|to_markdown|safe }}</div>
|
<div class="box" id="hide_edit_notes">{{ server.notes|to_markdown|default:null_text|safe }}</div>
|
||||||
{% endif %}
|
|
||||||
<form class="box is-hidden" method="POST" action="{% url 'settings-federated-server' server.id %}" id="edit_notes">
|
<form class="box is-hidden" method="POST" action="{% url 'settings-federated-server' server.id %}" id="edit_notes">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<p>
|
<p>
|
||||||
<label class="is-sr-only" for="id_notes">Notes:</label>
|
<label class="is-sr-only" for="id_notes">Notes:</label>
|
||||||
<textarea name="notes" cols="None" rows="None" class="textarea" id="id_notes">{{ server.notes|default:"" }}</textarea>
|
<textarea name="notes" cols="40" rows="5" class="textarea" id="id_notes">{{ server.notes|default:"" }}</textarea>
|
||||||
</p>
|
</p>
|
||||||
<button type="submit" class="button is-primary">{% trans "Save" %}</button>
|
<button type="submit" class="button is-primary">{% trans "Save" %}</button>
|
||||||
{% trans "Cancel" as button_text %}
|
{% trans "Cancel" as button_text %}
|
||||||
|
|
|
@ -51,13 +51,16 @@ class FederationViews(TestCase):
|
||||||
html = result.render()
|
html = result.render()
|
||||||
_, errors = tidy_document(
|
_, errors = tidy_document(
|
||||||
html.content,
|
html.content,
|
||||||
options={"drop-empty-elements": False, "drop-proprietary-attributes": False}
|
options={
|
||||||
|
"drop-empty-elements": False,
|
||||||
|
"warn-proprietary-attributes": False,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
if errors:
|
if errors:
|
||||||
raise Exception(errors)
|
raise Exception(errors)
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
def test_server_page(self):
|
def test_instance_page(self):
|
||||||
"""there are so many views, this just makes sure it LOADS"""
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
server = models.FederatedServer.objects.create(server_name="hi.there.com")
|
server = models.FederatedServer.objects.create(server_name="hi.there.com")
|
||||||
view = views.FederatedServer.as_view()
|
view = views.FederatedServer.as_view()
|
||||||
|
@ -68,7 +71,7 @@ class FederationViews(TestCase):
|
||||||
result = view(request, server.id)
|
result = view(request, server.id)
|
||||||
self.assertIsInstance(result, TemplateResponse)
|
self.assertIsInstance(result, TemplateResponse)
|
||||||
html = result.render()
|
html = result.render()
|
||||||
_, errors = tidy_document(html.content)
|
_, errors = tidy_document(html.content, options={"drop-empty-elements": False})
|
||||||
if errors:
|
if errors:
|
||||||
raise Exception(errors)
|
raise Exception(errors)
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
Loading…
Reference in a new issue