Improve the sidebar, display site title and website link

master
kaiyou 7 years ago
parent 924760273c
commit 716e166b11

@ -85,6 +85,12 @@ WEB_ADMIN=/admin
# Path to the webmail if enabled # Path to the webmail if enabled
WEB_WEBMAIL=/webmail WEB_WEBMAIL=/webmail
# Website name
SITENAME=Mailu
# Linked Website URL
WEBSITE=https://mailu.io
################################### ###################################
# Advanced settings # Advanced settings
################################### ###################################

@ -20,6 +20,8 @@ default_config = {
'HOSTNAMES': 'mail.mailu.io', 'HOSTNAMES': 'mail.mailu.io',
'DOMAIN': 'mailu.io', 'DOMAIN': 'mailu.io',
'POSTMASTER': 'postmaster', 'POSTMASTER': 'postmaster',
'SITENAME': 'Mailu',
'WEBSITE': 'https://mailu.io',
'DEBUG': False, 'DEBUG': False,
'BOOTSTRAP_SERVE_LOCAL': True, 'BOOTSTRAP_SERVE_LOCAL': True,
'DKIM_PATH': '/dkim/{domain}.{selector}.key', 'DKIM_PATH': '/dkim/{domain}.{selector}.key',
@ -32,6 +34,7 @@ default_config = {
'TLS_FLAVOR': 'cert', 'TLS_FLAVOR': 'cert',
'CERTS_PATH': '/certs', 'CERTS_PATH': '/certs',
'PASSWORD_SCHEME': 'SHA512-CRYPT', 'PASSWORD_SCHEME': 'SHA512-CRYPT',
'WEBMAIL': 'none',
} }
# Load configuration from the environment if available # Load configuration from the environment if available
@ -72,8 +75,11 @@ def handle_needs_login():
) )
@app.context_processor @app.context_processor
def inject_user(): def inject_defaults():
return dict(current_user=flask_login.current_user) return dict(
current_user=flask_login.current_user,
config=app.config
)
# Import views # Import views
from mailu import ui, internal from mailu import ui, internal

@ -1,17 +1,4 @@
{% extends "base.html" %} {% extends "form.html" %}
{% block sidebar %}
<section class="sidebar">
<ul class="sidebar-menu">
<li class="header">{% trans %}Your account{% endtrans %}</li>
<li>
<a href="#">
<i class="fa fa-sign-in"></i> <span>{% trans %}Sign in{% endtrans %}</span>
</a>
</li>
</ul>
</section>
{% endblock %}
{% block title %} {% block title %}
{% trans %}Sign in{% endtrans %} {% trans %}Sign in{% endtrans %}
@ -20,9 +7,3 @@
{% block subtitle %} {% block subtitle %}
{% trans %}to access the administration tools{% endtrans %} {% trans %}to access the administration tools{% endtrans %}
{% endblock %} {% endblock %}
{% block content %}
{% call macros.box() %}
{{ macros.form(form) }}
{% endcall %}
{% endblock %}

@ -1,7 +1,10 @@
<section class="sidebar"> <section class="sidebar">
{% if current_user.is_authenticated %}
<h4 class="text-center text-primary">{{ current_user }}</h4> <h4 class="text-center text-primary">{{ current_user }}</h4>
{% endif %}
<ul class="sidebar-menu"> <ul class="sidebar-menu">
{% if current_user.is_authenticated %}
<li class="header">{% trans %}My account{% endtrans %}</li> <li class="header">{% trans %}My account{% endtrans %}</li>
<li> <li>
<a href="{{ url_for('.user_settings') }}"> <a href="{{ url_for('.user_settings') }}">
@ -28,11 +31,7 @@
<i class="fa fa-download"></i> <span>{% trans %}Fetched accounts{% endtrans %}</span> <i class="fa fa-download"></i> <span>{% trans %}Fetched accounts{% endtrans %}</span>
</a> </a>
</li> </li>
<li>
<a href="{{ url_for('.logout') }}">
<i class="fa fa-sign-out"></i> <span>{% trans %}Sign out{% endtrans %}</span>
</a>
</li>
<li class="header">{% trans %}Administration{% endtrans %}</li> <li class="header">{% trans %}Administration{% endtrans %}</li>
{% if current_user.global_admin %} {% if current_user.global_admin %}
<li> <li>
@ -63,11 +62,38 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% endif %}
<li class="header">{% trans %}Go to{% endtrans %}</li>
{% if config["WEBMAIL"] != "none" %}
<li>
<a href="/webmail/">
<i class="fa fa-envelope-o"></i> <span>{% trans %}Webmail{% endtrans %}</span>
</a>
</li>
{% endif %}
<li>
<a href="https://mailu.io">
<i class="fa fa-globe"></i> <span>{% trans %}Website{% endtrans %}</span>
</a>
</li>
<li> <li>
<a href="https://github.com/Mailu/Mailu"> <a href="https://github.com/Mailu/Mailu">
<i class="fa fa-life-ring"></i> <span>{% trans %}Help{% endtrans %}</span> <i class="fa fa-life-ring"></i> <span>{% trans %}Help{% endtrans %}</span>
</a> </a>
</li> </li>
{% if current_user.is_authenticated %}
<li>
<a href="{{ url_for('.logout') }}">
<i class="fa fa-sign-out"></i> <span>{% trans %}Sign out{% endtrans %}</span>
</a>
</li>
{% else %}
<li>
<a href="#">
<i class="fa fa-sign-in"></i> <span>{% trans %}Sign in{% endtrans %}</span>
</a>
</li>
{% endif %}
</ul> </ul>
</section> </section>

@ -62,8 +62,7 @@ def domain_delete(domain_name):
@access.domain_admin(models.Domain, 'domain_name') @access.domain_admin(models.Domain, 'domain_name')
def domain_details(domain_name): def domain_details(domain_name):
domain = models.Domain.query.get(domain_name) or flask.abort(404) domain = models.Domain.query.get(domain_name) or flask.abort(404)
return flask.render_template('domain/details.html', domain=domain, return flask.render_template('domain/details.html', domain=domain)
config=app.config)
@ui.route('/domain/genkeys/<domain_name>', methods=['GET', 'POST']) @ui.route('/domain/genkeys/<domain_name>', methods=['GET', 'POST'])

Loading…
Cancel
Save