Update the ui macros and polish the overall UI

master
kaiyou 7 years ago
parent eb40ea830f
commit 924760273c

@ -4,7 +4,8 @@
{% trans %}Add a global administrator{% endtrans %} {% trans %}Add a global administrator{% endtrans %}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ macros.form_field(form.admin, id='admin') }} {{ macros.form_field(form.admin, id='admin') }}
@ -13,4 +14,5 @@
$("#admin").select2(); $("#admin").select2();
</script> </script>
</form> </form>
{% endcall %}
{% endblock %} {% endblock %}

@ -10,9 +10,8 @@
</a> </a>
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Email{% endtrans %}</th> <th>{% trans %}Email{% endtrans %}</th>
@ -25,6 +24,5 @@
<td>{{ admin }}</td> <td>{{ admin }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -8,7 +8,8 @@
{{ domain }} {{ domain }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }} {{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }}
@ -23,4 +24,5 @@
}) })
</script> </script>
</form> </form>
{% endcall %}
{% endblock %} {% endblock %}

@ -12,9 +12,8 @@
<a class="btn btn-primary" href="{{ url_for('.alias_create', domain_name=domain.name) }}">{% trans %}Add alias{% endtrans %}</a> <a class="btn btn-primary" href="{{ url_for('.alias_create', domain_name=domain.name) }}">{% trans %}Add alias{% endtrans %}</a>
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Email{% endtrans %}</th> <th>{% trans %}Email{% endtrans %}</th>
@ -36,6 +35,5 @@
<td>{{ alias.updated_at or '' }}</td> <td>{{ alias.updated_at or '' }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -12,9 +12,8 @@
<a class="btn btn-primary" href="{{ url_for('.alternative_create', domain_name=domain.name) }}">{% trans %}Add alternative{% endtrans %}</a> <a class="btn btn-primary" href="{{ url_for('.alternative_create', domain_name=domain.name) }}">{% trans %}Add alternative{% endtrans %}</a>
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Name{% endtrans %}</th> <th>{% trans %}Name{% endtrans %}</th>
@ -29,6 +28,5 @@
<td>{{ alternative.created_at }}</td> <td>{{ alternative.created_at }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -8,11 +8,13 @@
{% trans %}from{% endtrans %} {{ from_address }} {% trans %}from{% endtrans %} {{ from_address }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ macros.form_field(form.announcement_subject) }} {{ macros.form_field(form.announcement_subject) }}
{{ macros.form_field(form.announcement_body, rows=10) }} {{ macros.form_field(form.announcement_body, rows=10) }}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
</form> </form>
{% endcall %}
{% endblock %} {% endblock %}

@ -53,22 +53,7 @@ class="hold-transition skin-blue sidebar-mini"
<section class="content"> <section class="content">
{{ utils.flashed_messages(container=False) }} {{ utils.flashed_messages(container=False) }}
{% block content %} {% block content %}{% endblock %}
<div class="row">
<div class="col-lg-12">
<div class="box">
{% block box %}
<div class="box-header">
{% block box_title %}{% endblock %}
</div>
<div class="box-body">
{% block box_content %}{% endblock %}
</div>
{% endblock %}
</div>
</div>
</div>
{% endblock %}
</section> </section>
</div> </div>
<footer class="main-footer"> <footer class="main-footer">

@ -8,7 +8,9 @@
{{ action }} {{ action }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box(theme="warning") %}
<p>{% trans action %}You are about to {{ action }}. Please confirm your action.{% endtrans %}</p> <p>{% trans action %}You are about to {{ action }}. Please confirm your action.{% endtrans %}</p>
{{ macros.form(form) }} {{ macros.form(form) }}
{% endcall %}
{% endblock %} {% endblock %}

@ -8,7 +8,7 @@
{{ action }} {{ action }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
<p>{% trans action %}An error occurred while talking to the Docker server.{% endtrans %}</p> <p>{% trans action %}An error occurred while talking to the Docker server.{% endtrans %}</p>
<pre>{{ error }}</pre> <pre>{{ error }}</pre>
{% endblock %} {% endblock %}

@ -4,7 +4,8 @@
{% trans %}New domain{% endtrans %} {% trans %}New domain{% endtrans %}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ macros.form_field(form.name) }} {{ macros.form_field(form.name) }}
@ -15,4 +16,5 @@
{{ macros.form_field(form.comment) }} {{ macros.form_field(form.comment) }}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
</form> </form>
{% endcall %}
{% endblock %} {% endblock %}

@ -14,10 +14,9 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block box %} {% block content %}
{% call macros.table() %}
{% set hostname = config["HOSTNAMES"].split(",")[0] %} {% set hostname = config["HOSTNAMES"].split(",")[0] %}
<table class="table table-bordered">
<tbody>
<tr> <tr>
<th>{% trans %}Domain name{% endtrans %}</th> <th>{% trans %}Domain name{% endtrans %}</th>
<td>{{ domain.name }}</td> <td>{{ domain.name }}</td>
@ -46,6 +45,5 @@
<td><pre>_dmarc.{{ domain.name }}. 600 IN TXT "v=DMARC1; p=reject;{% if config["DMARC_RUA"] %} rua=mailto:{{ config["DMARC_RUA"] }}@{{ config["DOMAIN"] }};{% endif %}{% if config["DMARC_RUF"] %} ruf=mailto:{{ config["DMARC_RUF"] }}@{{ config["DOMAIN"] }};{% endif %} adkim=s; aspf=s"</pre></td> <td><pre>_dmarc.{{ domain.name }}. 600 IN TXT "v=DMARC1; p=reject;{% if config["DMARC_RUA"] %} rua=mailto:{{ config["DMARC_RUA"] }}@{{ config["DOMAIN"] }};{% endif %}{% if config["DMARC_RUF"] %} ruf=mailto:{{ config["DMARC_RUF"] }}@{{ config["DOMAIN"] }};{% endif %} adkim=s; aspf=s"</pre></td>
</tr> </tr>
{% endif %} {% endif %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -10,9 +10,8 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Manage{% endtrans %}</th> <th>{% trans %}Manage{% endtrans %}</th>
@ -48,6 +47,5 @@
<td>{{ domain.updated_at or '' }}</td> <td>{{ domain.updated_at or '' }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -1,4 +1,4 @@
{% extends "form.html" %} {% extends "base.html" %}
{% block title %} {% block title %}
{% trans %}Add a fetched account{% endtrans %} {% trans %}Add a fetched account{% endtrans %}
@ -7,3 +7,21 @@
{% block subtitle %} {% block subtitle %}
{{ user }} {{ user }}
{% endblock %} {% endblock %}
{% block content %}
<form class="form" method="post" role="form">
{{ form.hidden_tag() }}
{% call macros.box(title="Remote server") %}
{{ macros.form_field(form.protocol) }}
{{ macros.form_fields((form.host, form.port)) }}
{{ macros.form_field(form.tls) }}
{% endcall %}
{% call macros.box(title="Authentication") %}
{{ macros.form_field(form.username) }}
{{ macros.form_field(form.password) }}
{% endcall %}
{{ macros.form_field(form.submit) }}
</form>
{% endblock %}

@ -1,4 +1,4 @@
{% extends "form.html" %} {% extends "fetch/create.html" %}
{% block title %} {% block title %}
{% trans %}Update a fetched account{% endtrans %} {% trans %}Update a fetched account{% endtrans %}

@ -12,9 +12,8 @@
<a class="btn btn-primary" href="{{ url_for('.fetch_create', user_email=user.email) }}">{% trans %}Add an account{% endtrans %}</a> <a class="btn btn-primary" href="{{ url_for('.fetch_create', user_email=user.email) }}">{% trans %}Add an account{% endtrans %}</a>
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Endpoint{% endtrans %}</th> <th>{% trans %}Endpoint{% endtrans %}</th>
@ -40,6 +39,5 @@
<td>{{ fetch.updated_at or '' }}</td> <td>{{ fetch.updated_at or '' }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -1,5 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block box_content %} {% block content %}
{% call macros.box() %}
{{ macros.form(form) }} {{ macros.form(form) }}
{% endcall %}
{% endblock %} {% endblock %}

@ -1,13 +0,0 @@
{% macro render_field(field, label_visible=true) -%}
<div class="form-group {% if field.errors %}has-error{% endif %} {{ kwargs.pop('class_', '') }}">
{% if field.type != 'HiddenField' and label_visible %}
<label for="{{ field.id }}" class="control-label">{{ field.label }}</label>
{% endif %}
{{ field(class_='form-control', **kwargs) }}
{% if field.errors %}
{% for e in field.errors %}
<p class="help-block">{{ e }}</p>
{% endfor %}
{% endif %}
</div>
{%- endmacro %}

@ -1,5 +0,0 @@
{% extends "general.html" %}
{% block content %}
Test
{% endblock %}

@ -21,6 +21,8 @@
{% trans %}to access the administration tools{% endtrans %} {% trans %}to access the administration tools{% endtrans %}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
{{ macros.form(form) }} {{ macros.form(form) }}
{% endcall %}
{% endblock %} {% endblock %}

@ -63,3 +63,36 @@
{% endfor %} {% endfor %}
</form> </form>
{% endmacro %} {% endmacro %}
{% macro box(title=None, theme="primary", header=True) %}
<div class="row">
<div class="col-lg-12">
<div class="box box-{{ theme }}">
{% if header %}
<div class="box-header">
{% if title %}
<h3 class="box-title">{{ title }}</h3>
{% endif %}
</div>
{% endif %}
<div class="box-body">
{{ caller() }}
</div>
</div>
</div>
</div>
{% endmacro %}
{% macro table(theme="primary") %}
<div class="row">
<div class="col-lg-12">
<div class="box box-{{ theme }}">
<table class="table table-bordered">
<tbody>
{{ caller() }}
</tbody>
</table>
</div>
</div>
</div>
{% endmacro %}

@ -8,7 +8,8 @@
{{ domain }} {{ domain }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ macros.form_field(form.manager, id='manager') }} {{ macros.form_field(form.manager, id='manager') }}
@ -17,4 +18,5 @@
$("#manager").select2(); $("#manager").select2();
</script> </script>
</form> </form>
{% endcall %}
{% endblock %} {% endblock %}

@ -12,9 +12,8 @@
<a class="btn btn-primary" href="{{ url_for('.manager_create', domain_name=domain.name) }}">{% trans %}Add manager{% endtrans %}</a> <a class="btn btn-primary" href="{{ url_for('.manager_create', domain_name=domain.name) }}">{% trans %}Add manager{% endtrans %}</a>
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Email{% endtrans %}</th> <th>{% trans %}Email{% endtrans %}</th>
@ -27,6 +26,5 @@
<td>{{ manager }}</td> <td>{{ manager }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -10,9 +10,8 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}Domain name{% endtrans %}</th> <th>{% trans %}Domain name{% endtrans %}</th>
@ -34,6 +33,5 @@
<td>{{ relay.updated_at or '' }}</td> <td>{{ relay.updated_at or '' }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -4,9 +4,8 @@
{% trans %}Services status{% endtrans %} {% trans %}Services status{% endtrans %}
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Service{% endtrans %}</th> <th>{% trans %}Service{% endtrans %}</th>
<th>{% trans %}Status{% endtrans %}</th> <th>{% trans %}Status{% endtrans %}</th>
@ -25,6 +24,5 @@
<td>{{ container['Image']['Created'] }} <td>{{ container['Image']['Created'] }}
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -8,17 +8,24 @@
{{ domain.name }} {{ domain.name }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{% call macros.box("General") %}
{{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }} {{ macros.form_field(form.localpart, append='<span class="input-group-addon">@'+domain.name+'</span>') }}
{{ macros.form_fields((form.pw, form.pw2)) }} {{ macros.form_fields((form.pw, form.pw2)) }}
{{ macros.form_field(form.comment) }}
{% endcall %}
{% call macros.box("Features and quotas", theme="success") %}
{{ macros.form_field(form.quota_bytes, step=1000000000, max=(max_quota_bytes or domain.max_quota_bytes or 50000000000), {{ macros.form_field(form.quota_bytes, step=1000000000, max=(max_quota_bytes or domain.max_quota_bytes or 50000000000),
prepend='<span class="input-group-addon"><span id="quota">'+(form.quota_bytes.data//1000000000).__str__()+'</span> GiB</span>', prepend='<span class="input-group-addon"><span id="quota">'+(form.quota_bytes.data//1000000000).__str__()+'</span> GiB</span>',
oninput='$("#quota").text(this.value/1000000000);') }} oninput='$("#quota").text(this.value/1000000000);') }}
{{ macros.form_field(form.enable_imap) }} {{ macros.form_field(form.enable_imap) }}
{{ macros.form_field(form.enable_pop) }} {{ macros.form_field(form.enable_pop) }}
{{ macros.form_field(form.comment) }} {% endcall %}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
</form> </form>
{% endblock %} {% endblock %}

@ -8,7 +8,8 @@
{{ user }} {{ user }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ macros.form_field(form.forward_enabled, {{ macros.form_field(form.forward_enabled,
@ -20,4 +21,5 @@
**{("enabled" if user.forward_enabled else "disabled"): ""}) }} **{("enabled" if user.forward_enabled else "disabled"): ""}) }}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
</form> </form>
{% endcall %}
{% endblock %} {% endblock %}

@ -12,9 +12,8 @@
<a class="btn btn-primary" href="{{ url_for('.user_create', domain_name=domain.name) }}">{% trans %}Add user{% endtrans %}</a> <a class="btn btn-primary" href="{{ url_for('.user_create', domain_name=domain.name) }}">{% trans %}Add user{% endtrans %}</a>
{% endblock %} {% endblock %}
{% block box %} {% block content %}
<table class="table table-bordered"> {% call macros.table() %}
<tbody>
<tr> <tr>
<th>{% trans %}Actions{% endtrans %}</th> <th>{% trans %}Actions{% endtrans %}</th>
<th>{% trans %}User settings{% endtrans %}</th> <th>{% trans %}User settings{% endtrans %}</th>
@ -48,6 +47,5 @@
<td>{{ user.updated_at or '' }}</td> <td>{{ user.updated_at or '' }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> {% endcall %}
</table>
{% endblock %} {% endblock %}

@ -8,7 +8,8 @@
{{ user }} {{ user }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
{% call macros.box() %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ macros.form_field(form.reply_enabled, {{ macros.form_field(form.reply_enabled,
@ -20,4 +21,5 @@
**{("rw" if user.reply_enabled else "readonly"): ""}) }} **{("rw" if user.reply_enabled else "readonly"): ""}) }}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
</form> </form>
{% endcall %}
{% endblock %} {% endblock %}

@ -8,14 +8,19 @@
{{ user }} {{ user }}
{% endblock %} {% endblock %}
{% block box_content %} {% block content %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{% call macros.box(title="General settings") %}
{{ macros.form_field(form.displayed_name) }} {{ macros.form_field(form.displayed_name) }}
{% endcall %}
{% call macros.box(title="Antispam") %}
{{ macros.form_field(form.spam_enabled) }} {{ macros.form_field(form.spam_enabled) }}
{{ macros.form_field(form.spam_threshold, step=1, max=100, {{ macros.form_field(form.spam_threshold, step=1, max=100,
prepend='<span class="input-group-addon"><span id="threshold">'+form.spam_threshold.data.__str__()+'</span>&nbsp;/&nbsp;100</span>', prepend='<span class="input-group-addon"><span id="threshold">'+form.spam_threshold.data.__str__()+'</span>&nbsp;/&nbsp;100</span>',
oninput='$("#threshold").text(this.value);') }} oninput='$("#threshold").text(this.value);') }}
{% endcall %}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
</form> </form>
{% endblock %} {% endblock %}

Loading…
Cancel
Save