Make URLs patterns homogeneus

This commit is contained in:
Santiago L 2021-09-27 13:52:27 +02:00
parent 6d7ee0b76a
commit 98dfa7a9f4
8 changed files with 23 additions and 22 deletions

View File

@ -12,10 +12,10 @@ class CustomContextMixin(ContextMixin):
# generate services menu items # generate services menu items
services_menu = [ services_menu = [
{'icon': 'globe-europe', 'pattern_name': 'musician:dashboard', 'title': _('Domains & websites')}, {'icon': 'globe-europe', 'pattern_name': 'musician:dashboard', 'title': _('Domains & websites')},
{'icon': 'envelope', 'pattern_name': 'musician:mails', 'title': _('Mails')}, {'icon': 'envelope', 'pattern_name': 'musician:address-list', 'title': _('Mails')},
{'icon': 'mail-bulk', 'pattern_name': 'musician:mailing-lists', 'title': _('Mailing lists')}, {'icon': 'mail-bulk', 'pattern_name': 'musician:mailing-lists', 'title': _('Mailing lists')},
{'icon': 'database', 'pattern_name': 'musician:databases', 'title': _('Databases')}, {'icon': 'database', 'pattern_name': 'musician:database-list', 'title': _('Databases')},
{'icon': 'fire', 'pattern_name': 'musician:saas', 'title': _('SaaS')}, {'icon': 'fire', 'pattern_name': 'musician:saas-list', 'title': _('SaaS')},
] ]
context.update({ context.update({
'services_menu': services_menu, 'services_menu': services_menu,

View File

@ -21,7 +21,7 @@
<tbody> <tbody>
{% for obj in object_list %} {% for obj in object_list %}
<tr> <tr>
<td><a href="{% url 'musician:mail-update' obj.id %}">{{ obj.mail_address }}</a></td> <td><a href="{% url 'musician:address-update' obj.id %}">{{ obj.mail_address }}</a></td>
<td>{{ obj.domain.name }}</td> <td>{{ obj.domain.name }}</td>
<td> <td>
{% for mailbox in obj.mailboxes %} {% for mailbox in obj.mailboxes %}
@ -34,7 +34,7 @@
</tbody> </tbody>
{% include "musician/components/table_paginator.html" %} {% include "musician/components/table_paginator.html" %}
</table> </table>
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mail-create' %}">{% trans "New mail address" %}</a> <a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:address-create' %}">{% trans "New mail address" %}</a>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -71,7 +71,7 @@
<span class="text-{{ domain.addresses_left.alert_level }}">{{ domain.addresses_left.count }} {% trans "mail address left" %}</span> <span class="text-{{ domain.addresses_left.alert_level }}">{{ domain.addresses_left.count }} {% trans "mail address left" %}</span>
{% endif %} {% endif %}
</p> </p>
<a class="stretched-link" href="{% url 'musician:mails' %}?domain={{ domain.id }}"></a> <a class="stretched-link" href="{% url 'musician:address-list' %}?domain={{ domain.id }}"></a>
</div> </div>
<div class="col-md-2 border-right"> <div class="col-md-2 border-right">
<h4>{% trans "Mail list" %}</h4> <h4>{% trans "Mail list" %}</h4>
@ -82,7 +82,7 @@
<h4>{% trans "Software as a Service" %}</h4> <h4>{% trans "Software as a Service" %}</h4>
<p class="card-text"><i class="fas fa-fire fa-3x"></i></p> <p class="card-text"><i class="fas fa-fire fa-3x"></i></p>
<p class="card-text text-dark">{% trans "Nothing installed" %}</p> <p class="card-text text-dark">{% trans "Nothing installed" %}</p>
<a class="stretched-link" href="{% url 'musician:saas' %}?domain={{ domain.id }}"></a> <a class="stretched-link" href="{% url 'musician:saas-list' %}?domain={{ domain.id }}"></a>
</div> </div>
<div class="col-md-1"></div> <div class="col-md-1"></div>
<div class="col-md-4"> <div class="col-md-4">

View File

@ -3,7 +3,7 @@
{% block content %} {% block content %}
{% if active_domain %} {% if active_domain %}
<a class="btn-arrow-left" href="{% url 'musician:mails' %}">{% trans "Go to global" %}</a> <a class="btn-arrow-left" href="{% url 'musician:address-list' %}">{% trans "Go to global" %}</a>
{% endif %} {% endif %}
<h1 class="service-name">{{ service.verbose_name }}{% if active_domain %} <span class="font-weight-light">{% trans "for" <h1 class="service-name">{{ service.verbose_name }}{% if active_domain %} <span class="font-weight-light">{% trans "for"
@ -13,11 +13,12 @@
{% with request.resolver_match.url_name as url_name %} {% with request.resolver_match.url_name as url_name %}
<ul class="nav nav-tabs" id="myTab" role="tablist"> <ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link {% if url_name == 'mails' %}active{% endif %}" href="{% url 'musician:mails' %}" role="tab" <a class="nav-link {% if url_name == 'address-list' %}active{% endif %}" href="{% url 'musician:address-list' %}" role="tab"
aria-selected="true">{% trans "Addresses" %}</a> aria-selected="{% if url_name == 'address-list' %}true{% else %}false{% endif %}">{% trans "Addresses" %}</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link {% if url_name == 'mailboxes' %}active{% endif %}" href="{% url 'musician:mailboxes' %}" role="tab" aria-selected="false">{% trans "Mailboxes" %}</a> <a class="nav-link {% if url_name == 'mailbox-list' %}active{% endif %}" href="{% url 'musician:mailbox-list' %}" role="tab"
aria-selected="{% if url_name == 'mailbox-list' %}true{% else %}false{% endif %}">{% trans "Mailboxes" %}</a>
</li> </li>
</ul> </ul>

View File

@ -8,7 +8,7 @@
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% bootstrap_form form %}
{% buttons %} {% buttons %}
<a class="btn btn-light mr-2" href="{% url 'musician:mails' %}">{% trans "Cancel" %}</a> <a class="btn btn-light mr-2" href="{% url 'musician:address-list' %}">{% trans "Cancel" %}</a>
<button type="submit" class="btn btn-secondary">{% trans "Save" %}</button> <button type="submit" class="btn btn-secondary">{% trans "Save" %}</button>
{% endbuttons %} {% endbuttons %}
</form> </form>

View File

@ -25,7 +25,7 @@
<td>{{ mailbox.filtering }}</td> <td>{{ mailbox.filtering }}</td>
<td> <td>
{% for addr in mailbox.addresses %} {% for addr in mailbox.addresses %}
<a href="{% url 'musician:mail-update' addr.data.id %}"> <a href="{% url 'musician:address-update' addr.data.id %}">
{{ addr.data.name }}@{{ addr.data.domain.name }} {{ addr.data.name }}@{{ addr.data.domain.name }}
</a><br/> </a><br/>
{% endfor %} {% endfor %}

View File

@ -16,14 +16,14 @@ urlpatterns = [
path('auth/logout/', views.LogoutView.as_view(), name='logout'), path('auth/logout/', views.LogoutView.as_view(), name='logout'),
path('dashboard/', views.DashboardView.as_view(), name='dashboard'), path('dashboard/', views.DashboardView.as_view(), name='dashboard'),
path('domains/<int:pk>/', views.DomainDetailView.as_view(), name='domain-detail'), path('domains/<int:pk>/', views.DomainDetailView.as_view(), name='domain-detail'),
path('bills/', views.BillingView.as_view(), name='billing'), path('billing/', views.BillingView.as_view(), name='billing'),
path('bills/<int:pk>/download/', views.BillDownloadView.as_view(), name='bill-download'), path('bills/<int:pk>/download/', views.BillDownloadView.as_view(), name='bill-download'),
path('profile/', views.ProfileView.as_view(), name='profile'), path('profile/', views.ProfileView.as_view(), name='profile'),
path('mails/', views.MailView.as_view(), name='mails'), path('address/', views.MailView.as_view(), name='address-list'),
path('mails/new/', views.MailCreateView.as_view(), name='mail-create'), path('address/new/', views.MailCreateView.as_view(), name='address-create'),
path('mails/<int:pk>/', views.MailUpdateView.as_view(), name='mail-update'), path('address/<int:pk>/', views.MailUpdateView.as_view(), name='address-update'),
path('mailboxes/', views.MailboxesView.as_view(), name='mailboxes'), path('mailboxes/', views.MailboxesView.as_view(), name='mailbox-list'),
path('mailing-lists/', views.MailingListsView.as_view(), name='mailing-lists'), path('mailing-lists/', views.MailingListsView.as_view(), name='mailing-lists'),
path('databases/', views.DatabasesView.as_view(), name='databases'), path('databases/', views.DatabasesView.as_view(), name='database-list'),
path('software-as-a-service/', views.SaasView.as_view(), name='saas'), path('saas/', views.SaasView.as_view(), name='saas-list'),
] ]

View File

@ -207,7 +207,7 @@ class MailCreateView(CustomContextMixin, UserTokenRequiredMixin, FormView):
service_class = Address service_class = Address
template_name = "musician/mail_form.html" template_name = "musician/mail_form.html"
form_class = MailForm form_class = MailForm
success_url = reverse_lazy("musician:mails") success_url = reverse_lazy("musician:address-list")
extra_context = {'service': service_class} extra_context = {'service': service_class}
def get_form_kwargs(self): def get_form_kwargs(self):
@ -232,7 +232,7 @@ class MailUpdateView(CustomContextMixin, UserTokenRequiredMixin, FormView):
service_class = Address service_class = Address
template_name = "musician/mail_form.html" template_name = "musician/mail_form.html"
form_class = MailForm form_class = MailForm
success_url = reverse_lazy("musician:mails") success_url = reverse_lazy("musician:address-list")
extra_context = {'service': service_class} extra_context = {'service': service_class}
def get_form_kwargs(self): def get_form_kwargs(self):