mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
admin
This commit is contained in:
parent
9ccea850c7
commit
fc64b55dfd
12
app.py
12
app.py
@ -1,7 +1,7 @@
|
||||
import os
|
||||
from flask import Flask, render_template, request
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_security import Security, current_user, auth_required, hash_password, SQLAlchemySessionUserDatastore
|
||||
from flask_security import Security, current_user, auth_required, roles_required, hash_password, SQLAlchemySessionUserDatastore
|
||||
from flask_babelex import Babel, gettext, lazy_gettext
|
||||
|
||||
# Create app
|
||||
@ -65,5 +65,15 @@ def home():
|
||||
def profile():
|
||||
return render_template('profile.html')
|
||||
|
||||
@app.route("/admin")
|
||||
@roles_required("admin")
|
||||
def admin():
|
||||
return render_template('admin/admin.html')
|
||||
|
||||
@app.route("/admin/admin_units")
|
||||
@roles_required("admin")
|
||||
def admin_admin_units():
|
||||
return render_template('admin/admin_units.html')
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
||||
@ -1,6 +1,3 @@
|
||||
a, a:hover {
|
||||
color: #009688;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.8rem;
|
||||
|
||||
17
templates/admin/admin.html
Normal file
17
templates/admin/admin.html
Normal file
@ -0,0 +1,17 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block title %}
|
||||
{{ _('Admin') }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ _('Admin') }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="list-group">
|
||||
<a href="{{ url_for('admin_admin_units') }}" class="list-group-item list-group-item-action">{{ _('Admin Units') }}</a>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
15
templates/admin/admin_units.html
Normal file
15
templates/admin/admin_units.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block title %}
|
||||
{{ _('Admin Units') }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('admin') }}">{{ _('Admin') }}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ _('Admin Units') }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@ -54,6 +54,11 @@
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<h6 class="dropdown-header">{{ current_user.email }}</h6>
|
||||
<a class="dropdown-item" href="{{ url_for('profile') }}">{{ _('Profile') }}</a>
|
||||
|
||||
{% if current_user.has_role('admin') %}
|
||||
<a class="dropdown-item" href="{{ url_for('admin') }}">{{ _('Admin') }}</a>
|
||||
{% endif %}
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{ url_for('security.logout') }}">{{ _('Logout') }}</a>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user