First shot at an AdminLTE dashboard

This commit is contained in:
Pierre Jaury
2016-03-19 20:37:48 +01:00
parent 3302921cee
commit 4576e1f5c2
48 changed files with 1204 additions and 60 deletions

View File

@@ -0,0 +1 @@
{% extends "working.html" %}

View File

@@ -0,0 +1 @@
{% extends "working.html" %}

View File

@@ -0,0 +1,9 @@
{% extends "form.html" %}
{% block title %}
Create alias
{% endblock %}
{% block subtitle %}
{{ domain }}
{% endblock %}

View File

@@ -0,0 +1,9 @@
{% extends "form.html" %}
{% block title %}
Edit alias
{% endblock %}
{% block subtitle %}
{{ alias }}
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block title %}
Alias list
{% endblock %}
{% block subtitle %}
{{ domain.name }}
{% endblock %}
{% block main_action %}
<a class="btn btn-primary" href="{{ url_for('alias_create', domain_name=domain.name) }}">Add alias</a>
{% endblock %}
{% block box %}
<table class="table table-bordered">
<tbody>
<tr>
<th>Actions</th>
<th>Address</th>
<th>Destination</th>
</tr>
{% for alias in domain.aliases %}
<tr>
<td>
<a href="{{ url_for('alias_edit', alias=alias.get_id()) }}" title="Edit"><i class="fa fa-pencil"></i></a>&nbsp;
<a href="{{ url_for('alias_delete', alias=alias.get_id()) }}" title="Delete"><i class="fa fa-trash"></i></a>
</td>
<td>{{ alias }}</td>
<td>{{ alias.destination or '-' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,74 @@
{% import "bootstrap/wtf.html" as wtf %}
{% import "bootstrap/utils.html" as utils %}
{% extends "bootstrap/base.html" %}
{% block styles %}
{{super()}}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/adminlte/css/AdminLTE.min.css">
<link rel="stylesheet" href="/static/adminlte/css/skin-blue.min.css">
{% endblock %}
{% block body_attribs %}
class="hold-transition skin-blue sidebar-mini"
{% endblock %}
{% block body %}
<div class="wrapper">
{% block navbar %}
<header class="main-header">
<a href="index2.html" class="logo">
<span class="logo-lg">FreePoste.io</span>
</a>
</header>
<aside class="main-sidebar">
{% block sidebar %}
{% include "sidebar.html" %}
{% endblock %}
</aside>
{% endblock %}
<div class="content-wrapper">
<section class="content-header">
<div class="pull-right">
{% block main_action %}
{% endblock %}
</div>
<h1>
{% block title %}{% endblock %}
<small>{% block subtitle %}{% endblock %}</small>
</h1>
</section>
<section class="content">
{{ utils.flashed_messages(container=False) }}
{% block content %}
<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>
</div>
<footer class="main-footer">
Built with <i class="fa fa-heart"></i> using <a class="white-text" href="http://flask.pocoo.org/">Flask</a> and
<a class="white-text" href="https://almsaeedstudio.com/preview">AdminLTE</a>
<span class="pull-right"><i class="fa fa-code-fork"></i> on <a class="white-text" href="https://github.com/kaiyou/freeposte.io">Github</a></a>
</footer>
{% block scripts %}
{{super()}}
<script src="/static/adminlte/js/app.min.js"></script>
{% endblock %}
</div>
{% endblock %}

View File

@@ -0,0 +1,5 @@
{% extends "form.html" %}
{% block title %}
New domain
{% endblock %}

View File

@@ -0,0 +1,9 @@
{% extends "form.html" %}
{% block title %}
Edit domain
{% endblock %}
{% block subtitle %}
{{ domain }}
{% endblock %}

View File

@@ -0,0 +1,38 @@
{% extends "base.html" %}
{% block title %}
Domain list
{% endblock %}
{% block main_action %}
{% if current_user.global_admin %}
<a class="btn btn-primary" href="{{ url_for('domain_create') }}">New domain</a>
{% endif %}
{% endblock %}
{% block box %}
<table class="table table-bordered">
<tbody>
<tr>
<th>Actions</th>
<th>Domain name</th>
<th>Mailbox count</th>
<th>Alias count</th>
</tr>
{% for domain in current_user.get_managed_domains() %}
<tr>
<td>
<a href="{{ url_for('user_list', domain_name=domain.name) }}" title="Users"><i class="fa fa-envelope-o"></i></a>&nbsp;
<a href="{{ url_for('alias_list', domain_name=domain.name) }}" title="Aliases"><i class="fa fa-at"></i></a>&nbsp;
<a href="{{ url_for('domain_admins', domain_name=domain.name) }}" title="Administrators"><i class="fa fa-user"></i></a>&nbsp;
<a href="{{ url_for('domain_delete', domain_name=domain.name) }}" title="Delete"><i class="fa fa-trash"></i></a>&nbsp;
<a href="{{ url_for('domain_edit', domain_name=domain.name) }}" title="Edit"><i class="fa fa-pencil"></i></a>
</td>
<td>{{ domain.name }}</td>
<td>{{ domain.users | count }} / {{ domain.max_users or '∞' }}</td>
<td>{{ domain.aliases | count }} / {{ domain.max_aliases or '∞' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block box_content %}
{{ wtf.quick_form(form) }}
{% endblock %}

View File

@@ -0,0 +1,13 @@
{% 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 %}

View File

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

View File

@@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block sidebar %}
<section class="sidebar">
<ul class="sidebar-menu">
<li class="header">Your account</li>
<li>
<a href="#">
<i class="fa fa-sign-in"></i> <span>Sign in</span>
</a>
</li>
</ul>
</section>
{% endblock %}
{% block title %}
Sign in
{% endblock %}
{% block subtitle %}
to access the administration tools
{% endblock %}
{% block box_content %}
{{ wtf.quick_form(form) }}
{% endblock %}

View File

@@ -0,0 +1,63 @@
<section class="sidebar">
<h4 class="text-center text-primary">{{ current_user }}</h4>
<ul class="sidebar-menu">
<li class="header">My account</li>
<li>
<a href="{{ url_for('user_settings') }}">
<i class="fa fa-wrench"></i> <span>Settings</span>
</a>
</li>
<li>
<a href="{{ url_for('user_password') }}">
<i class="fa fa-lock"></i> <span>Update password</span>
</a>
</li>
<li>
<a href="{{ url_for('user_forward') }}">
<i class="fa fa-share"></i> <span>Auto-forward</span>
</a>
</li>
<li>
<a href="{{ url_for('user_vacation') }}">
<i class="fa fa-plane"></i> <span>Vacation</span>
</a>
</li>
<li>
<a href="{{ url_for('user_fetchmail') }}">
<i class="fa fa-download"></i> <span>Fetched accounts</span>
</a>
</li>
<li>
<a href="{{ url_for('logout') }}">
<i class="fa fa-sign-out"></i> <span>Sign out</span>
</a>
</li>
<li class="header">Administration</li>
{% if current_user.global_admin %}
<li>
<a href="{{ url_for('status') }}">
<i class="fa fa-dashboard"></i> <span>Services status</span>
</a>
</li>
<li>
<a href="{{ url_for('admins') }}">
<i class="fa fa-user"></i> <span>Adminitrators</span>
</a>
</li>
{% endif %}
{% if current_user.admin_of %}
<li>
<a href="{{ url_for('domain_list') }}">
<i class="fa fa-envelope"></i> <span>Mail domains</span>
</a>
</li>
{% endif %}
<li>
<a href="https://github.com/kaiyou/freeposte.io">
<i class="fa fa-life-ring"></i> <span>Help</span>
</a>
</li>
</ul>
</section>

View File

@@ -0,0 +1,13 @@
{% extends "base.html" %}
{% block title %}
New user
{% endblock %}
{% block subtitle %}
{{ domain.name }}
{% endblock %}
{% block box_content %}
{{ wtf.quick_form(form) }}
{% endblock %}

View File

@@ -0,0 +1,9 @@
{% extends "form.html" %}
{% block title %}
Edit user
{% endblock %}
{% block subtitle %}
{{ user }}
{% endblock %}

View File

@@ -0,0 +1 @@
{% extends "working.html" %}

View File

@@ -0,0 +1,9 @@
{% extends "form.html" %}
{% block title %}
Forward emails
{% endblock %}
{% block subtitle %}
{{ user }}
{% endblock %}

View File

@@ -0,0 +1,42 @@
{% extends "base.html" %}
{% block title %}
User list
{% endblock %}
{% block subtitle %}
{{ domain.name }}
{% endblock %}
{% block main_action %}
<a class="btn btn-primary" href="{{ url_for('user_create', domain_name=domain.name) }}">Add user</a>
{% endblock %}
{% block box %}
<table class="table table-bordered">
<tbody>
<tr>
<th>Actions</th>
<th>Address</th>
<th>Forward</th>
<th>Quota</th>
</tr>
{% for user in domain.users %}
<tr>
<td>
<a href="{{ url_for('user_settings', user_email=user.get_id()) }}" title="Settings"><i class="fa fa-wrench"></i></a>&nbsp;
<a href="{{ url_for('user_password', user_email=user.get_id()) }}" title="Update password"><i class="fa fa-lock"></i></a>&nbsp;
<a href="{{ url_for('user_forward', user_email=user.get_id()) }}" title="Auto-forward"><i class="fa fa-share"></i></a>&nbsp;
<a href="{{ url_for('user_vacation', user_email=user.get_id()) }}" title="Vacation"><i class="fa fa-plane"></i></a>&nbsp;
<a href="{{ url_for('user_fetchmail', user_email=user.get_id()) }}" title="Fetched accounts"><i class="fa fa-download"></i></a>&nbsp;
<a href="{{ url_for('user_edit', user_email=user.get_id()) }}" title="Edit"><i class="fa fa-pencil"></i></a>&nbsp;
<a href="{{ url_for('user_delete', user_email=user.get_id()) }}" title="Delete"><i class="fa fa-trash"></i></a>
</td>
<td>{{ user }}</td>
<td>{{ user.forward or '-' }}</td>
<td>{{ user.quota_bytes | filesizeformat }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,9 @@
{% extends "form.html" %}
{% block title %}
Password update
{% endblock %}
{% block subtitle %}
{{ user }}
{% endblock %}

View File

@@ -0,0 +1 @@
{% extends "working.html" %}

View File

@@ -0,0 +1 @@
{% extends "working.html" %}

View File

@@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<div class="alert alert-warning" role="alert">We are still working on this feature!</div>
{% endblock %}