diff --git a/web/app/admin/views.py b/web/app/admin/views.py index 798c0df8..7f62d4a9 100644 --- a/web/app/admin/views.py +++ b/web/app/admin/views.py @@ -8,11 +8,19 @@ from ..models import Role, User from ..settings import tasks as settings_tasks +@admin.route('/') +@login_required +@admin_required +def index(): + return redirect(url_for('.users')) + + @admin.route('/users') @login_required @admin_required def users(): - users = [user.to_dict() for user in User.query.all()] + # users = [user.to_dict() for user in User.query.all()] + users = {user.id: user.to_dict() for user in User.query.all()} return render_template('admin/users.html.j2', title='Users', users=users) @@ -33,10 +41,10 @@ def delete_user(user_id): return redirect(url_for('.users')) -@admin.route('/users//edit_general_settings', methods=['GET', 'POST']) # noqa +@admin.route('/users//edit', methods=['GET', 'POST']) # noqa @login_required @admin_required -def edit_general_settings(user_id): +def edit_user(user_id): user = User.query.get_or_404(user_id) form = EditGeneralSettingsAdminForm(user=user) if form.validate_on_submit(): @@ -47,11 +55,11 @@ def edit_general_settings(user_id): user.role = Role.query.get(form.role.data) db.session.commit() flash('Settings have been updated.') - return redirect(url_for('.edit_general_settings', user_id=user.id)) + return redirect(url_for('.edit_user', user_id=user.id)) form.confirmed.data = user.confirmed form.dark_mode.data = user.setting_dark_mode form.email.data = user.email form.role.data = user.role_id form.username.data = user.username - return render_template('admin/edit_general_settings.html.j2', - form=form, title='General settings', user=user) + return render_template('admin/edit_user.html.j2', form=form, + title='Edit user', user=user) diff --git a/web/app/templates/admin/_breadcrumbs.html.j2 b/web/app/templates/admin/_breadcrumbs.html.j2 new file mode 100644 index 00000000..d27940c3 --- /dev/null +++ b/web/app/templates/admin/_breadcrumbs.html.j2 @@ -0,0 +1,19 @@ + diff --git a/web/app/templates/admin/edit_general_settings.html.j2 b/web/app/templates/admin/edit_user.html.j2 similarity index 96% rename from web/app/templates/admin/edit_general_settings.html.j2 rename to web/app/templates/admin/edit_user.html.j2 index 929a867c..61ef21da 100644 --- a/web/app/templates/admin/edit_general_settings.html.j2 +++ b/web/app/templates/admin/edit_user.html.j2 @@ -1,6 +1,10 @@ {% extends "nopaque.html.j2" %} {% import 'materialize/wtf.html.j2' as wtf %} +{% block nav_content %} +{% include 'admin/_breadcrumbs.html.j2' %} +{% endblock nav_content %} + {% block page_content %}
diff --git a/web/app/templates/admin/user.html.j2 b/web/app/templates/admin/user.html.j2 index 78351735..27d09d8c 100644 --- a/web/app/templates/admin/user.html.j2 +++ b/web/app/templates/admin/user.html.j2 @@ -1,5 +1,9 @@ {% extends "nopaque.html.j2" %} +{% block nav_content %} +{% include 'admin/_breadcrumbs.html.j2' %} +{% endblock nav_content %} + {% block page_content %}
@@ -30,7 +34,7 @@
diff --git a/web/app/templates/admin/users.html.j2 b/web/app/templates/admin/users.html.j2 index a7b712da..afe282ff 100644 --- a/web/app/templates/admin/users.html.j2 +++ b/web/app/templates/admin/users.html.j2 @@ -1,5 +1,9 @@ {% extends "nopaque.html.j2" %} +{% block nav_content %} +{% include 'admin/_breadcrumbs.html.j2' %} +{% endblock nav_content %} + {% block page_content %}
@@ -7,28 +11,28 @@

{{ title }}

-
+
-
+
search
-
    - +
    - - + + +
    Id Username EmailRole{# Actions #}Last seenRole
    -
      +
        @@ -38,9 +42,8 @@ {% block scripts %} {{ super() }} - {% endblock scripts %} diff --git a/web/app/templates/nopaque.html.j2 b/web/app/templates/nopaque.html.j2 index 73e9bc9a..c5085490 100644 --- a/web/app/templates/nopaque.html.j2 +++ b/web/app/templates/nopaque.html.j2 @@ -150,7 +150,7 @@ {% if current_user.is_administrator() %}
      • Administration
      • -
      • buildAdministration tools
      • +
      • buildAdministration
      • {% endif %} {% endblock sidenav %} @@ -264,6 +264,7 @@ +