cosmetic responsiveness update

This commit is contained in:
j3d1 2020-11-09 01:44:24 +01:00
parent 89462cb100
commit 124909f4fa
8 changed files with 209 additions and 56 deletions

View file

@ -4,47 +4,93 @@
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-simple-sidebar/blob/master/LICENSE) * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-simple-sidebar/blob/master/LICENSE)
*/ */
#wrapper { #wrapper {
overflow-x: hidden; overflow-x: hidden;
} }
#sidebar-wrapper { #sidebar-wrapper {
min-height: 100vh; min-height: 100vh;
margin-left: -15rem; margin-left: -15rem;
-webkit-transition: margin .25s ease-out; -webkit-transition: margin .25s ease-out;
-moz-transition: margin .25s ease-out; -moz-transition: margin .25s ease-out;
-o-transition: margin .25s ease-out; -o-transition: margin .25s ease-out;
transition: margin .25s ease-out; transition: margin .25s ease-out;
} }
#sidebar-wrapper .sidebar-heading { #sidebar-wrapper .sidebar-heading {
padding: 0.875rem 1.25rem; padding: 0.875rem 1.25rem;
font-size: 1.2rem; font-size: 1.2rem;
} }
#sidebar-wrapper .list-group { #sidebar-wrapper .list-group {
width: 15rem; width: 15rem;
} }
#page-content-wrapper { #page-content-wrapper {
min-width: 100vw; min-width: 100vw;
} }
#wrapper.toggled #sidebar-wrapper { #wrapper.toggled #sidebar-wrapper {
margin-left: 0;
}
@media (min-width: 768px) {
#sidebar-wrapper {
margin-left: 0; margin-left: 0;
}
#page-content-wrapper {
min-width: 0;
width: 100%;
}
#wrapper.toggled #sidebar-wrapper {
margin-left: -15rem;
}
} }
.link-unstyled, .link-unstyled:link, .link-unstyled:hover {
color: inherit;
text-decoration: inherit;
}
.optional-column-replacement {
display: none;
}
@media (min-width: 1024px) , (max-width: 700px) and (min-width: 610px) {
#sidebar-wrapper {
margin-left: 0;
}
#page-content-wrapper {
min-width: 0;
width: 100%;
}
#wrapper.toggled #sidebar-wrapper {
margin-left: -15rem;
}
}
@media (max-width: 700px) {
.card-columns {
column-count: 1;
}
.optional-column {
display: none;
}
.optional-column-replacement {
display: initial;
}
}
@media (min-width: 700px) and (max-width: 1300px) {
.card-columns {
column-count: 2;
}
}
@media (min-width: 1300px) and (max-width: 1700px) {
.card-columns {
column-count: 3;
}
}
@media (min-width: 1700px) {
.card-columns {
column-count: 4;
}
}

View file

@ -4,11 +4,13 @@
<h1 class="mt-4">Aliases</h1> <h1 class="mt-4">Aliases</h1>
{% if alias_list %} {% if alias_list %}
<table class="table table-striped table-responsive-md btn-table"> <table class="table table-striped btn-table">
<thead> <thead>
<tr> <tr>
<th scope="col">Source</th> <th scope="col">Source
<th scope="col">Destination</th> <span class="optional-column-replacement">/ Destination</span>
</th>
<th scope="col" class="optional-column">Destination</th>
<th scope="col">Actions</th> <th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
@ -18,8 +20,9 @@
<tr> <tr>
<th scope="row"><a <th scope="row"><a
href="{% url 'multimail:edit_alias' alias.id %}">{{ alias.source_username }}@{{ alias.source_domain }}</a> href="{% url 'multimail:edit_alias' alias.id %}">{{ alias.source_username }}@{{ alias.source_domain }}</a>
<span class="optional-column-replacement">{{ alias.destination_username }}@{{ alias.destination_domain }}</span>
</th> </th>
<th scope="row">{{ alias.destination_username }}@{{ alias.destination_domain }}</th> <th scope="row" class="optional-column">{{ alias.destination_username }}@{{ alias.destination_domain }}</th>
<td><a href="{% url 'multimail:delete_alias' alias.id %}" <td><a href="{% url 'multimail:delete_alias' alias.id %}"
class="btn btn-danger btn-sm m-0">Delete</a></td> class="btn btn-danger btn-sm m-0">Delete</a></td>
</tr> </tr>
@ -30,15 +33,15 @@
<tr> <tr>
<th scope="row"> <th scope="row">
</th> </th>
<th scope="row"></th> <td class="optional-column"></td>
<td><a href="{% url 'multimail:new_alias' %}" class="btn btn-primary btn-sm m-0">Add</a> <td><a href="{% url 'multimail:new_alias' %}" class="btn btn-primary btn-sm m-0">Add Alias</a>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
{% else %} {% else %}
<p>You haven't set up any aliases yet.</p> <p>You haven't set up any aliases yet.</p>
<a href="{% url 'multimail:new_alias' %}" class="btn btn-primary btn-sm m-0">Add</a> <a href="{% url 'multimail:new_alias' %}" class="btn btn-primary btn-sm m-0">Add Alias</a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -26,10 +26,13 @@
<!-- Sidebar --> <!-- Sidebar -->
<div class="bg-light border-right" id="sidebar-wrapper"> <div class="bg-light border-right" id="sidebar-wrapper">
<div class="sidebar-heading">Multimail</div> <div class="sidebar-heading">
<a href="{% url 'multimail:index' %}" class="link-unstyled">Multimail</a>
</div>
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">
<a href="{% url 'multimail:domains' %}" class="list-group-item list-group-item-action bg-light">Domains</a> <a href="{% url 'multimail:domains' %}" class="list-group-item list-group-item-action bg-light">Domains</a>
<a href="{% url 'multimail:mailboxes' %}" class="list-group-item list-group-item-action bg-light">Mailboxes</a> <a href="{% url 'multimail:mailboxes' %}"
class="list-group-item list-group-item-action bg-light">Mailboxes</a>
<a href="{% url 'multimail:aliases' %}" class="list-group-item list-group-item-action bg-light">Aliases</a> <a href="{% url 'multimail:aliases' %}" class="list-group-item list-group-item-action bg-light">Aliases</a>
</div> </div>
</div> </div>
@ -41,9 +44,9 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom"> <nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
<button class="btn btn-link btn-lg" id="menu-toggle"><i class="fas fa-bars"></i></button> <button class="btn btn-link btn-lg" id="menu-toggle"><i class="fas fa-bars"></i></button>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" <button class="navbar-toggler btn btn-link btn-lg" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <i class="fas fa-user"></i>
</button> </button>
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
@ -57,7 +60,7 @@
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{user}} {{ user }}
</a> </a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown"> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Nothing</a> <a class="dropdown-item" href="#">Nothing</a>

View file

@ -25,14 +25,14 @@
<tr> <tr>
<th scope="row"> <th scope="row">
</th> </th>
<td><a href="{% url 'multimail:new_domain' %}" class="btn btn-primary btn-sm m-0">Add</a> <td><a href="{% url 'multimail:new_domain' %}" class="btn btn-primary btn-sm m-0">Add Domain</a>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
{% else %} {% else %}
<p>You haven't set up any domains yet.</p> <p>You haven't set up any domains yet.</p>
<a href="{% url 'multimail:new_domain' %}" class="btn btn-primary btn-sm m-0">Add</a> <a href="{% url 'multimail:new_domain' %}" class="btn btn-primary btn-sm m-0">Add Domain</a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,16 +1,92 @@
{% extends 'multimail/base.html' %} {% extends 'multimail/base.html' %}
{% block content %} {% block content %}
<h1 class="mt-4">Domains</h1> <div class="pt-3">
{% if domain_list %} {% if domain_list %}
<ul> <div class="card-columns">
{% for question in domain_list %} {% for domain in domain_list %}
<li><a href="{% url 'multimail:detail' question.id %}">{{ question.domain }}</a></li> <div class="card">
{% endfor %} <h5 class="card-header"><a
</ul> href="{% url 'multimail:edit_domain' domain.id %}">{{ domain.domain }}</a></h5>
{% else %} <table class="table table-striped btn-table mb-0">
<p>No multimail are available.</p> {% if domain.mailboxes %}
{% endif %} <thead>
<tr>
<th scope="col">Mailboxes</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for mailbox in domain.mailboxes %}
<tr>
<th scope="row"><a
href="{% url 'multimail:edit_mailbox' mailbox.id %}">{{ mailbox.username }}@{{ mailbox.domain }}</a>
</th>
<td><a href="{% url 'multimail:delete_mailbox' mailbox.id %}"
class="btn btn-outline-danger btn-sm m-0"><i
class="fas fa-trash"></i></a></td>
</tr>
{% endfor %}
</tbody>
{% else %}
<tbody>
<tr>
<td colspan="2" class="text-muted"><small>You dont't have any mailboxes for this domain yet.</small></td>
</tr>
</tbody>
{% endif %}
{% if domain.aliases %}
<tbody>
<tr class="bg-white">
<th scope="col">Aliases</th>
<th scope="col"></th>
</tr>
</tbody>
<tbody>
{% for alias in domain.aliases %}
<tr>
<th scope="row"><a
href="{% url 'multimail:edit_alias' alias.id %}">{{ alias.source_username }}@{{ alias.source_domain }}</a>
{{ alias.destination_username }}@{{ alias.destination_domain }}
</th>
<td><a href="{% url 'multimail:delete_alias' alias.id %}"
class="btn btn-outline-danger btn-sm m-0"><i
class="fas fa-trash"></i></a></td>
</tr>
{% endfor %}
</tbody>
{% else %}
<tbody>
<tr>
<td colspan="2" class="text-muted"><small>You dont't have any aliases for this domain yet.</small></td>
</tr>
</tbody>
{% endif %}
</table>
<div class="card-footer">
<div class="btn-group btn-block" data-toggle="buttons">
<a href="{% url 'multimail:new_mailbox' %}"
class="btn btn-primary btn-sm">Add Mailbox</a>
<a href="{% url 'multimail:new_alias' %}"
class="btn btn-primary btn-sm">Add Alias</a>
<a href="{% url 'multimail:delete_domain' domain.id %}"
class="btn btn-outline-danger btn-sm">Delete Domain</a>
</div>
</div>
</div>
{% endfor %}
<div class="card">
<div class="card-body">
<h5 class="card-title">New Domain</h5>
<a href="{% url 'multimail:new_domain' %}" class="btn btn-primary btn-sm m-0">Add Domain</a>
</div>
</div>
</div>
{% else %}
<p>You haven't set up any domains yet.</p>
<a href="{% url 'multimail:new_domain' %}" class="btn btn-primary btn-sm m-0">Add Domain</a>
{% endif %}
</div>
{% endblock %} {% endblock %}

View file

@ -8,6 +8,10 @@
<thead> <thead>
<tr> <tr>
<th scope="col">Mailbox</th> <th scope="col">Mailbox</th>
<th scope="col" class="optional-column">Username</th>
<th scope="col" class="optional-column">Domain</th>
<th scope="col" class="optional-column">Sendonly</th>
<th scope="col" class="optional-column">Active</th>
<th scope="col">Actions</th> <th scope="col">Actions</th>
</tr> </tr>
</thead> </thead>
@ -16,6 +20,10 @@
{% for mailbox in mailbox_list %} {% for mailbox in mailbox_list %}
<tr> <tr>
<th scope="row"><a href="{% url 'multimail:edit_mailbox' mailbox.id %}">{{ mailbox.username }}@{{ mailbox.domain }}</a></th> <th scope="row"><a href="{% url 'multimail:edit_mailbox' mailbox.id %}">{{ mailbox.username }}@{{ mailbox.domain }}</a></th>
<td class="optional-column">{{ mailbox.username }}</td>
<td class="optional-column">{{ mailbox.domain }}</td>
<td class="optional-column">{{ mailbox.sendonly }}</td>
<td class="optional-column">{{ mailbox.enabled }}</td>
<td><a href="{% url 'multimail:delete_mailbox' mailbox.id %}" class="btn btn-danger btn-sm m-0">Delete</a></td> <td><a href="{% url 'multimail:delete_mailbox' mailbox.id %}" class="btn btn-danger btn-sm m-0">Delete</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -23,16 +31,16 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<th scope="row"> <th scope="row"> </th>
</th> <td class="optional-column" colspan="4"></td>
<td><a href="{% url 'multimail:new_mailbox' %}" class="btn btn-primary btn-sm m-0">Add</a> <td><a href="{% url 'multimail:new_mailbox' %}" class="btn btn-primary btn-sm m-0">Add Mailbox</a>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
{% else %} {% else %}
<p>You haven't set up any mailboxes yet.</p> <p>You haven't set up any mailboxes yet.</p>
<a href="{% url 'multimail:new_mailbox' %}" class="btn btn-primary btn-sm m-0">Add</a> <a href="{% url 'multimail:new_mailbox' %}" class="btn btn-primary btn-sm m-0">Add Mailbox</a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -6,7 +6,7 @@ from . import actions
app_name = 'multimail' app_name = 'multimail'
urlpatterns = [ urlpatterns = [
path('', views.DomainListView.as_view(), name='index'), path('', views.IndexView.as_view(), name='index'),
path('domains/', views.DomainListView.as_view(), name='domains'), path('domains/', views.DomainListView.as_view(), name='domains'),
path('domain/new/', forms.new_domain, name='new_domain'), path('domain/new/', forms.new_domain, name='new_domain'),

View file

@ -10,6 +10,23 @@ class UserLoginView(LoginView):
template_name = 'multimail/login.html' template_name = 'multimail/login.html'
class IndexView(LoginRequiredMixin, generic.ListView):
login_url = 'login/'
template_name = 'multimail/index.html'
context_object_name = 'domain_list'
def fill_related(self, domains):
for domain in domains:
domain.mailboxes = Mailbox.objects.filter(domain=domain)
domain.aliases = Alias.objects.filter(source_domain=domain)
yield domain
def get_queryset(self):
"""Return the last five published questions."""
user = user_from_request(self.request)
return self.fill_related(Domain.objects.filter(admin__admin=user['name'], admin__source=user['source']))
class DomainListView(LoginRequiredMixin, generic.ListView): class DomainListView(LoginRequiredMixin, generic.ListView):
login_url = 'login/' login_url = 'login/'
template_name = 'multimail/domains.html' template_name = 'multimail/domains.html'