Remove duplicate functionality

- remove customer hosting package list
- replace useless dashboard with redirect
- move all hosting package list for superuser to top level menu item
- replace btn-default with btn-secondary
- improve email address management page
This commit is contained in:
Jan Dittberner 2023-04-29 12:35:49 +02:00
parent 2d05580ed3
commit 866f6c8083
16 changed files with 142 additions and 214 deletions

View file

@ -4,72 +4,87 @@
{% block page_title %}{% translate "E-mail Addresses" %}{% endblock page_title %}
{% block content %}
{% if user.emailaddress_set.all %}
<p>{% translate 'The following e-mail addresses are associated with your account:' %}</p>
<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<table class="table table-condensed">
<thead>
<tr>
<th>{% translate "Email address" %}</th>
<th>{% translate "Verified" %}</th>
<th>{% translate "Primary" %}</th>
</tr>
</thead>
<tbody>
{% for emailaddress in user.emailaddress_set.all %}
<tr>
<td>{{ emailaddress.email }}</td>
<td>
{% if emailaddress.verified %}
<span class="verified">{% translate "Verified" %}</span>
{% else %}
<span class="unverified">{% translate "Unverified" %}</span>
{% endif %}
</td>
<td>
{% if emailaddress.primary %}
<span class="glyphicon glyphicon-star" title="{% translate "This is the current primary Email address" %}"></span>
{% else %}
<span class="glyphicon glyphicon-star-empty"></span>
{% endif %}
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary %}checked="checked"{%endif %} value="{{emailaddress.email}}" />
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>
<button class="btn btn-default" type="submit" name="action_primary" >{% translate 'Make Primary' %}</button>
<button class="btn btn-default" type="submit" name="action_send" >{% translate 'Re-send Verification' %}</button>
<button class="btn btn-warning" type="submit" name="action_remove" >{% translate 'Remove' %}</button>
</p>
</form>
{% else %}
<p class="text-warning"><strong>{% translate 'Warning:'%}</strong> {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
{% endif %}
{% if user.emailaddress_set.all %}
<p>{% translate 'The following e-mail addresses are associated with your account:' %}</p>
<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<table class="table table-condensed">
<thead>
<tr>
<th>{% translate "Email address" %}</th>
<th>{% translate "Verified" %}</th>
<th>{% translate "Primary" %}</th>
<th>{% translate "Selection" %}</th>
</tr>
</thead>
<tbody>
{% for emailaddress in user.emailaddress_set.all %}
<tr>
<td>{{ emailaddress.email }}</td>
<td>
{% if emailaddress.verified %}
<span class="text-success"><i class="bi-check-circle-fill" title="{% translate "Verified" %}"></i></span>
{% else %}
<span class="text-warning"><i class="bi-dash-circle-fill" title="{% translate "Unverified" %}"></i></span>
{% endif %}
</td>
<td>
{% if emailaddress.primary %}
<span class="text-success"><i class="bi-check-circle-fill" title="{% translate "This is the current primary Email address" %}"></i></span>
{% else %}
<span class="text-secondary"><i class="bi-circle"></i></span>
{% endif %}
</td>
<td>
<input id="email_radio_{{ forloop.counter }}" type="radio" name="email"
{% if emailaddress.primary %}checked="checked"{% endif %}
value="{{ emailaddress.email }}"/><label
for="email_radio_{{ forloop.counter }}"
aria-label="{% blocktranslate trimmed with address=emailaddress.email %}
Select {{ address }}
{% endblocktranslate %}"></label>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>
{% if user.emailaddress_set.count > 1 %}
<button class="btn btn-secondary" type="submit"
name="action_primary">{% translate 'Make Primary' %}</button>
{% endif %}
<button class="btn btn-secondary" type="submit"
name="action_send">{% translate 'Re-send Verification' %}</button>
<button class="btn btn-warning" type="submit" name="action_remove">{% translate 'Remove' %}</button>
</p>
</form>
{% else %}
<p class="text-warning">
<strong>{% translate 'Warning:' %}</strong> {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}
</p>
{% endif %}
<h2>{% translate "Add E-mail Address" %}</h2>
<h2>{% translate "Add E-mail Address" %}</h2>
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{{ form | crispy }}
<button name="action_add" type="submit" class="btn btn-primary">{% translate "Add E-mail" %}</button>
</form>
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{{ form | crispy }}
<button name="action_add" type="submit" class="btn btn-primary">{% translate "Add E-mail" %}</button>
</form>
{% endblock content %}
{% block extra_js %}
<script type="text/javascript">
(function() {
var message = "{% translate 'Do you really want to remove the selected e-mail address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
if (! confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
<script type="text/javascript">
(function () {
const message = "{% translate 'Do you really want to remove the selected e-mail address?' %}";
let actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function (e) {
if (!confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock extra_js %}

View file

@ -11,7 +11,7 @@
{% endblocktranslate %}</p>
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %}
<button type="submit" class="btn btn-default">{% translate 'Confirm' %}</button>
<button type="submit" class="btn btn-primary">{% translate 'Confirm' %}</button>
</form>
{% else %}
{% url 'account_email' as email_url %}

View file

@ -14,7 +14,7 @@
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
{% endif %}
<a class="btn btn-default" href="{% url 'account_reset_password' %}">{% translate "Forgot Password?" %}</a>
<a class="btn btn-secondary" href="{% url 'account_reset_password' %}">{% translate "Forgot Password?" %}</a>
<button class="btn btn-primary" type="submit">{% translate "Sign In" %}</button>
</form>
</div>

View file

@ -23,13 +23,7 @@
<body>
<nav class="navbar navbar-expand-lg sticky-top navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="{% spaceless %}
{% if user.is_authenticated %}
{% url 'customer_dashboard' slug=user.username %}
{% else %}
{% url 'dashboard' %}
{% endif %}
{% endspaceless %}" title="{% translate "Dashboard" %}">gnuviechadmin</a>
<a class="navbar-brand" href="{% url 'dashboard' %}" title="{% translate "Dashboard" %}">gnuviechadmin</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent"
aria-controls="navbarContent" aria-expanded="false" aria-label="{% translate "Toggle navigation" %}">
<span class="navbar-toggler-icon"></span>
@ -37,41 +31,34 @@
<div class="collapes navbar-collapse" id="navbarContent">
<ul class="navbar-nav me-auto mb-2 mg-lg-0">
{% if user.is_staff %}
<li class="nav-item dropdown{% if active_item == 'hostingpackage' %} active{% endif %}">
<li class="nav-item{% if active_item == "hosting" %} active{% endif %}">
<a class="nav-link" href="{% url 'all_hosting_packages' %}">
<i class="bi-boxes"></i> {% translate "Hosting" %}</a>
</li>
{% endif %}
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button"
aria-expanded="false"><i class="bi-server"></i> {% translate "Hosting" %}</a>
aria-expanded="false"><i class="bi-link"></i> {% translate "Links" %} </a>
<ul class="dropdown-menu" role="menu">
<li><a class="dropdown-item" href="{% url 'hosting_packages' user=user.username %}"><i
class="bi-box2-fill"></i> {% translate "Your hosting packages" %}</a></li>
<li><a class="dropdown-item" href="{% url 'all_hosting_packages' %}"><i
class="bi-boxes"></i> {% translate "All hosting packages" %}</a></li>
<li><a class="dropdown-item" href="{{ webmail_url }}"
title="{% translate "Web based mail system" %}"><i
class="bi-envelope-at"></i> {% translate "Webmail" %}</a></li>
<li><a class="dropdown-item" href="{{ phpmyadmin_url }}"
title="{% translate "phpMyAdmin - MySQL database administration tool" %}"><i
class="icon-mysql"></i> {% translate "phpMyAdmin" %}</a></li>
<li><a class="dropdown-item" href="{{ phppgadmin_url }}"
title="{% translate "phpPgAdmin - PostgreSQL database administration tool" %}"><i
class="icon-postgres"></i> {% translate "phpPgAdmin" %}</a></li>
</ul>
</li>
{% elif user.is_authenticated %}
<li class="nav-item{% if active_item == 'hostingpackage' %} active{% endif %}"><a
class="nav-link" href="{% url 'hosting_packages' user=user.username %}"><i
class="bi-server"></i> {% translate "Hosting" %}</a></li>
{% endif %}
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button"
aria-expanded="false"><i class="bi-link"></i> {% translate "Links" %} </a>
<ul class="dropdown-menu" role="menu">
<li><a class="dropdown-item" href="{{ webmail_url }}"
title="{% translate "Web based mail system" %}"><i
class="bi-envelope-at"></i> {% translate "Webmail" %}</a></li>
<li><a class="dropdown-item" href="{{ phpmyadmin_url }}"
title="{% translate "phpMyAdmin - MySQL database administration tool" %}"><i
class="icon-mysql"></i> {% translate "phpMyAdmin" %}</a></li>
<li><a class="dropdown-item" href="{{ phppgadmin_url }}"
title="{% translate "phpPgAdmin - PostgreSQL database administration tool" %}"><i
class="icon-postgres"></i> {% translate "phpPgAdmin" %}</a></li>
</ul>
</li>
<li class="nav-item{% if active_item == 'imprint' %} active{% endif %}"><a
class="nav-link" href="{% url 'imprint' %}"><i class="bi-info"></i> {% translate "Imprint" %}
</a></li>
<li class="nav-item{% if active_item == 'privacy' %} active{% endif %}"><a
class="nav-link" href="{% url 'privacy' %}"><i class="bi-file-text"></i> {% translate "Privacy policy" %}
class="nav-link" href="{% url 'privacy' %}"><i
class="bi-file-text"></i> {% translate "Privacy policy" %}
</a></li>
<li class="nav-item{% if active_item == 'contact' %} active{% endif %}"><a
class="nav-link" href="{% url 'contact_form' %}"><i
@ -79,7 +66,7 @@
</ul>
{% if user.is_authenticated %}
{% user_display user as user_display %}
{% url 'user_profile' slug=user.username as profile_url %}
{% url 'customer_dashboard' slug=user.username as profile_url %}
{% if user.is_impersonate %}
{% user_display user.impersonator as impersonator_display %}
{% url 'impersonate-stop' as stop_impersonation_url %}
@ -87,7 +74,8 @@
Signed in as
<a href="{{ profile_url }}" class="navbar-link" title="My Profile">{{ user_display }}</a>
<i class="bi-incognito" title="impersonated by {{ impersonator_display }}"></i>
<a href="{{ stop_impersonation_url }}" class="navbar-link"><i class="bi-sign-stop" title="stop impersonation"></i></a>
<a href="{{ stop_impersonation_url }}" class="navbar-link"><i class="bi-sign-stop"
title="stop impersonation"></i></a>
{% endblocktranslate %}</span>
{% else %}
<span class="navbar-text justify-content-end">{% blocktranslate trimmed %}

View file

@ -10,8 +10,8 @@
{% if page.object_list %}
<ul class="list-group">
{% for user in page.object_list %}
<li class="list-group-item"><a href="{% url 'impersonate-start' user.pk %}{{ redirect }}">{{ user }}</a>
- Impersonate
<li class="list-group-item"><a href="{% url 'impersonate-start' user.pk %}{{ redirect }}">
{% blocktranslate %}Impersonate {{ user }}{% endblocktranslate %}</a>
</li>
{% endfor %}
</ul>

View file

@ -13,15 +13,15 @@
placeholder="{% translate "user name part" %}" value="{% if query %}{{ query }}{% endif %}">
</div>
<button type="submit" class="btn btn-primary">{% translate "Search" %}</button>
<a class="btn btn-secondary" href="{% url 'impersonate-list' %}">{% translate "List all users" %}</a>
<a class="btn btn-link" href="{% url 'impersonate-list' %}">{% translate "List all users" %}</a>
</form>
<p>
{% if query and page.object_list %}
<ul class="list-group">
{% for user in page.object_list %}
<li class="list-group-item"><a
href="{% url 'impersonate-start' user.pk %}{{ redirect }}">{{ user }}</a> - Impersonate
<li class="list-group-item"><a href="{% url 'impersonate-start' user.pk %}{{ redirect }}">
{% blocktranslate %}Impersonate {{ user }}{% endblocktranslate %}</a>
</li>
{% endfor %}
</ul>

View file

@ -31,7 +31,7 @@
method="post">
{% csrf_token %}
<input class="btn btn-warning" type="submit" value="{% translate "Yes, do it!" %}"/>
<a class="btn btn-default" href="{{ hostingpackage.get_absolute_url }}">{% translate "Cancel" %}</a>
<a class="btn btn-secondary" href="{{ hostingpackage.get_absolute_url }}">{% translate "Cancel" %}</a>
</form>
</div>
</div>

View file

@ -39,7 +39,7 @@
<form action="{% url 'delete_ssh_key' package=hostingpackage.id pk=key.id %}" method="post">
{% csrf_token %}
<input class="btn btn-warning" type="submit" value="{% translate "Yes, do it!" %}"/>
<a class="btn btn-default" href="{% url 'list_ssh_keys' package=hostingpackage.id %}"
<a class="btn btn-secondary" href="{% url 'list_ssh_keys' package=hostingpackage.id %}"
title="{% translate "Cancel and go back to the SSH key list" %}">{% translate "Cancel" %}</a>
</form>
</div>

View file

@ -40,7 +40,7 @@
method="post">
{% csrf_token %}
<input class="btn btn-warning" type="submit" value="{% translate "Yes, do it!" %}"/>
<a class="btn btn-default" href="{{ hostingpackage.get_absolute_url }}">{% translate "Cancel" %}</a>
<a class="btn btn-secondary" href="{{ hostingpackage.get_absolute_url }}">{% translate "Cancel" %}</a>
</form>
</div>
</div>

View file

@ -36,7 +36,7 @@
method="post" class="form">
{% csrf_token %}
<input class="btn btn-warning" type="submit" value="{% translate "Yes, do it!" %}"/>
<a class="btn btn-default" href="{{ hostingpackage.get_absolute_url }}">{% translate "Cancel" %}</a>
<a class="btn btn-secondary" href="{{ hostingpackage.get_absolute_url }}">{% translate "Cancel" %}</a>
</form>
</div>
</div>