feat: format html templates and update VS Code settings

Formatted multiple HTML templates in the project for better readability and maintainability. Introduced indentation, adjusted spacing, and improved overall structure without altering the business logic or functionality.

Added VS Code settings to associate HTML files with Jinja syntax highlighting to enhance the development experience.

No functional changes introduced, focused solely on code readability and development efficiency improvements.
This commit is contained in:
Kumi 2024-06-23 14:37:15 +02:00
parent 1ba8f68a0e
commit 7e328f5554
Signed by: kumi
GPG key ID: ECBCC9082395383F
18 changed files with 439 additions and 336 deletions

5
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,5 @@
{
"files.associations": {
"*.html": "jinja-html"
}
}

View file

@ -1,9 +1,8 @@
{% extends "base_generic.html" %} {% block title %}Email Sent{% endblock %}
{% extends "base_generic.html" %}
{% block title %}Email Sent{% endblock %}
{% block content %}
<div class="container">
<div class="container">
<h2>Email Sent</h2>
<p>
A login link has been sent to your email address. Please check your inbox.
</p>
</div>
<p>A login link has been sent to your email address. Please check your inbox.</p>
</div>
{% endblock %}

View file

@ -1,14 +1,20 @@
{% extends "base_generic.html" %} {% block title %}Email Login{% endblock %}
{% block content %}{% load crispy_forms_tags %}
<div class="container">
{% extends "base_generic.html" %}
{% block title %}Email Login{% endblock %}
{% block content %}
{% load crispy_forms_tags %}
<div class="container">
<h2>Login</h2>
<p class="text-muted">Please login to access FreeDOI. If you don't have an
account yet, one will be created for you.</p>
<p class="text-muted">
Please login to access FreeDOI. If you don't have an
account yet, one will be created for you.
</p>
<form method="post">
{% csrf_token %} {{ form | crispy }}
<p class="text-muted">We will send you an email with a link to login.
By submitting this form, you agree to our Privacy Policy.</p>
<p class="text-muted">
We will send you an email with a link to login.
By submitting this form, you agree to our Privacy Policy.
</p>
<button type="submit" class="btn btn-primary">Send Login Link</button>
</form>
</div>
</div>
{% endblock %}

View file

@ -1,6 +1,7 @@
{% extends "base_generic.html" %}
{% block title %}Welcome to FreeDOI{% endblock%} {% block content %}
<div class="jumbotron text-center">
{% block title %}Welcome to FreeDOI{% endblock title %}
{% block content %}
<div class="jumbotron text-center">
<h1 class="display-4">Welcome to FreeDOI</h1>
<p class="lead">
FreeDOI is a system for managing and resolving Digital Object Identifiers
@ -19,9 +20,8 @@
system and cannot be resolved using https://doi.org &dash; the other way
around is possible, however.
</div>
</div>
<div id="learn-more" class="container mt-5">
</div>
<div id="learn-more" class="container mt-5">
<h2>What is FreeDOI?</h2>
<p>
FreeDOI is an alternative DOI system that allows users to create and manage
@ -29,20 +29,35 @@
prefixes (20. to 29.) to categorize different fields, such as:
</p>
<ul>
<li><strong>20.</strong> Science / Research / Education</li>
<li><strong>21.</strong> Computers / IT</li>
<li><strong>22.</strong> Entertainment / Art / Music / Video</li>
<li><strong>23.</strong> Literature</li>
<li><strong>24.</strong> Charity / Non-Profit</li>
<li><strong>25.</strong> Business</li>
<li><strong>26.</strong> Government</li>
<li><strong>29.</strong> Personal / Other</li>
<li>
<strong>20.</strong> Science / Research / Education
</li>
<li>
<strong>21.</strong> Computers / IT
</li>
<li>
<strong>22.</strong> Entertainment / Art / Music / Video
</li>
<li>
<strong>23.</strong> Literature
</li>
<li>
<strong>24.</strong> Charity / Non-Profit
</li>
<li>
<strong>25.</strong> Business
</li>
<li>
<strong>26.</strong> Government
</li>
<li>
<strong>29.</strong> Personal / Other
</li>
</ul>
<p>
FreeDOI also supports resolving official DOI prefixes (10.) to access
content from the official DOI system.
</p>
<h2>How Does It Work?</h2>
<p>
FreeDOI provides a simple and intuitive interface for creating and managing
@ -53,7 +68,7 @@
<strong>Register:</strong> Create an account to start managing DOIs.
</li>
<li>
<strong>Create Suffixes:</strong> Define suffixes for your organization or
<strong>Request Suffixes:</strong> Get suffixes for your organization or
project.
</li>
<li>
@ -65,7 +80,6 @@
associated with any DOI.
</li>
</ol>
<h2>Get Started</h2>
{% if user.is_authenticated %}
<p>
@ -80,14 +94,13 @@
</p>
<a class="btn btn-primary" href="{% url 'login' %}">Login or Sign Up</a>
{% endif %}
</div>
<div class="container mt-5">
</div>
<div class="container mt-5">
<h2>Contact Us</h2>
<p>
If you have any questions or need assistance, feel free to reach out to our
support team at
<a href="mailto:support@freedoi.org">support@freedoi.org</a>.
</p>
</div>
{% endblock %}
</div>
{% endblock content %}

View file

@ -1,16 +1,14 @@
{% extends "base_generic.html" %} {% block title %}Delete Identifier
{% endblock %} {% block content %}
<div class="container mt-5">
{% extends "base_generic.html" %}
{% block title %}Delete Identifier{% endblock title %}
{% block content %}
<div class="container mt-5">
<h1>Delete Identifier</h1>
<p>Are you sure you want to delete "{{ object.identifier }}"?</p>
<form method="post">
{% csrf_token %}
<button type="submit" class="btn btn-danger">Delete</button>
</form>
<a
class="btn btn-link mt-3"
href="{% url 'identifier_list' suffix_pk=object.suffix.pk %}"
>Back to identifiers</a
>
</div>
{% endblock %}
<a class="btn btn-link mt-3"
href="{% url 'identifier_list' suffix_pk=object.suffix.pk %}">Back to identifiers</a>
</div>
{% endblock content %}

View file

@ -1,26 +1,27 @@
{% extends "base_generic.html" %} {% block title %}Identifier Detail
{% endblock %} {% block content %}
<div class="container mt-5">
<h1>{{ object.identifier }}</h1>
<p><strong>Suffix:</strong> {{ object.suffix }}</p>
<p><strong>Target URL:</strong> {{ object.target_url }}</p>
<a
class="btn btn-secondary"
href="{% url 'identifier_update' suffix_pk=object.suffix.pk pk=object.pk %}"
>Edit</a
>
<form
method="post"
{% extends "base_generic.html" %}
{% block title %}
Identifier Detail
{% endblock title %}
{% block content %}
<div class="container mt-5">
<h1>{{ object.suffix.prefix.prefix }}.{{ object.suffix.suffix }}/{{ object.identifier }}</h1>
<p>
<strong>Prefix:</strong> {{ object.suffix.prefix.prefix }} ({{ object.suffix.prefix.name }})
<p>
<strong>Suffix:</strong> {{ object.suffix.suffix }} ({{ object.suffix.name }})
</p>
<p>
<strong>Target URL:</strong> {{ object.target_url }}
</p>
<a class="btn btn-secondary"
href="{% url 'identifier_update' suffix_pk=object.suffix.pk pk=object.pk %}">Edit</a>
<form method="post"
action="{% url 'identifier_delete' suffix_pk=object.suffix.pk pk=object.pk %}"
style="display: inline"
>
style="display: inline">
{% csrf_token %}
<input class="btn btn-danger" type="submit" value="Delete" />
</form>
<a
class="btn btn-link"
href="{% url 'identifier_list' suffix_pk=object.suffix.pk %}"
>Back to identifiers</a
>
</div>
{% endblock %}
<a class="btn btn-link"
href="{% url 'identifier_list' suffix_pk=object.suffix.pk %}">Back to identifiers</a>
</div>
{% endblock content %}

View file

@ -1,21 +1,30 @@
{% extends "base_generic.html" %} {% block title %}
{% if form.instance.pk %}Edit{% else %}Create{% endif %} Identifier
{% endblock %} {% load crispy_forms_tags %} {% block content %}
<div class="container mt-5">
<h1>{% if form.instance.pk %}Edit{% else %}Create{% endif %} Identifier</h1>
<form method="post">
{% if form.errors %}
<div class="alert alert-danger" role="alert">
{{ form.errors }}
</div>
{% extends "base_generic.html" %}
{% load crispy_forms_tags %}
{% block title %}
{% if form.instance.pk %}
Edit
{% else %}
Create
{% endif %}
{% csrf_token %} {{ form | crispy }}
Identifier
{% endblock title %}
{% block content %}
<div class="container mt-5">
<h1>
{% if form.instance.pk %}
Edit
{% else %}
Create
{% endif %}
Identifier
</h1>
<form method="post">
{% if form.errors %}<div class="alert alert-danger" role="alert">{{ form.errors }}</div>{% endif %}
{% csrf_token %}
{{ form | crispy }}
<button type="submit" class="btn btn-primary">Save</button>
</form>
<a
class="btn btn-link mt-3"
href="{% url 'identifier_list' suffix_pk=form.instance.suffix.pk %}"
>Back to identifiers</a
>
</div>
{% endblock %}
<a class="btn btn-link mt-3"
href="{% url 'identifier_list' suffix_pk=form.instance.suffix.pk %}">Back to identifiers</a>
</div>
{% endblock content %}

View file

@ -1,24 +1,22 @@
{% extends "base_generic.html" %} {% block title %}Identifiers{% endblock %}
{% extends "base_generic.html" %}
{% block title %}
Identifiers
{% endblock title %}
{% block content %}
<div class="container mt-5">
<h1>Identifiers{% if suffix %} for {{ suffix.name }}{% endif %}</h1>
<div class="container mt-5">
<h1>
Identifiers
{% if suffix %}for {{ suffix.name }}{% endif %}
</h1>
<ul class="list-group">
{% for identifier in object_list %}
<li class="list-group-item">
<a
href="{% url 'identifier_detail' suffix_pk=identifier.suffix.pk pk=identifier.pk %}"
>{{ identifier.identifier }}</a
>
<a href="{% url 'identifier_detail' suffix_pk=identifier.suffix.pk pk=identifier.pk %}">{{ identifier.suffix.prefix.prefix }}.{{ identifier.suffix.suffix }}/{{ identifier.identifier }}</a>
</li>
{% endfor %}
</ul>
<a
class="btn btn-primary mt-3"
href="{% if suffix.pk %}{% url 'identifier_create' suffix_pk=suffix.pk %}{% else %}{% url 'identifier_create' %}{% endif %}"
>Create new identifier</a
>
<a class="btn btn-link mt-3" href="{% url 'suffix_list' %}"
>Back to suffixes</a
>
</div>
{% endblock %}
<a class="btn btn-primary mt-3"
href="{% if suffix.pk %}{% url 'identifier_create' suffix_pk=suffix.pk %}{% else %}{% url 'identifier_create' %}{% endif %}">Create new identifier</a>
<a class="btn btn-link mt-3" href="{% url 'suffix_list' %}">Back to suffixes</a>
</div>
{% endblock content %}

View file

@ -3,6 +3,9 @@
<div class="container mt-5">
<h1>Pending Suffixes</h1>
<ul class="list-group">
{% if pending_suffixes|length == 0 %}
<li class="list-group-item">No pending suffixes</li>
{% endif %}
{% for suffix in pending_suffixes %}
<li class="list-group-item">
<a href="{% url 'suffix_approval' suffix.pk %}">{{ suffix.prefix.prefix }}.{{ suffix.suffix }} &dash; {{ suffix.name }}</a>

View file

@ -1,10 +1,11 @@
{% extends "base_generic.html" %} {% block title %}Delete Prefix{% endblock %}
{% extends "base_generic.html" %}
{% block title %}Delete Prefix{% endblock title %}
{% block content %}
<h1>Delete Prefix</h1>
<p>Are you sure you want to delete "{{ object.name }}"?</p>
<form method="post">
<h1>Delete Prefix</h1>
<p>Are you sure you want to delete "{{ object.name }}"?</p>
<form method="post">
{% csrf_token %}
<input class="btn btn-danger" type="submit" value="Delete" />
</form>
<a class="btn btn-link" href="{% url 'prefix_list' %}">Back to list</a>
{% endblock %}
</form>
<a class="btn btn-link" href="{% url 'prefix_list' %}">Back to list</a>
{% endblock content %}

View file

@ -1,17 +1,26 @@
{% extends "base_generic.html" %} {% block title %}Prefix Detail{% endblock %}
{% extends "base_generic.html" %}
{% block title %}
Prefix Detail
{% endblock title %}
{% block content %}
<h1>{{ object.name }}</h1>
<p><strong>Prefix:</strong> {{ object.prefix }}</p>
<p><strong>Type:</strong> {{ object.get_type_display }}</p>
<p><strong>Remote Resolver:</strong> {{ object.remote_resolver }}</p>
<a class="btn btn-secondary" href="{% url 'prefix_update' object.pk %}">Edit</a>
<form
method="post"
<h1>{{ object.name }}</h1>
<p>
<strong>Prefix:</strong> {{ object.prefix }} ({{ object.prefix.name }})
</p>
<p>
<strong>Type:</strong> {{ object.get_type_display }}
</p>
{% if object.type == "remote" %}
<p>
<strong>Remote Resolver:</strong> {{ object.remote_resolver }}
</p>
{% endif %}
<a class="btn btn-secondary" href="{% url 'prefix_update' object.pk %}">Edit</a>
<form method="post"
action="{% url 'prefix_delete' object.pk %}"
style="display: inline"
>
class="d-inline">
{% csrf_token %}
<input class="btn btn-danger" type="submit" value="Delete" />
</form>
<a class="btn btn-link" href="{% url 'prefix_list' %}">Back to list</a>
{% endblock %}
</form>
<a class="btn btn-link" href="{% url 'prefix_list' %}">Back to list</a>
{% endblock content %}

View file

@ -1,15 +1,26 @@
{% extends "base_generic.html" %} {% block title %}
{% if form.instance.pk %}Edit{% else %}Create{% endif %} Prefix{% endblock %}
{% load crispy_forms_tags %} {% block content %}
<h1>{% if form.instance.pk %}Edit{% else %}Create{% endif %} Prefix</h1>
<form method="post">
{% if form.errors %}
<div class="alert alert-danger" role="alert">
{{ form.errors }}
</div>
{% extends "base_generic.html" %}
{% block title %}
{% if form.instance.pk %}
Edit
{% else %}
Create
{% endif %}
Prefix
{% endblock title %}
{% load crispy_forms_tags %}
{% block content %}
<h1>
{% if form.instance.pk %}
Edit
{% else %}
Create
{% endif %}
Prefix
</h1>
<form method="post">
{% if form.errors %}<div class="alert alert-danger" role="alert">{{ form.errors }}</div>{% endif %}
{% csrf_token %} {{ form | crispy }}
<input class="btn btn-primary" type="submit" value="Save" />
</form>
<a class="btn btn-link" href="{% url 'prefix_list' %}">Back to list</a>
{% endblock %}
</form>
<a class="btn btn-link" href="{% url 'prefix_list' %}">Back to list</a>
{% endblock content %}

View file

@ -1,7 +1,18 @@
{% extends "base_generic.html" %} {% block title %}Prefixes{% endblock %}
{% extends "base_generic.html" %}
{% block title %}
Prefixes
{% endblock title %}
{% block content %}
<h1>Prefixes</h1>
<ul class="list-group">
<h1>Prefixes</h1>
<ul class="list-group">
{% if object_list|length == 0 %}
<li class="list-group-item">
No prefixes.
{% if not user.is_superuser}You can request prefixes by contacting the administrator.
{% endif %}
{% endif %}
</li>
{% endif %}
{% for prefix in object_list %}
<li class="list-group-item">
<a href="{% url 'prefix_detail' prefix.pk %}">{{ prefix.prefix }} &dash; {{ prefix.name }}</a>
@ -9,8 +20,6 @@
{% endfor %}
</ul>
{% if user.is_superuser %}
<a class="btn btn-primary mt-3" href="{% url 'prefix_create' %}"
>Create new prefix</a
>
<a class="btn btn-primary mt-3" href="{% url 'prefix_create' %}">Create new prefix</a>
{% endif %}
{% endblock %}
{% endblock content %}

View file

@ -1,13 +1,15 @@
{% extends "base_generic.html" %} {% block title %}Approve Suffix{% endblock %}
{% load crispy_forms_tags %}{% block content %}
<div class="container mt-5">
{% extends "base_generic.html" %}
{% block title %}
Approve Suffix
{% endblock title %}
{% load crispy_forms_tags %}
{% block content %}
<div class="container mt-5">
<h1>Approve Suffix</h1>
<form method="post">
{% csrf_token %} {{ form | crispy }}
<button type="submit" class="btn btn-primary">Approve</button>
<a class="btn btn-link" href="{% url 'pending_suffixes' %}"
>Back to pending suffixes</a
>
<a class="btn btn-link" href="{% url 'pending_suffixes' %}">Back to pending suffixes</a>
</form>
</div>
{% endblock %}
</div>
{% endblock content %}

View file

@ -1,6 +1,9 @@
{% extends "base_generic.html" %} {% block title %}Delete Suffix{% endblock %}
{% extends "base_generic.html" %}
{% block title %}
Delete Suffix
{% endblock title %}
{% block content %}
<div class="container mt-5">
<div class="container mt-5">
<h1>Delete Suffix</h1>
<p>Are you sure you want to delete "{{ object.name }}"?</p>
<form method="post">
@ -8,5 +11,5 @@
<button type="submit" class="btn btn-danger">Delete</button>
</form>
<a class="btn btn-link mt-3" href="{% url 'suffix_list' %}">Back to list</a>
</div>
{% endblock %}
</div>
{% endblock content %}

View file

@ -1,30 +1,41 @@
{% extends "base_generic.html" %} {% block title %}Suffix Detail{% endblock %}
{% extends "base_generic.html" %}
{% block title %}
Suffix Detail
{% endblock title %}
{% block content %}
<div class="container mt-5">
<div class="container mt-5">
<h1>{{ object.name }}</h1>
<p><strong>Suffix:</strong> {{ object.suffix }}</p>
<p><strong>Prefix:</strong> {{ object.prefix }}</p>
<p><strong>Type:</strong> {{ object.get_type_display }}</p>
<p>
<strong>Suffix:</strong> {{ object.suffix }}
</p>
<p>
<strong>Prefix:</strong> {{ object.prefix }}
</p>
<p>
<strong>Type:</strong> {{ object.get_type_display }}
</p>
{% if object.type == "remote" %}
<p><strong>Remote Resolver:</strong> {{ object.remote_resolver }}</p>
<p>
<strong>Remote Resolver:</strong> {{ object.remote_resolver }}
</p>
{% endif %}
<p><strong>Approval:</strong> {% if object.approved %}Approved{% else %}Pending{% endif %}</p>
<a class="btn btn-secondary" href="{% url 'suffix_update' object.pk %}"
>Edit</a
>
<form
method="post"
<p>
<strong>Approval:</strong>
{% if object.approved %}
Approved
{% else %}
Pending
{% endif %}
</p>
<a class="btn btn-secondary" href="{% url 'suffix_update' object.pk %}">Edit</a>
<form method="post"
action="{% url 'suffix_delete' object.pk %}"
style="display: inline"
>
style="display: inline">
{% csrf_token %}
<input class="btn btn-danger" type="submit" value="Delete" />
</form>
<a
class="btn btn-primary"
href="{% url 'identifier_list' suffix_pk=object.pk %}"
>View Identifiers</a
>
<a class="btn btn-primary"
href="{% url 'identifier_list' suffix_pk=object.pk %}">View Identifiers</a>
<a class="btn btn-link" href="{% url 'suffix_list' %}">Back to list</a>
</div>
{% endblock %}
</div>
{% endblock content %}

View file

@ -1,21 +1,39 @@
{% extends "base_generic.html" %} {% block title %}
{% if form.instance.pk %}Edit{% else %}Request{% endif %} Suffix{% endblock %}
{% load crispy_forms_tags %}{% block content %}
<div class="container mt-5">
<h1>{% if form.instance.pk %}Edit{% else %}Create{% endif %} Suffix</h1>
<form method="post">
{% if form.errors %}
<div class="alert alert-danger" role="alert">
{{ form.errors }}
</div>
{% extends "base_generic.html" %}
{% block title %}
{% if form.instance.pk %}
Edit
{% else %}
Request
{% endif %}
Suffix
{% endblock title %}
{% load crispy_forms_tags %}
{% block content %}
<div class="container mt-5">
<h1>
{% if form.instance.pk %}
Edit
{% else %}
Create
{% endif %}
Suffix
</h1>
<form method="post">
{% if form.errors %}<div class="alert alert-danger" role="alert">{{ form.errors }}</div>{% endif %}
{% csrf_token %} {{ form | crispy }}
<p class="text-muted">Please make sure to include a full description of
your intended use of the suffix in the "Description" field. Your request
may be rejected if this information is not provided, or if the selected
prefix is not appropriate for your intended use.</p>
<p class="text-muted">
Please make sure to include a full description of your intended use of the
suffix in the "Description" field. Your request may be rejected if this
information is not provided, or if the selected prefix is not appropriate
for your intended use.
</p>
<p class="text-muted">
Note that the suffix will not be resolvable until it has been approved by
the administrator, and that using the suffix for other than the intended
purpose may result in the suffix being revoked.
</p>
<button type="submit" class="btn btn-primary">Save</button>
</form>
<a class="btn btn-link mt-3" href="{% url 'suffix_list' %}">Back to list</a>
</div>
{% endblock %}
</div>
{% endblock content %}

View file

@ -1,16 +1,23 @@
{% extends "base_generic.html" %} {% block title %}Suffixes{% endblock %}
{% extends "base_generic.html" %}
{% block title %}
Suffixes
{% endblock title %}
{% block content %}
<div class="container mt-5">
<div class="container mt-5">
<h1>Suffixes</h1>
<ul class="list-group">
{% if object_list|length == 0 %}
<li class="list-group-item">
No suffixes.
<a href="{% url 'suffix_create' %}">Request a suffix now</a> to start issuing DOIs.
</li>
{% endif %}
{% for suffix in object_list %}
<li class="list-group-item">
<a href="{% url 'suffix_detail' suffix.pk %}">{{ suffix.suffix.prefix }}.{{ suffix.suffix }} &dash; {{ suffix.name }}</a>
</li>
{% endfor %}
</ul>
<a class="btn btn-primary mt-3" href="{% url 'suffix_create' %}"
>Create new suffix</a
>
</div>
{% endblock %}
<a class="btn btn-primary mt-3" href="{% url 'suffix_create' %}">Request new suffix</a>
</div>
{% endblock content %}