Switched to blueprints for the main app
parent
1c1c8e9cf6
commit
40d4a22240
@ -0,0 +1,28 @@
|
||||
from flask import Blueprint
|
||||
from flask.ext import login as flask_login
|
||||
from freeposte import login_manager, db
|
||||
|
||||
|
||||
app = Blueprint(
|
||||
'admin', __name__,
|
||||
template_folder='templates',
|
||||
static_folder='static')
|
||||
|
||||
# Import models
|
||||
from freeposte.admin import models
|
||||
|
||||
# Register the login components
|
||||
login_manager.login_view = "admin.login"
|
||||
login_manager.user_loader(models.User.get_by_email)
|
||||
|
||||
@app.context_processor
|
||||
def inject_user():
|
||||
return dict(current_user=flask_login.current_user)
|
||||
|
||||
# Import views
|
||||
from freeposte.admin.views import \
|
||||
administrators, \
|
||||
base, \
|
||||
aliases, \
|
||||
users, \
|
||||
domains
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
@ -0,0 +1,52 @@
|
||||
{% 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>Name</th>
|
||||
<th>Forward</th>
|
||||
<th>Reply</th>
|
||||
<th>Quota</th>
|
||||
<th>Comment</th>
|
||||
<th>Created</th>
|
||||
<th>Last edit</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>
|
||||
<a href="{{ url_for('.user_password', user_email=user.get_id()) }}" title="Update password"><i class="fa fa-lock"></i></a>
|
||||
<a href="{{ url_for('.user_forward', user_email=user.get_id()) }}" title="Auto-forward"><i class="fa fa-share"></i></a>
|
||||
<a href="{{ url_for('.user_reply', user_email=user.get_id()) }}" title="Auto-reply"><i class="fa fa-plane"></i></a>
|
||||
<a href="{{ url_for('.user_fetchmail', user_email=user.get_id()) }}" title="Fetched accounts"><i class="fa fa-download"></i></a>
|
||||
<a href="{{ url_for('.user_edit', user_email=user.get_id()) }}" title="Edit"><i class="fa fa-pencil"></i></a>
|
||||
<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.displayed_name }}</td>
|
||||
<td>{% if user.forward %}<span class="label label-info">enabled</span>{% endif %}</td>
|
||||
<td>{% if user.reply_subject %}<span class="label label-info">enabled</span>{% endif %}</td>
|
||||
<td>{{ user.quota_bytes | filesizeformat }}</td>
|
||||
<td>{{ user.comment or '' }}</td>
|
||||
<td>{{ user.created_at }}</td>
|
||||
<td>{{ user.updated_at or '' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
@ -1,4 +1,4 @@
|
||||
from freeposte import models
|
||||
from freeposte.admin import models
|
||||
from flask.ext import login as flask_login
|
||||
|
||||
import flask
|
@ -1,4 +1,4 @@
|
||||
from freeposte import app, db, models, forms, utils
|
||||
from freeposte.admin import app, db, models, forms, utils
|
||||
from flask.ext import login as flask_login
|
||||
|
||||
import os
|
@ -1,52 +0,0 @@
|
||||
{% 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>Name</th>
|
||||
<th>Forward</th>
|
||||
<th>Reply</th>
|
||||
<th>Quota</th>
|
||||
<th>Comment</th>
|
||||
<th>Created</th>
|
||||
<th>Last edit</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>
|
||||
<a href="{{ url_for('user_password', user_email=user.get_id()) }}" title="Update password"><i class="fa fa-lock"></i></a>
|
||||
<a href="{{ url_for('user_forward', user_email=user.get_id()) }}" title="Auto-forward"><i class="fa fa-share"></i></a>
|
||||
<a href="{{ url_for('user_reply', user_email=user.get_id()) }}" title="Auto-reply"><i class="fa fa-plane"></i></a>
|
||||
<a href="{{ url_for('user_fetchmail', user_email=user.get_id()) }}" title="Fetched accounts"><i class="fa fa-download"></i></a>
|
||||
<a href="{{ url_for('user_edit', user_email=user.get_id()) }}" title="Edit"><i class="fa fa-pencil"></i></a>
|
||||
<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.displayed_name }}</td>
|
||||
<td>{% if user.forward %}<span class="label label-info">enabled</span>{% endif %}</td>
|
||||
<td>{% if user.reply_subject %}<span class="label label-info">enabled</span>{% endif %}</td>
|
||||
<td>{{ user.quota_bytes | filesizeformat }}</td>
|
||||
<td>{{ user.comment or '' }}</td>
|
||||
<td>{{ user.created_at }}</td>
|
||||
<td>{{ user.updated_at or '' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
@ -1 +0,0 @@
|
||||
from freeposte.views import base, admin, domains, users, aliases
|
Loading…
Reference in New Issue