From 2e78aa5f262a79d14aff32b58e6bd9aea7f586c2 Mon Sep 17 00:00:00 2001 From: Aaron Kable Date: Sat, 7 Oct 2023 08:20:22 +0000 Subject: [PATCH] BS5 Theme --- allianceauth/apps.py | 25 ++ allianceauth/authentication/auth_hooks.py | 45 +++ allianceauth/authentication/middleware.py | 8 + .../migrations/0022_userprofile_theme.py | 18 ++ allianceauth/authentication/models.py | 7 + .../authentication/dashboard.characters.html | 41 +++ .../authentication/dashboard.groups.html | 20 ++ .../templates/authentication/dashboard.html | 193 +----------- .../templates/authentication/tokens.html | 24 +- .../authentication/templates/public/base.html | 1 + allianceauth/authentication/views.py | 35 ++- allianceauth/context_processors.py | 2 +- allianceauth/corputils/auth_hooks.py | 3 +- .../corputils/templates/corputils/base.html | 13 +- .../templates/corputils/corpstats.html | 8 +- .../corputils/templates/corputils/search.html | 2 +- .../eveonline/templatetags/examples.html | 61 ++-- .../fleetactivitytracking/auth_hooks.py | 3 +- .../characternotexisting.html | 37 +-- .../fatlinkformatter.html | 34 +-- .../fleetactivitytracking/fatlinkmodify.html | 4 +- .../fatlinkpersonalmonthlystatisticsview.html | 6 +- .../fatlinkpersonalstatisticsview.html | 53 ++-- .../fatlinkstatisticscorpview.html | 74 ++--- .../fatlinkstatisticsview.html | 80 ++--- .../fleetactivitytracking/fatlinkview.html | 174 ++++++----- allianceauth/groupmanagement/auth_hooks.py | 37 ++- .../templates/groupmanagement/audit.html | 116 ++++--- .../groupmanagement/groupmembers.html | 143 ++++----- .../groupmanagement/groupmembership.html | 132 ++++---- .../templates/groupmanagement/groups.html | 134 ++++++--- .../templates/groupmanagement/index.html | 284 +++++++++--------- .../templates/groupmanagement/menu.html | 29 +- allianceauth/groupmanagement/views.py | 15 +- allianceauth/hooks.py | 16 +- allianceauth/hrapplications/auth_hooks.py | 3 +- .../templates/hrapplications/corpchoice.html | 2 +- .../templates/hrapplications/create.html | 2 +- .../templates/hrapplications/management.html | 26 +- .../templates/hrapplications/searchview.html | 8 +- allianceauth/menu/__init__.py | 0 allianceauth/menu/admin.py | 9 + allianceauth/menu/apps.py | 19 ++ allianceauth/menu/hooks.py | 42 +++ allianceauth/menu/migrations/0001_initial.py | 28 ++ ...2_alter_menuitem_hook_function_and_more.py | 28 ++ ...03_menuitem_menu_menuit_rank_e880ab_idx.py | 17 ++ ...de_alter_menuitem_icon_classes_and_more.py | 39 +++ allianceauth/menu/migrations/__init__.py | 0 allianceauth/menu/models.py | 174 +++++++++++ allianceauth/menu/providers.py | 10 + .../menu/templates/menu/menu-block.html | 7 + .../menu/templates/menu/menu-item-bs5.html | 32 ++ .../menu/menu-notification-block.html | 19 ++ .../menu/templates/menu/menu-user.html | 51 ++++ .../templates/menu/sortable-side-menu.html | 21 ++ allianceauth/menu/templatetags/__init__.py | 0 allianceauth/menu/templatetags/menu_items.py | 35 +++ .../templates/notifications/list.html | 68 +++-- .../templates/notifications/list_partial.html | 42 ++- .../templates/notifications/view.html | 2 +- allianceauth/optimer/auth_hooks.py | 18 +- .../templates/optimer/dashboard.ops.html | 38 +++ .../templates/optimer/fleetoptable.html | 4 +- .../optimer/templates/optimer/management.html | 6 +- allianceauth/optimer/views.py | 15 +- allianceauth/permissions_tool/auth_hooks.py | 3 +- .../templates/permissions_tool/audit.html | 108 +++---- .../templates/permissions_tool/audit_row.html | 26 +- .../templates/permissions_tool/overview.html | 195 ++++++------ .../project_name/settings/base.py | 7 + .../project_name/settings/local.py | 2 +- allianceauth/services/auth_hooks.py | 4 +- allianceauth/services/hooks.py | 34 +-- .../discord/discord_service_ctrl.html | 41 ++- .../discourse/discourse_service_ctrl.html | 26 +- .../services/mumble/mumble_service_ctrl.html | 50 +-- .../services/modules/openfire/auth_hooks.py | 3 +- .../teamspeak3/teamspeak3_service_ctrl.html | 60 ++-- .../services/fleetformattertool.html | 2 +- .../services/templates/services/services.html | 57 ++-- .../templates/services/services_ctrl.html | 70 +++-- .../services/services_ctrl_base.html | 15 + allianceauth/srp/auth_hooks.py | 3 +- allianceauth/srp/templates/srp/data.html | 108 +++---- .../srp/templates/srp/management.html | 26 +- allianceauth/srp/templates/srp/request.html | 2 +- allianceauth/srp/templates/srp/update.html | 3 +- .../static/allianceauth/images/auth-logo.png | Bin 0 -> 10836 bytes .../static/allianceauth/images/auth-logo.svg | 56 ++++ .../css/images/ui-icons_444444_256x240.png | Bin 0 -> 7142 bytes .../css/images/ui-icons_555555_256x240.png | Bin 0 -> 7126 bytes .../css/images/ui-icons_777620_256x240.png | Bin 0 -> 4670 bytes .../css/images/ui-icons_777777_256x240.png | Bin 0 -> 7163 bytes .../css/images/ui-icons_cc0000_256x240.png | Bin 0 -> 4670 bytes .../css/images/ui-icons_ffffff_256x240.png | Bin 0 -> 6539 bytes .../js/jquery-ui/1.13.2/css/jquery-ui.min.css | 6 + .../allianceauth/admin-status/overview.html | 135 +++++---- .../templates/allianceauth/base-bs5.html | 123 ++++++++ .../templates/allianceauth/error.html | 27 ++ .../templates/allianceauth/messages-bs5.html | 26 ++ .../allianceauth/top-menu-rh-default.html | 8 + .../templates/bundles/auth-base-css.html | 2 +- .../templates/bundles/bootstrap-css.html | 13 +- .../templates/bundles/bootstrap-js.html | 2 +- .../templates/bundles/checkbox-css.html | 2 +- .../templates/bundles/clipboard-js.html | 2 +- .../templates/bundles/datatables-css-bs5.html | 3 + .../templates/bundles/datatables-css.html | 2 +- .../templates/bundles/datatables-js-bs5.html | 4 + .../templates/bundles/datatables-js.html | 4 +- .../templates/bundles/fontawesome.html | 2 +- .../bundles/jquery-datetimepicker-css.html | 2 +- allianceauth/templates/bundles/jquery-js.html | 3 + .../templates/bundles/jquery-ui-css.html | 2 +- .../templates/bundles/jquery-ui-js.html | 2 +- allianceauth/templates/bundles/moment-js.html | 4 +- .../templates/bundles/x-editable.css.html | 2 +- allianceauth/theme/__init__.py | 0 allianceauth/theme/apps.py | 9 + allianceauth/theme/bootstrap/__init__.py | 0 allianceauth/theme/bootstrap/apps.py | 11 + allianceauth/theme/bootstrap/auth_hooks.py | 33 ++ allianceauth/theme/bootstrap_dark/__init__.py | 0 allianceauth/theme/bootstrap_dark/apps.py | 11 + .../theme/bootstrap_dark/auth_hooks.py | 34 +++ allianceauth/theme/darkly/__init__.py | 0 allianceauth/theme/darkly/apps.py | 11 + allianceauth/theme/darkly/auth_hooks.py | 33 ++ allianceauth/theme/flatly/__init__.py | 0 allianceauth/theme/flatly/apps.py | 11 + allianceauth/theme/flatly/auth_hooks.py | 33 ++ allianceauth/theme/hooks.py | 47 +++ allianceauth/theme/materia/__init__.py | 0 allianceauth/theme/materia/apps.py | 11 + allianceauth/theme/materia/auth_hooks.py | 33 ++ allianceauth/theme/templates/__init__.py | 0 .../theme/templates/theme/__init__.py | 0 .../templates/theme/theme_imports_css.html | 10 + .../templates/theme/theme_imports_js.html | 10 + .../theme/templates/theme/theme_select.html | 9 + allianceauth/theme/templatetags/__init__.py | 0 allianceauth/theme/templatetags/theme_tags.py | 73 +++++ allianceauth/timerboard/auth_hooks.py | 18 +- .../timerboard/dashboard.timers.html | 58 ++++ .../timerboard/templates/timerboard/form.html | 8 +- .../templates/timerboard/index_button.html | 2 +- .../timerboard/timer_confirm_delete.html | 6 +- .../timerboard/templates/timerboard/view.html | 146 ++++----- allianceauth/timerboard/views.py | 15 +- allianceauth/urls.py | 5 +- allianceauth/views.py | 72 +++-- docs/customizing/index.md | 2 +- docs/development/aa_core/documentation.md | 3 +- docs/development/custom/custom-themes.md | 19 ++ docs/development/custom/index.md | 3 +- .../custom/integrating-services.md | 138 +++++---- docs/development/custom/logging.md | 5 + docs/development/custom/menu-hooks.md | 40 +-- docs/development/custom/url-hooks.md | 13 +- docs/development/index.md | 2 +- 161 files changed, 3198 insertions(+), 1655 deletions(-) create mode 100644 allianceauth/authentication/auth_hooks.py create mode 100644 allianceauth/authentication/migrations/0022_userprofile_theme.py create mode 100644 allianceauth/authentication/templates/authentication/dashboard.characters.html create mode 100644 allianceauth/authentication/templates/authentication/dashboard.groups.html create mode 100644 allianceauth/menu/__init__.py create mode 100644 allianceauth/menu/admin.py create mode 100644 allianceauth/menu/apps.py create mode 100644 allianceauth/menu/hooks.py create mode 100644 allianceauth/menu/migrations/0001_initial.py create mode 100644 allianceauth/menu/migrations/0002_alter_menuitem_hook_function_and_more.py create mode 100644 allianceauth/menu/migrations/0003_menuitem_menu_menuit_rank_e880ab_idx.py create mode 100644 allianceauth/menu/migrations/0004_alter_menuitem_hide_alter_menuitem_icon_classes_and_more.py create mode 100644 allianceauth/menu/migrations/__init__.py create mode 100644 allianceauth/menu/models.py create mode 100644 allianceauth/menu/providers.py create mode 100644 allianceauth/menu/templates/menu/menu-block.html create mode 100644 allianceauth/menu/templates/menu/menu-item-bs5.html create mode 100644 allianceauth/menu/templates/menu/menu-notification-block.html create mode 100644 allianceauth/menu/templates/menu/menu-user.html create mode 100644 allianceauth/menu/templates/menu/sortable-side-menu.html create mode 100644 allianceauth/menu/templatetags/__init__.py create mode 100644 allianceauth/menu/templatetags/menu_items.py create mode 100644 allianceauth/optimer/templates/optimer/dashboard.ops.html create mode 100644 allianceauth/services/templates/services/services_ctrl_base.html create mode 100644 allianceauth/static/allianceauth/images/auth-logo.png create mode 100644 allianceauth/static/allianceauth/images/auth-logo.svg create mode 100644 allianceauth/static/allianceauth/js/jquery-ui/1.13.2/css/images/ui-icons_444444_256x240.png create mode 100644 allianceauth/static/allianceauth/js/jquery-ui/1.13.2/css/images/ui-icons_555555_256x240.png create mode 100644 allianceauth/static/allianceauth/js/jquery-ui/1.13.2/css/images/ui-icons_777620_256x240.png create mode 100644 allianceauth/static/allianceauth/js/jquery-ui/1.13.2/css/images/ui-icons_777777_256x240.png create mode 100644 allianceauth/static/allianceauth/js/jquery-ui/1.13.2/css/images/ui-icons_cc0000_256x240.png create mode 100644 allianceauth/static/allianceauth/js/jquery-ui/1.13.2/css/images/ui-icons_ffffff_256x240.png create mode 100644 allianceauth/static/allianceauth/js/jquery-ui/1.13.2/css/jquery-ui.min.css create mode 100644 allianceauth/templates/allianceauth/base-bs5.html create mode 100644 allianceauth/templates/allianceauth/error.html create mode 100644 allianceauth/templates/allianceauth/messages-bs5.html create mode 100644 allianceauth/templates/allianceauth/top-menu-rh-default.html create mode 100644 allianceauth/templates/bundles/datatables-css-bs5.html create mode 100644 allianceauth/templates/bundles/datatables-js-bs5.html create mode 100644 allianceauth/templates/bundles/jquery-js.html create mode 100644 allianceauth/theme/__init__.py create mode 100644 allianceauth/theme/apps.py create mode 100644 allianceauth/theme/bootstrap/__init__.py create mode 100644 allianceauth/theme/bootstrap/apps.py create mode 100644 allianceauth/theme/bootstrap/auth_hooks.py create mode 100644 allianceauth/theme/bootstrap_dark/__init__.py create mode 100644 allianceauth/theme/bootstrap_dark/apps.py create mode 100644 allianceauth/theme/bootstrap_dark/auth_hooks.py create mode 100644 allianceauth/theme/darkly/__init__.py create mode 100644 allianceauth/theme/darkly/apps.py create mode 100644 allianceauth/theme/darkly/auth_hooks.py create mode 100644 allianceauth/theme/flatly/__init__.py create mode 100644 allianceauth/theme/flatly/apps.py create mode 100644 allianceauth/theme/flatly/auth_hooks.py create mode 100644 allianceauth/theme/hooks.py create mode 100644 allianceauth/theme/materia/__init__.py create mode 100644 allianceauth/theme/materia/apps.py create mode 100644 allianceauth/theme/materia/auth_hooks.py create mode 100644 allianceauth/theme/templates/__init__.py create mode 100644 allianceauth/theme/templates/theme/__init__.py create mode 100644 allianceauth/theme/templates/theme/theme_imports_css.html create mode 100644 allianceauth/theme/templates/theme/theme_imports_js.html create mode 100644 allianceauth/theme/templates/theme/theme_select.html create mode 100644 allianceauth/theme/templatetags/__init__.py create mode 100644 allianceauth/theme/templatetags/theme_tags.py create mode 100644 allianceauth/timerboard/templates/timerboard/dashboard.timers.html create mode 100644 docs/development/custom/custom-themes.md diff --git a/allianceauth/apps.py b/allianceauth/apps.py index 2e6bd289..053f71f8 100644 --- a/allianceauth/apps.py +++ b/allianceauth/apps.py @@ -1,5 +1,30 @@ from django.apps import AppConfig +from django.core.checks import Warning, Error, register class AllianceAuthConfig(AppConfig): name = 'allianceauth' + + +@register() +def check_settings(app_configs, **kwargs): + from django.conf import settings + + errors = [] + if hasattr(settings, "SITE_URL"): + if settings.SITE_URL[-1] == "/": + errors.append(Warning( + "'SITE_URL' Has a trailing slash. This may lead to incorrect links being generated by Auth.")) + else: + errors.append(Error( + "No 'SITE_URL' found is settings. This may lead to incorrect links being generated by Auth or Errors in 3rd party modules.")) + if hasattr(settings, "CSRF_TRUSTED_ORIGINS"): + if hasattr(settings, "SITE_URL"): + if settings.SITE_URL not in settings.CSRF_TRUSTED_ORIGINS: + errors.append(Warning( + "'SITE_URL' not found in 'CSRF_TRUSTED_ORIGINS'. Auth may not load pages correctly until this is rectified.")) + else: + errors.append(Error( + "No 'CSRF_TRUSTED_ORIGINS' found is settings, Auth may not load pages correctly until this is rectified")) + + return errors diff --git a/allianceauth/authentication/auth_hooks.py b/allianceauth/authentication/auth_hooks.py new file mode 100644 index 00000000..abc22803 --- /dev/null +++ b/allianceauth/authentication/auth_hooks.py @@ -0,0 +1,45 @@ +from allianceauth.hooks import DashboardItemHook +from allianceauth import hooks +from .views import dashboard_characters, dashboard_groups, dashboard_admin + + +class UserCharactersHook(DashboardItemHook): + def __init__(self): + DashboardItemHook.__init__( + self, + dashboard_characters, + 5 + ) + + +class UserGroupsHook(DashboardItemHook): + def __init__(self): + DashboardItemHook.__init__( + self, + dashboard_groups, + 5 + ) + + +class AdminHook(DashboardItemHook): + def __init__(self): + DashboardItemHook.__init__( + self, + dashboard_admin, + 0 + ) + + +@hooks.register('dashboard_hook') +def register_character_hook(): + return UserCharactersHook() + + +@hooks.register('dashboard_hook') +def register_groups_hook(): + return UserGroupsHook() + + +@hooks.register('dashboard_hook') +def register_admin_hook(): + return AdminHook() diff --git a/allianceauth/authentication/middleware.py b/allianceauth/authentication/middleware.py index 5e2f0409..f2fc8145 100644 --- a/allianceauth/authentication/middleware.py +++ b/allianceauth/authentication/middleware.py @@ -31,6 +31,7 @@ class UserSettingsMiddleware(MiddlewareMixin): except Exception as e: logger.exception(e) + # AA v3 NIGHT_MODE # Set our Night mode flag from the DB # Null = hasnt been set by the user ever, dont act. # @@ -42,4 +43,11 @@ class UserSettingsMiddleware(MiddlewareMixin): except Exception as e: logger.exception(e) + # AA v4 Themes + try: + if request.user.profile.theme is not None: + request.session["THEME"] = request.user.profile.theme + except Exception as e: + logger.exception(e) + return response diff --git a/allianceauth/authentication/migrations/0022_userprofile_theme.py b/allianceauth/authentication/migrations/0022_userprofile_theme.py new file mode 100644 index 00000000..7dd64774 --- /dev/null +++ b/allianceauth/authentication/migrations/0022_userprofile_theme.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.10 on 2023-10-07 07:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('authentication', '0021_alter_userprofile_language'), + ] + + operations = [ + migrations.AddField( + model_name='userprofile', + name='theme', + field=models.CharField(blank=True, help_text='Bootstrap 5 Themes from https://bootswatch.com/ or Community Apps', max_length=200, null=True, verbose_name='Theme'), + ), + ] diff --git a/allianceauth/authentication/models.py b/allianceauth/authentication/models.py index 6d7a06b8..068eab14 100644 --- a/allianceauth/authentication/models.py +++ b/allianceauth/authentication/models.py @@ -101,6 +101,13 @@ class UserProfile(models.Model): _("Night Mode"), blank=True, null=True) + theme = models.CharField( + _("Theme"), + max_length=200, + blank=True, + null=True, + help_text="Bootstrap 5 Themes from https://bootswatch.com/ or Community Apps" + ) def assign_state(self, state=None, commit=True): if not state: diff --git a/allianceauth/authentication/templates/authentication/dashboard.characters.html b/allianceauth/authentication/templates/authentication/dashboard.characters.html new file mode 100644 index 00000000..6b4f4d09 --- /dev/null +++ b/allianceauth/authentication/templates/authentication/dashboard.characters.html @@ -0,0 +1,41 @@ +{% load i18n %} +
+
+
+
+

+ {% translate "Characters" %} +

+
+
+
+ + + + + + + + + + + + {% for char in characters %} + + + + + + + {% endfor %} + +
{% translate "Name" %}{% translate "Corp" %}{% translate "Alliance" %}
+ {{ char.character_name }}{{ char.corporation_name }}{{ char.alliance_name|default_if_none:"" }}
+
+
+
+
+
diff --git a/allianceauth/authentication/templates/authentication/dashboard.groups.html b/allianceauth/authentication/templates/authentication/dashboard.groups.html new file mode 100644 index 00000000..1a746a3b --- /dev/null +++ b/allianceauth/authentication/templates/authentication/dashboard.groups.html @@ -0,0 +1,20 @@ +{% load i18n %} +
+
+
+

{% translate "Membership" %}

+
+
+
{% translate "State:" %} {{ request.user.profile.state }}
+ + {% for group in groups %} + + + + {% endfor %} +
{{ group.name }}
+
+
+
+
+
diff --git a/allianceauth/authentication/templates/authentication/dashboard.html b/allianceauth/authentication/templates/authentication/dashboard.html index 896dddfe..af1ece0d 100644 --- a/allianceauth/authentication/templates/authentication/dashboard.html +++ b/allianceauth/authentication/templates/authentication/dashboard.html @@ -1,190 +1,15 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} +{% load static %} {% load i18n %} {% block page_title %}{% translate "Dashboard" %}{% endblock %} - +{% block header_nav_brand %} + {% translate "Dashboard" %} +{% endblock %} {% block content %} -

{% translate "Dashboard" %}

- {% if user.is_staff %} - {% include 'allianceauth/admin-status/include.html' %} - {% endif %} -
-
-
-
-
-

- {% blocktranslate with state=request.user.profile.state %} - Main Character (State: {{ state }}) - {% endblocktranslate %} -

-
-
- {% if request.user.profile.main_character %} - {% with request.user.profile.main_character as main %} - -
-

- {{ main.corporation_name }} - {{ main.corporation_name }} - {% if main.alliance_id %} - {{ main.alliance_name }} - {% endif %} - {% if main.faction_id %} - {{ main.faction_name }} - {% endif %} -

-

- {{ main.character_name }}
- {{ main.corporation_name }}
- {% if main.alliance_id %} - {{ main.alliance_name }}
- {% endif %} - {% if main.faction_id %} - {{ main.faction_name }} - {% endif %} -

-
- {% endwith %} - {% else %} - - {% endif %} -
- -
-
-
-
-
-
-

{% translate "Group Memberships" %}

-
-
-
- - {% for group in groups %} - - - - {% endfor %} -
{{ group.name }}
-
-
-
-
-
-
-
-
-

- {% translate 'Characters' %} -

-
-
- - - - - - - - - - - {% for char in characters %} - - - - - - - {% endfor %} - - - - - {% for char in characters %} - - - - - {% endfor %} - -
- {{ char.character_name }} - - {{ char.character_name }}
- {{ char.corporation_name }}
- {{ char.alliance_name|default:"" }} -
-
-
+
+ {% for dash in views %} + {{ dash | safe }} + {% endfor %}
{% endblock %} diff --git a/allianceauth/authentication/templates/authentication/tokens.html b/allianceauth/authentication/templates/authentication/tokens.html index 11bb91ed..cb99e2c3 100644 --- a/allianceauth/authentication/templates/authentication/tokens.html +++ b/allianceauth/authentication/templates/authentication/tokens.html @@ -1,7 +1,7 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} -{% block page_title %}{% translate "Dashboard" %}{% endblock %} +{% block page_title %}{% translate "Dashboard" %}{% endblock page_title %} {% block content %}

{% translate "Token Management" %}

@@ -10,7 +10,7 @@ {% translate "Scopes" %} - {% translate "Actions" %} + {% translate "Actions" %} {% translate "Character" %} @@ -18,24 +18,24 @@ {% for t in tokens %} - {% for s in t.scopes.all %}{{s.name}} {% endfor %} - - {{t.character_name}} + {% for s in t.scopes.all %}{{ s.name }} {% endfor %} + + {{ t.character_name }} {% endfor %} {% translate "This page is a best attempt, but backups or database logs can still contain your tokens. Always revoke tokens on https://community.eveonline.com/support/third-party-applications/ where possible."|urlize %}
-{% endblock %} +{% endblock content %} {% block extra_javascript %} - {% include 'bundles/datatables-js.html' %} -{% endblock %} + {% include "bundles/datatables-js-bs5.html" %} +{% endblock extra_javascript %} {% block extra_css %} - {% include 'bundles/datatables-css.html' %} -{% endblock %} + {% include "bundles/datatables-css-bs5.html" %} +{% endblock extra_css %} {% block extra_script %} $(document).ready(function(){ @@ -59,4 +59,4 @@ "stateSave": true, }); }); -{% endblock %} +{% endblock extra_script %} diff --git a/allianceauth/authentication/templates/public/base.html b/allianceauth/authentication/templates/public/base.html index 62529bda..f5cb128c 100644 --- a/allianceauth/authentication/templates/public/base.html +++ b/allianceauth/authentication/templates/public/base.html @@ -7,6 +7,7 @@ + diff --git a/allianceauth/authentication/views.py b/allianceauth/authentication/views.py index 15c746c7..b6fa6411 100644 --- a/allianceauth/authentication/views.py +++ b/allianceauth/authentication/views.py @@ -1,4 +1,5 @@ import logging +from allianceauth.hooks import get_hooks from django_registration.backends.activation.views import ( REGISTRATION_SALT, ActivationView as BaseActivationView, @@ -42,23 +43,51 @@ def index(request): return redirect('authentication:dashboard') -@login_required -def dashboard(request): +def dashboard_groups(request): groups = request.user.groups.all() if _has_auto_groups: groups = groups\ .filter(managedalliancegroup__isnull=True)\ .filter(managedcorpgroup__isnull=True) groups = groups.order_by('name') + + context = { + 'groups': groups, + } + return render_to_string('authentication/dashboard.groups.html', context=context, request=request) + + +def dashboard_characters(request): characters = EveCharacter.objects\ .filter(character_ownership__user=request.user)\ .select_related()\ .order_by('character_name') context = { - 'groups': groups, 'characters': characters } + return render_to_string('authentication/dashboard.characters.html', context=context, request=request) + + +def dashboard_admin(request): + if request.user.is_superuser: + return render_to_string('allianceauth/admin-status/include.html', request=request) + else: + return "" + + +@login_required +def dashboard(request): + _dash_items = list() + hooks = get_hooks('dashboard_hook') + items = [fn() for fn in hooks] + items.sort(key=lambda i: i.order) + for item in items: + _dash_items.append(item.render(request)) + + context = { + 'views': _dash_items, + } return render(request, 'authentication/dashboard.html', context) diff --git a/allianceauth/context_processors.py b/allianceauth/context_processors.py index 4feb243e..cafde2ea 100644 --- a/allianceauth/context_processors.py +++ b/allianceauth/context_processors.py @@ -1,5 +1,5 @@ from django.conf import settings -from .views import NightModeRedirectView +from .views import NightModeRedirectView, ThemeRedirectView def auth_settings(request): diff --git a/allianceauth/corputils/auth_hooks.py b/allianceauth/corputils/auth_hooks.py index d90d7f3c..77bfae91 100644 --- a/allianceauth/corputils/auth_hooks.py +++ b/allianceauth/corputils/auth_hooks.py @@ -1,4 +1,5 @@ -from allianceauth.services.hooks import MenuItemHook, UrlHook +from allianceauth.menu.hooks import MenuItemHook +from allianceauth.services.hooks import UrlHook from django.utils.translation import gettext_lazy as _ from allianceauth import hooks from allianceauth.corputils import urls diff --git a/allianceauth/corputils/templates/corputils/base.html b/allianceauth/corputils/templates/corputils/base.html index 17300d94..aff00288 100644 --- a/allianceauth/corputils/templates/corputils/base.html +++ b/allianceauth/corputils/templates/corputils/base.html @@ -1,6 +1,8 @@ -{% extends 'allianceauth/base.html' %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} -{% block page_title %}{% translate "Corporation Member Data" %}{% endblock %} +{% block page_title %} + {% translate "Corporation Member Data" %} +{% endblock page_title %} {% block content %}

{% translate "Corporation Member Data" %}

@@ -26,12 +28,13 @@
- {% block member_data %}{% endblock %} + {% block member_data %} + {% endblock member_data %} -{% endblock %} +{% endblock content %} diff --git a/allianceauth/corputils/templates/corputils/corpstats.html b/allianceauth/corputils/templates/corputils/corpstats.html index d1d7cc16..9458bc25 100644 --- a/allianceauth/corputils/templates/corputils/corpstats.html +++ b/allianceauth/corputils/templates/corputils/corpstats.html @@ -87,7 +87,7 @@ {{ alt.corporation_name }} {{ alt.alliance_name }} - + {% translate "Killboard" %} @@ -122,7 +122,7 @@ {{ member }} {{ member }} - {% translate "Killboard" %} + {% translate "Killboard" %} {{ member.character_ownership.user.profile.main_character.character_name }} {{ member.character_ownership.user.profile.main_character.corporation_name }} @@ -134,7 +134,7 @@ {{ member.character_name }} {{ member.character_name }} - {% translate "Killboard" %} + {% translate "Killboard" %} @@ -163,7 +163,7 @@ {{ member.character_name }} {{ member.character_name }} - + {% translate "Killboard" %} diff --git a/allianceauth/corputils/templates/corputils/search.html b/allianceauth/corputils/templates/corputils/search.html index 83c34802..d5d9c6c0 100644 --- a/allianceauth/corputils/templates/corputils/search.html +++ b/allianceauth/corputils/templates/corputils/search.html @@ -24,7 +24,7 @@ {{ result.1.character_name }} {{ result.1.character_name }} {{ result.0.corp.corporation_name }} - {% translate "Killboard" %} + {% translate "Killboard" %} {{ result.1.main_character.character_name }} {{ result.1.main_character.corporation_name }} {{ result.1.main_character.alliance_name }} diff --git a/allianceauth/eveonline/templatetags/examples.html b/allianceauth/eveonline/templatetags/examples.html index 180aa3f8..486394c8 100644 --- a/allianceauth/eveonline/templatetags/examples.html +++ b/allianceauth/eveonline/templatetags/examples.html @@ -8,10 +8,10 @@ Needs to be called with a context containing three objects: --> -{% extends 'allianceauth/base.html' %} +{% extends "allianceauth/base-bs5.html" %} {% load evelinks %} -{% block page_title %}Evelinks examples{% endblock %} +{% block page_title %}Evelinks Examples{% endblock page_title %} {% block content %} @@ -25,60 +25,57 @@ Needs to be called with a context containing three objects:

evewho

-

character from character object

-

corporation form corporation object

-

corporation from charachter object

-

alliance from alliance object

-

alliance from character object

+

character from character object

+

corporation form corporation object

+

corporation from charachter object

+

alliance from alliance object

+

alliance from character object

dotlan

-

corporation form character object

-

corporation form corporation object

-

alliance from character object

-

alliance from alliance object

-

region from name string

-

solar system from name string

+

corporation form character object

+

corporation form corporation object

+

alliance from character object

+

alliance from alliance object

+

region from name string

+

solar system from name string

zkillboard

-

character from character object

-

corporation from character object

-

corporation form corporation object

-

alliance from character object

-

alliance from alliance object

-

region from ID

-

solar sytem from ID

+

character from character object

+

corporation from character object

+

corporation form corporation object

+

alliance from character object

+

alliance from alliance object

+

region from ID

+

solar sytem from ID

-

image URLs

-

character from ID:

-

character from character object:

+

character from ID:

+

character from character object:

-

corporation from ID:

-

corporation from character object:

-

corporation from corporation object:

+

corporation from ID:

+

corporation from character object:

+

corporation from corporation object:

-

alliance from ID:

-

alliance from character object:

-

alliance from alliance object:

+

alliance from ID:

+

alliance from character object:

+

alliance from alliance object:

-
- -{% endblock %} +{% endblock content %} diff --git a/allianceauth/fleetactivitytracking/auth_hooks.py b/allianceauth/fleetactivitytracking/auth_hooks.py index 8d71fc13..4c68b340 100644 --- a/allianceauth/fleetactivitytracking/auth_hooks.py +++ b/allianceauth/fleetactivitytracking/auth_hooks.py @@ -1,7 +1,8 @@ +from allianceauth.menu.hooks import MenuItemHook from . import urls from django.utils.translation import gettext_lazy as _ from allianceauth import hooks -from allianceauth.services.hooks import MenuItemHook, UrlHook +from allianceauth.services.hooks import UrlHook @hooks.register('menu_item_hook') diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html index d0b9d8ae..fe015866 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html @@ -1,27 +1,28 @@ -{% extends 'allianceauth/base.html' %} +{% extends 'allianceauth/base-bs5.html' %} {% load i18n %} -{% block page_title %}{% translate "Fleet Participation" %}{% endblock %} - +{% block page_title %} + {% translate "Fleet Participation" %} +{% endblock %} {% block content %} -
-

{% translate "Character not found!" %}

-
-
-
-
-
{{ character_name }}
-
-
- {{ character_name }} -
-
- - {% translate "This character is not associated with an auth account." %} {% translate "Add it here" %} {% translate "before attempting to click fleet attendance links." %} +
+

{% translate "Character not found!" %}

+
+
+
+
+
{{ character_name }}
+
+
+ {{ character_name }} +
+
+ + {% translate "This character is not associated with an auth account." %} {% translate "Add it here" %} {% translate "before attempting to click fleet attendance links." %} +
-
{% endblock %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html index 25f9656e..493bf9af 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html @@ -1,31 +1,31 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load bootstrap %} {% load i18n %} - -{% block page_title %}{% translate "Create Fatlink" %}{% endblock page_title %} - +{% block page_title %} + {% translate "Create Fatlink" %} +{% endblock page_title %} {% block content %}

{% translate "Create Fleet Operation" %}

-
{% if badrequest %} - + {% endif %} - {% for message in errormessages %} - - {% endfor %} -
+ {% for message in errormessages %}{% endfor %} +
- +
- {% endblock content %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html index b794b646..5415cb54 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html @@ -1,11 +1,11 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} {% block page_title %}{% translate "Fatlink view" %}{% endblock page_title %} {% block content %}

{% translate "Edit fatlink" %} "{{ fatlink }}" -
+
+ {% else %} +
+ {% translate "No groups to list." %} +
+ {% endif %} {% endblock content %} {% block extra_javascript %} - {% include 'bundles/clipboard-js.html' %} + {% include "bundles/clipboard-js.html" %} -{% endblock %} +{% endblock extra_javascript %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/groups.html b/allianceauth/groupmanagement/templates/groupmanagement/groups.html index 7b750f54..08733dec 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/groups.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groups.html @@ -1,62 +1,96 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} +{% load static %} {% load i18n %} {% block page_title %}{% translate "Available Groups" %}{% endblock page_title %} -{% block extra_css %}{% endblock extra_css %} +{% block header_nav_brand %}{% translate "Available Groups" %}{% endblock header_nav_brand %} +{% if manager_perms %} +{% block header_nav_collapse_left %} + +{% endblock %} +{% endif %} {% block content %} -
-

{% translate "Available Groups" %}

- {% if groups %} - - - - - - - - + {% if groups %} +
{% translate "Name" %}{% translate "Description" %}
+ + + + + + + + - - {% for g in groups %} - - - - + {% for g in groups %} + + + + + - - {% endfor %} - -
{% translate "Name" %}{% translate "Description" %}{% translate "Leaders" %}UserGroup
{{ g.group.name }}{{ g.group.authgroup.description|linebreaks|urlize }} - {% if g.group in user.groups.all %} - {% if not g.request %} - - {% translate "Leave" %} - - {% else %} - - {% endif %} - {% elif not g.request %} - {% if g.group.authgroup.open %} - - {% translate "Join" %} - - {% else %} - - {% translate "Request" %} - - {% endif %} +
{{ g.group.name }}{{ g.group.authgroup.description|linebreaks|urlize }} + {% if g.group.authgroup.group_leaders.all.count %} + {% for leader in g.group.authgroup.group_leaders.all %}{% if leader.profile.main_character %}{{leader.profile.main_character}}{% endif %}{% endfor %} + {% endif %} + {% if g.group.authgroup.group_leaders.all.count %} + {% for group in g.group.authgroup.group_leader_groups.all %}{{group.name}}{% endfor %} + {% endif %} + + {% if g.group in user_groups %} + {% if not g.request %} + + {% translate "Leave" %} + {% else %} {% endif %} -
- {% else %} -
- {% translate "No groups available." %} -
- {% endif %} -
+ {% elif not g.request %} + {% if g.group.authgroup.open %} + + {% translate "Join" %} + + {% else %} + + {% translate "Request" %} + + {% endif %} + {% else %} + + {% endif %} + + + {% endfor %} + + + + {% else %} +
+ {% translate "No groups available." %} +
+ {% endif %} {% endblock content %} +{% block extra_javascript %} + {% include 'bundles/datatables-js-bs5.html' %} +{% endblock %} + +{% block extra_css %} + {% include 'bundles/datatables-css-bs5.html' %} +{% endblock %} + +{% block extra_script %} + + $(document).ready(function () { + $('#groupsTable').DataTable(); + }); + +{% endblock extra_script %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/index.html b/allianceauth/groupmanagement/templates/groupmanagement/index.html index 5a383501..da176b35 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/index.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/index.html @@ -1,166 +1,158 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} +{% load static %} {% load i18n %} {% load evelinks %} +{% load navactive %} {% block page_title %}{% translate "Groups Management" %}{% endblock page_title %} +{% block header_nav_brand %}{% translate "Groups Management" %}{% endblock header_nav_brand %} {% block extra_css %} - {% endblock extra_css %} -{% block content %} -
-
- {% include 'groupmanagement/menu.html' %} +{% block header_nav_collapse_left %} +
  • + + {% translate "Join Requests" %} - + +
  • +{% endif %} + -
    -
    -
    +{% endblock %} -
    - {% if acceptrequests %} -
    - - - - - - - - - - - {% for acceptrequest in acceptrequests %} - - - - - + {% for acceptrequest in acceptrequests %} + + + + + + + {% endfor %} + +
    {% translate "Character" %}{% translate "Organization" %}{% translate "Group" %}
    - {{ acceptrequest.main_char.character_name }} - {% if acceptrequest.main_char %} - - {{ acceptrequest.main_char.character_name }} - - {% else %} - {{ acceptrequest.user.username }} - {% endif %} - - {% if acceptrequest.main_char %} - - {{ acceptrequest.main_char.corporation_name }} -
    - {{ acceptrequest.main_char.alliance_name|default_if_none:"" }} - {% else %} - {% translate "(unknown)" %} - {% endif %} -
    {{ acceptrequest.group.name }} - - {% translate "Accept" %} - +{% block content %} +
    +
    + {% if acceptrequests %} +
    + + + + + + + + + - - {% translate "Reject" %} - - - - {% endfor %} - -
    {% translate "Character" %}{% translate "Organization" %}{% translate "Group" %}
    -
    - {% else %} -
    {% translate "No group add requests." %}
    - {% endif %} -
    +
    + + {% if acceptrequest.main_char %} + + {{ acceptrequest.main_char.character_name }} + + {% else %} + {{ acceptrequest.user.username }} + {% endif %} + + {% if acceptrequest.main_char %} + + {{ acceptrequest.main_char.corporation_name }} +
    + {{ acceptrequest.main_char.alliance_name|default_if_none:"" }} + {% else %} + {% translate "(unknown)" %} + {% endif %} +
    {{ acceptrequest.group.name }} + + {% translate "Accept" %} + - {% if not auto_leave %} -
    - {% if leaverequests %} -
    - - - - - - - - - - - - {% for leaverequest in leaverequests %} - - - - - - - {% endfor %} - -
    {% translate "Character" %}{% translate "Organization" %}{% translate "Group" %}
    - {{ leaverequest.main_char.character_name }} - {% if leaverequest.main_char %} - - {{ leaverequest.main_char.character_name }} - - {% else %} - {{ leaverequest.user.username }} - {% endif %} - - {% if leaverequest.main_char %} - - {{ leaverequest.main_char.corporation_name }} -
    - {{ leaverequest.main_char.alliance_name|default_if_none:"" }} - {% else %} - {% translate "(unknown)" %} - {% endif %} -
    {{ leaverequest.group.name }} - - {% translate "Accept" %} - - - - {% translate "Reject" %} - -
    -
    - {% else %} -
    {% translate "No group leave requests." %}
    - {% endif %} -
    - {% endif %} - + + {% translate "Reject" %} + +
    -
    + {% else %} +
    {% translate "No group add requests." %}
    + {% endif %}
    + + {% if not auto_leave %} +
    + {% if leaverequests %} +
    + + + + + + + + + + + + {% for leaverequest in leaverequests %} + + + + + + + {% endfor %} + +
    {% translate "Character" %}{% translate "Organization" %}{% translate "Group" %}
    + + {% if leaverequest.main_char %} + + {{ leaverequest.main_char.character_name }} + + {% else %} + {{ leaverequest.user.username }} + {% endif %} + + {% if leaverequest.main_char %} + + {{ leaverequest.main_char.corporation_name }} +
    + {{ leaverequest.main_char.alliance_name|default_if_none:"" }} + {% else %} + {% translate "(unknown)" %} + {% endif %} +
    {{ leaverequest.group.name }} + + {% translate "Accept" %} + + + + {% translate "Reject" %} + +
    +
    + {% else %} +
    {% translate "No group leave requests." %}
    + {% endif %} +
    + {% endif %} +
    {% endblock content %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/menu.html b/allianceauth/groupmanagement/templates/groupmanagement/menu.html index be84acb5..1adbdadd 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/menu.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/menu.html @@ -1,27 +1,10 @@ {% load i18n %} {% load navactive %} - + + diff --git a/allianceauth/groupmanagement/views.py b/allianceauth/groupmanagement/views.py index 8ab1af22..b1c00498 100644 --- a/allianceauth/groupmanagement/views.py +++ b/allianceauth/groupmanagement/views.py @@ -87,7 +87,7 @@ def group_membership_audit(request, group_id): except ObjectDoesNotExist: raise Http404("Group does not exist") - render_items = {'group': group.name} + render_items = {'group': group} entries = RequestLog.objects.filter(group=group).order_by('-date') render_items['entries'] = entries @@ -311,8 +311,10 @@ def groups_view(request): groups_qs = GroupManager.get_joinable_groups_for_user( request.user, include_hidden=False ) - groups_qs = groups_qs.order_by('name') + groups_qs = groups_qs.order_by('name').select_related("authgroup").prefetch_related('authgroup__group_leaders', 'authgroup__group_leaders__profile__main_character', 'authgroup__group_leader_groups') groups = [] + + ## TODO see about making this faster for group in groups_qs: group_request = GroupRequest.objects\ .filter(user=request.user)\ @@ -322,7 +324,14 @@ def groups_view(request): 'request': group_request[0] if group_request else None }) - context = {'groups': groups} + count = 0 + perms = GroupManager.can_manage_groups(request.user) + if perms: + count = GroupManager.pending_requests_count_for_user(request.user) + + user_groups_list = list(request.user.groups.all()) + context = {'groups': groups, "manager_perms": perms, "req_count":count, "user_groups": user_groups_list} + return render(request, 'groupmanagement/groups.html', context=context) diff --git a/allianceauth/hooks.py b/allianceauth/hooks.py index 773daa12..70ca3439 100644 --- a/allianceauth/hooks.py +++ b/allianceauth/hooks.py @@ -91,7 +91,7 @@ def get_app_modules(): def get_app_submodules(module_name): - """ + """pyt Get a specific sub module of the app :param module_name: module name to get :return: name, module tuple @@ -122,3 +122,17 @@ def get_hooks(name): """ register_all_hooks() return _hooks.get(name, []) + + +class DashboardItemHook: + def __init__(self, view_function, order:int=10): + self.view_function = view_function + self.order = order + + def render(self, request): + try: + logger.debug(f"Rendering {self.view_function} to dashboard") + return self.view_function(request) + except Exception as e: + logger.exception("Rendering {self.view_function} Failed!") + return "" diff --git a/allianceauth/hrapplications/auth_hooks.py b/allianceauth/hrapplications/auth_hooks.py index 9f32f8fc..d0af8a5b 100644 --- a/allianceauth/hrapplications/auth_hooks.py +++ b/allianceauth/hrapplications/auth_hooks.py @@ -1,7 +1,8 @@ from django.utils.translation import gettext_lazy as _ from allianceauth import hooks -from allianceauth.services.hooks import MenuItemHook, UrlHook +from allianceauth.menu.hooks import MenuItemHook +from allianceauth.services.hooks import UrlHook from . import urls from .models import Application diff --git a/allianceauth/hrapplications/templates/hrapplications/corpchoice.html b/allianceauth/hrapplications/templates/hrapplications/corpchoice.html index ab97414b..e22ae52c 100644 --- a/allianceauth/hrapplications/templates/hrapplications/corpchoice.html +++ b/allianceauth/hrapplications/templates/hrapplications/corpchoice.html @@ -1,4 +1,4 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} {% block page_title %}{% translate "Choose a Corp" %}{% endblock page_title %} diff --git a/allianceauth/hrapplications/templates/hrapplications/create.html b/allianceauth/hrapplications/templates/hrapplications/create.html index 93507d46..e906109a 100644 --- a/allianceauth/hrapplications/templates/hrapplications/create.html +++ b/allianceauth/hrapplications/templates/hrapplications/create.html @@ -1,4 +1,4 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} {% block page_title %}{% translate "Apply To" %} {{ corp.corporation_name }}{% endblock page_title %} diff --git a/allianceauth/hrapplications/templates/hrapplications/management.html b/allianceauth/hrapplications/templates/hrapplications/management.html index b9e7f260..6e8844c4 100644 --- a/allianceauth/hrapplications/templates/hrapplications/management.html +++ b/allianceauth/hrapplications/templates/hrapplications/management.html @@ -8,7 +8,7 @@ {% block content %}

    {% translate "Personal Applications" %} -
    +
    {% if create %} @@ -33,11 +33,11 @@ {{ personal_app.form.corp.corporation_name }} {% if personal_app.approved == None %} -
    {% translate "Pending" %}
    +
    {% translate "Pending" %}
    {% elif personal_app.approved == True %} -
    {% translate "Approved" %}
    +
    {% translate "Approved" %}
    {% else %} -
    {% translate "Rejected" %}
    +
    {% translate "Rejected" %}
    {% endif %} @@ -58,7 +58,7 @@ {% endif %} {% if perms.auth.human_resources %}

    {% translate "Application Management" %} -
    +
    + {% if user.is_superuser %} + + {% translate "Admin" %} + + {% endif %} +
    +
    + + {% if user.is_superuser %} + + + + {% endif %} + {% if user.is_authenticated %} + + {% else %} + + {% endif %} +
    +
    diff --git a/allianceauth/menu/templates/menu/sortable-side-menu.html b/allianceauth/menu/templates/menu/sortable-side-menu.html new file mode 100644 index 00000000..1ee45fce --- /dev/null +++ b/allianceauth/menu/templates/menu/sortable-side-menu.html @@ -0,0 +1,21 @@ +{% load i18n %} +{% load navactive %} +{% load menu_items %} +
    + +
    diff --git a/allianceauth/menu/templatetags/__init__.py b/allianceauth/menu/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/allianceauth/menu/templatetags/menu_items.py b/allianceauth/menu/templatetags/menu_items.py new file mode 100644 index 00000000..3d01b90c --- /dev/null +++ b/allianceauth/menu/templatetags/menu_items.py @@ -0,0 +1,35 @@ +from django import template + +from allianceauth.hooks import get_hooks +from allianceauth.menu.models import MenuItem + +from ..providers import MenuProvider + +register = template.Library() + + +def process_menu_items(hooks, request): + _menu_items = list() + items = [fn() for fn in hooks] + items.sort(key=lambda i: i.order) + for item in items: + _menu_items.append(item.render(request)) + return _menu_items + + +@register.inclusion_tag('public/menublock.html', takes_context=True) +def menu_items(context): + request = context['request'] + + return { + 'menu_items': process_menu_items(get_hooks('menu_item_hook'), request), + } + + +@register.inclusion_tag('menu/menu-block.html', takes_context=True) +def sorted_menu_items(context): + request = context['request'] + manu_items = MenuItem.render_menu(request) + return { + 'menu_items':manu_items + } diff --git a/allianceauth/notifications/templates/notifications/list.html b/allianceauth/notifications/templates/notifications/list.html index 13881f70..0dad3b96 100644 --- a/allianceauth/notifications/templates/notifications/list.html +++ b/allianceauth/notifications/templates/notifications/list.html @@ -1,37 +1,47 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} +{% load static %} {% load i18n %} -{% block page_title %}{% translate "Notifications" %}{% endblock %} - +{% block page_title %} + {% translate "Notifications" %} +{% endblock page_title %} +{% block header_nav_brand %} + {% translate "Notifications" %} +{% endblock header_nav_brand %} +{% block header_nav_collapse_left %} + + +{% endblock %} +{% block header_nav_collapse_right %} + + +{% endblock %} {% block content %} -

    {% translate "Notifications" %}

    - -
    - -
    - - +
    +
    + {% include "notifications/list_partial.html" with notifications=unread %}
    -
    -
    - -
    - {% include "notifications/list_partial.html" with notifications=unread %} -
    - -
    - {% include "notifications/list_partial.html" with notifications=read %} -
    - -
    +
    + {% include "notifications/list_partial.html" with notifications=read %}
    -
    {% endblock %} diff --git a/allianceauth/notifications/templates/notifications/list_partial.html b/allianceauth/notifications/templates/notifications/list_partial.html index cdd0e559..c9dabbfe 100644 --- a/allianceauth/notifications/templates/notifications/list_partial.html +++ b/allianceauth/notifications/templates/notifications/list_partial.html @@ -1,29 +1,27 @@ {% load i18n %} {% if notifications %} -
    - - - - - +
    {% translate "Timestamp" %}{% translate "Title" %}{% translate "Action" %}
    + + + + + + {% for notif in notifications %} + + + + - {% for notif in notifications %} - - - - - - {% endfor %} -
    {% translate "Timestamp" %}{% translate "Title" %}{% translate "Action" %}
    {{ notif.timestamp }}{{ notif.title }} + + + + + + +
    {{ notif.timestamp }}{{ notif.title }} - - - - - - -
    -
    + {% endfor %} + {% else %}
    {% translate "No notifications." %}
    {% endif %} diff --git a/allianceauth/notifications/templates/notifications/view.html b/allianceauth/notifications/templates/notifications/view.html index 2aede4ee..099faf2a 100644 --- a/allianceauth/notifications/templates/notifications/view.html +++ b/allianceauth/notifications/templates/notifications/view.html @@ -6,7 +6,7 @@ {% block content %}

    {% translate "View Notification" %} -
    +
    diff --git a/allianceauth/optimer/auth_hooks.py b/allianceauth/optimer/auth_hooks.py index 0570db0f..686bd4d4 100644 --- a/allianceauth/optimer/auth_hooks.py +++ b/allianceauth/optimer/auth_hooks.py @@ -1,4 +1,6 @@ -from allianceauth.services.hooks import MenuItemHook, UrlHook +from allianceauth.menu.hooks import MenuItemHook +from allianceauth.optimer.views import dashboard_ops +from allianceauth.services.hooks import UrlHook from django.utils.translation import gettext_lazy as _ from allianceauth import hooks from . import urls @@ -27,3 +29,17 @@ def register_menu(): @hooks.register('url_hook') def register_url(): return UrlHook(urls, 'optimer', r'^optimer/') + + +class NextOpsHook(hooks.DashboardItemHook): + def __init__(self): #TODO add the view permms so if they cant see it is not rendered + hooks.DashboardItemHook.__init__( + self, + dashboard_ops, + 6 + ) + + +@hooks.register('dashboard_hook') +def register_groups_hook(): + return NextOpsHook() diff --git a/allianceauth/optimer/templates/optimer/dashboard.ops.html b/allianceauth/optimer/templates/optimer/dashboard.ops.html new file mode 100644 index 00000000..df988c97 --- /dev/null +++ b/allianceauth/optimer/templates/optimer/dashboard.ops.html @@ -0,0 +1,38 @@ +{% load i18n %} +{% load evelinks %} + +
    +
    +
    +

    {% translate "Upcoming Fleets" %}

    +
    +
    + + + + + + + + + {% for ops in timers %} + + + + + + + {% endfor %} + +
    {% translate "Operation" %}{% translate "Type" %}{% translate "Form Up System" %}{% translate "Start Time" %}
    + {{ ops.operation_name }} + + ({{ ops.type }}) + + {{ ops.system }} + {{ ops.start | date:"Y-m-d H:i" }}
    +
    +
    +
    +
    +
    diff --git a/allianceauth/optimer/templates/optimer/fleetoptable.html b/allianceauth/optimer/templates/optimer/fleetoptable.html index cb5d89e7..438a96f8 100644 --- a/allianceauth/optimer/templates/optimer/fleetoptable.html +++ b/allianceauth/optimer/templates/optimer/fleetoptable.html @@ -16,7 +16,7 @@ {% translate "FC" %} {% if perms.auth.optimer_management %} {# {% translate "Creator" %}#} - {% translate "Action" %} + {% translate "Action" %} {% endif %} @@ -40,7 +40,7 @@ {{ ops.fc }} {% if perms.auth.optimer_management %} {# {{ ops.eve_character }}#} - + diff --git a/allianceauth/optimer/templates/optimer/management.html b/allianceauth/optimer/templates/optimer/management.html index 5f11779d..dc004d01 100644 --- a/allianceauth/optimer/templates/optimer/management.html +++ b/allianceauth/optimer/templates/optimer/management.html @@ -8,7 +8,7 @@ {% block content %}

    {% translate "Fleet Operation Timers" %} -
    +
    {% if perms.auth.optimer_management %} {% translate "Create Operation" %} {% endif %} @@ -16,10 +16,10 @@

    -
    +
    {% translate "Current Eve Time:" %}
    - +
    diff --git a/allianceauth/optimer/views.py b/allianceauth/optimer/views.py index b16549f8..3ebcf863 100644 --- a/allianceauth/optimer/views.py +++ b/allianceauth/optimer/views.py @@ -5,10 +5,11 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import permission_required from django.shortcuts import get_object_or_404 from django.shortcuts import render, redirect +from django.template.loader import render_to_string from django.utils import timezone from django.utils.translation import gettext_lazy as _ -from .form import OpForm +from .form import OpForm from .models import OpTimer, OpTimerType logger = logging.getLogger(__name__) @@ -137,3 +138,15 @@ def edit_optimer(request, optimer_id): } form = OpForm(initial=data, data_list=OpTimerType.objects.all()) return render(request, 'optimer/update.html', context={'form': form}) + + +def dashboard_ops(request): + base_query = OpTimer.objects.select_related('eve_character', 'type') + timers = base_query.filter(start__gte=timezone.now())[:5] + if timers.count(): + context = { + 'timers': timers, + } + return render_to_string('optimer/dashboard.ops.html', context=context, request=request) + else: + return "" diff --git a/allianceauth/permissions_tool/auth_hooks.py b/allianceauth/permissions_tool/auth_hooks.py index bf78f1d2..df6e1aa2 100644 --- a/allianceauth/permissions_tool/auth_hooks.py +++ b/allianceauth/permissions_tool/auth_hooks.py @@ -1,7 +1,8 @@ +from allianceauth.menu.hooks import MenuItemHook from . import urls from allianceauth import hooks -from allianceauth.services.hooks import MenuItemHook, UrlHook +from allianceauth.services.hooks import UrlHook class PermissionsTool(MenuItemHook): diff --git a/allianceauth/permissions_tool/templates/permissions_tool/audit.html b/allianceauth/permissions_tool/templates/permissions_tool/audit.html index 1239d69c..9db22d3d 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/audit.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/audit.html @@ -1,93 +1,95 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} - -{% block page_title %}{{ permission.permission.codename }} - {% translate "Permissions Audit" %}{% endblock page_title %} - +{% block page_title %} + {{ permission.permission.codename }} - {% translate "Permissions Audit" %} +{% endblock page_title %} {% block content %}

    {% translate "Permissions Audit" %}: {{ permission.permission.codename }}

    - - {% translate "Back" %} + + {% translate "Back" %}

    - - - - + + + + - {% for user in permission.users %} - {% include 'permissions_tool/audit_row.html' with type="User" name="Permission granted directlty" %} - {% endfor %} - {% for group in permission.groups %} - {% for user in group.user_set.all %} - {% include 'permissions_tool/audit_row.html' with type="Group" name=group%} + {% for user in permission.users %} + {% include "permissions_tool/audit_row.html" with type="User" name="Permission granted directly" %} {% endfor %} - {% endfor %} - {% for state in permission.states %} - {% for profile in state.userprofile_set.all %} - {% with profile.user as user %} - {% include 'permissions_tool/audit_row.html' with type="State" name=state%} - {% endwith %} + {% for group in permission.groups %} + {% for user in group.user_set.all %} + {% include "permissions_tool/audit_row.html" with type="Group" name=group %} + {% endfor %} + {% endfor %} + {% for state in permission.states %} + {% for profile in state.userprofile_set.all %} + {% with profile.user as user %} + {% include "permissions_tool/audit_row.html" with type="State" name=state %} + {% endwith %} + {% endfor %} {% endfor %} - {% endfor %}
    {% translate "Group" %}{% translate "User / Character" %}{% translate "Organization" %}{% translate "Group" %}{% translate "User / Character" %}{% translate "Organization" %}
    {% endblock content %} - {% block extra_javascript %} - {% include 'bundles/datatables-js.html' %} - {% include 'bundles/filterdropdown-js.html' %} -{% endblock %} - + {% include "bundles/datatables-js-bs5.html" %} + {% include "bundles/filterdropdown-js.html" %} +{% endblock extra_javascript %} {% block extra_css %} - {% include 'bundles/datatables-css.html' %} -{% endblock %} - + {% include "bundles/datatables-css-bs5.html" %} +{% endblock extra_css %} {% block extra_script %} - $(document).ready(function() { + $(document).ready(function () { let groupColumn = 0; $('#tab_permissions_audit').DataTable({ - columnDefs: [ - { "visible": false, "targets": groupColumn } + columnDefs: [{ + "visible": false, + "targets": groupColumn + }], + order: [ + [groupColumn, 'asc'], + [2, 'asc'] ], - order: [[ groupColumn, 'asc' ], [ 2, 'asc' ] ], - filterDropDown: - { - columns: [ - { - idx: 0, - title: 'Source' - } - ], + filterDropDown: { + columns: [{ + idx: 0, + title: 'Source' + }], bootstrap: true }, "stateSave": true, "stateDuration": 0, - drawCallback: function ( settings ) { + drawCallback: function (settings) { let api = this.api(); - let rows = api.rows( {page:'current'} ).nodes(); + let rows = api.rows({ + page: 'current' + }).nodes(); let last = null; - api.column(groupColumn, {page:'current'} ).data().each( function ( group, i ) { - if ( last !== group ) { - $(rows).eq( i ).before( - '' + group + '' + api.column(groupColumn, { + page: 'current' + }).data().each(function (group, i) { + if (last !== group) { + $(rows).eq(i).before( + '' + group + '' ); last = group; } - } ); + }); } - } ); - } ); -{% endblock %} + }); + }); +{% endblock extra_script %} diff --git a/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html b/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html index 55313c24..4dfbef1a 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html @@ -1,25 +1,17 @@ {% load evelinks %} - +{% load i18n %} - - {{ type }}: {{ name }} - - - {{ user.profile.main_character.character_name }} - - - {{ user }}
    - {{ user.profile.main_character.character_name }} - - + {{ type }}: {{ name }} + + {{ user.profile.main_character.character_name }} + {{ user }}
    {{ user.profile.main_character.character_name }} + {% if user.profile.main_character %} - - {{ user.profile.main_character.corporation_name }} -
    + {{ user.profile.main_character.corporation_name }} +
    {{ user.profile.main_character.alliance_name|default_if_none:"" }} {% else %} - (unknown) + {% translate "(unknown)" %} {% endif %} - diff --git a/allianceauth/permissions_tool/templates/permissions_tool/overview.html b/allianceauth/permissions_tool/templates/permissions_tool/overview.html index 229487b0..75f7183e 100644 --- a/allianceauth/permissions_tool/templates/permissions_tool/overview.html +++ b/allianceauth/permissions_tool/templates/permissions_tool/overview.html @@ -1,128 +1,107 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} - -{% block page_title %}{% translate "Permissions Overview" %}{% endblock page_title %} - +{% block page_title %} + {% translate "Permissions Overview" %} +{% endblock page_title %} {% block content %}

    {% translate "Permissions Overview" %}

    - {% if request.GET.all != 'yes' %} - {% blocktranslate %}Showing only applied permissions{% endblocktranslate %} - {% translate "Show All" %} - {% else %} - {% blocktranslate %}Showing all permissions{% endblocktranslate %} - {% translate "Show Applied" %} - {% endif %} + {% if request.GET.all != 'yes' %} + {% translate "Showing only applied permissions" %} + {% translate "Show All" %} + {% else %} + {% translate "Showing all permissions" %} + {% translate "Show Applied" %} + {% endif %}

    - +
    - - - - - - - + + + + + + + - {% for perm in permissions %} - - - - - - - - - - {% endfor %} + {% for perm in permissions %} + + + + + + + + + + {% endfor %}
    - {% translate "App" %} - - {% translate "Model" %} - - {% translate "Code Name" %} - - {% translate "Name" %} - - {% translate "Users" %} - - {% translate "Groups" %} - - {% translate "States" %} - {% translate "App" %}{% translate "Model" %}{% translate "Code Name" %}{% translate "Name" %}{% translate "Users" %}{% translate "Groups" %}{% translate "States" %}
    - {{ perm.permission.content_type.app_label }} - - {{ perm.permission.content_type.model }} - - - {{ perm.permission.codename }} - - - {{ perm.permission.name }} - - {{ perm.users }} - - {{ perm.groups }} ({{ perm.group_users }}) - - {{ perm.states }} ({{ perm.state_users }}) -
    {{ perm.permission.content_type.app_label }}{{ perm.permission.content_type.model }} + + {{ perm.permission.codename }} + + {{ perm.permission.name }}{{ perm.users }}{{ perm.groups }} ({{ perm.group_users }}){{ perm.states }} ({{ perm.state_users }})
    {% endblock content %} - {% block extra_javascript %} - {% include 'bundles/datatables-js.html' %} - {% include 'bundles/filterdropdown-js.html' %} -{% endblock %} - + {% include "bundles/datatables-js-bs5.html" %} + {% include "bundles/filterdropdown-js.html" %} +{% endblock extra_javascript %} {% block extra_css %} - {% include 'bundles/datatables-css.html' %} -{% endblock %} - + {% include "bundles/datatables-css-bs5.html" %} +{% endblock extra_css %} {% block extra_script %} - $(document).ready(function() { - let groupColumn = 0; - - $('#tab_permissions_overview').DataTable({ - columnDefs: [ - { "visible": false, "targets": groupColumn } - ], - order: [[ groupColumn, 'asc' ], [ 1, 'asc' ], [ 2, 'asc' ] ], - filterDropDown: - { - columns: [ - { - idx: 0 - }, - { - idx: 1 - } - ], - bootstrap: true, - }, - "stateSave": true, - "stateDuration": 0, - drawCallback: function ( settings ) { - let api = this.api(); - let rows = api.rows( {page:'current'} ).nodes(); - let last = null; - - api.column(groupColumn, {page:'current'} ).data().each( function ( group, i ) { - if ( last !== group ) { - $(rows).eq( i ).before( - '' + group + '' - ); - - last = group; - } - } ); - } - } ); - } ); -{% endblock %} + $(document).ready(function () { + let groupColumn = 0; + $('#tab_permissions_overview').DataTable({ + columnDefs: [{ + "visible": false, + "targets": groupColumn + }], + order: [ + [groupColumn, 'asc'], + [1, 'asc'], + [2, 'asc'] + ], + filterDropDown: { + columns: [{ + idx: 0 + }, + { + idx: 1 + } + ], + bootstrap: true, + }, + "stateSave": true, + "stateDuration": 0, + drawCallback: function (settings) { + let api = this.api(); + let rows = api.rows({ + page: 'current' + }).nodes(); + let last = null; + api.column(groupColumn, { + page: 'current' + }).data().each(function (group, i) { + if (last !== group) { + $(rows).eq(i).before( + ' + + ' + group + ' + + ' + ); + last = group; + } + }); + } + }); + }); +{% endblock extra_script %} diff --git a/allianceauth/project_template/project_name/settings/base.py b/allianceauth/project_template/project_name/settings/base.py index f777aed4..2506ecfb 100644 --- a/allianceauth/project_template/project_name/settings/base.py +++ b/allianceauth/project_template/project_name/settings/base.py @@ -31,6 +31,11 @@ INSTALLED_APPS = [ 'allianceauth.notifications', 'allianceauth.thirdparty.navhelper', 'allianceauth.analytics', + 'allianceauth.menu', + 'allianceauth.theme', + 'allianceauth.theme.darkly', + 'allianceauth.theme.flatly', + 'allianceauth.theme.materia', ] SECRET_KEY = "wow I'm a really bad default secret key" @@ -188,6 +193,8 @@ DATABASES = { SITE_NAME = 'Alliance Auth' +DEFAULT_THEME = "allianceauth.theme.darkly" + LOGIN_URL = 'auth_login_user' # view that handles login logic LOGIN_REDIRECT_URL = 'authentication:dashboard' # default destination when logging in if no redirect specified diff --git a/allianceauth/project_template/project_name/settings/local.py b/allianceauth/project_template/project_name/settings/local.py index d83fd718..0b86e9ca 100644 --- a/allianceauth/project_template/project_name/settings/local.py +++ b/allianceauth/project_template/project_name/settings/local.py @@ -26,7 +26,7 @@ DEBUG = False # Add any additional apps to this list. INSTALLED_APPS += [ - + #'allianceauth.theme.bootstrap', ] # To change the logging level for extensions, uncomment the following line. diff --git a/allianceauth/services/auth_hooks.py b/allianceauth/services/auth_hooks.py index 29104705..3f032d9a 100644 --- a/allianceauth/services/auth_hooks.py +++ b/allianceauth/services/auth_hooks.py @@ -1,7 +1,7 @@ -from django.utils.translation import gettext_lazy as _ from allianceauth import hooks +from django.utils.translation import gettext_lazy as _ -from .hooks import MenuItemHook +from ..menu.hooks import MenuItemHook from .hooks import ServicesHook diff --git a/allianceauth/services/hooks.py b/allianceauth/services/hooks.py index 862c7339..084d8e49 100644 --- a/allianceauth/services/hooks.py +++ b/allianceauth/services/hooks.py @@ -1,5 +1,5 @@ -from django.urls import include, re_path from string import Formatter +from django.urls import include, re_path from typing import Iterable, Optional from django.conf import settings @@ -9,6 +9,11 @@ from django.urls import include, re_path from django.utils.functional import cached_property from allianceauth.hooks import get_hooks +from allianceauth.menu.hooks import MenuItemHook +from django.conf import settings +from django.urls import include, re_path +from django.core.exceptions import ObjectDoesNotExist +from django.utils.functional import cached_property from .models import NameFormatConfig @@ -136,26 +141,15 @@ class ServicesHook: yield fn() -class MenuItemHook: - def __init__(self, text, classes, url_name, order=None, navactive=list([])): - self.text = text - self.classes = classes - self.url_name = url_name - self.template = 'public/menuitem.html' - self.order = order if order is not None else 9999 +class MenuItemHook(MenuItemHook): + """ + MenuItemHook shim to allianceauth.menu.hooks - # count is an integer shown next to the menu item as badge when count != None - # apps need to set the count in their child class, e.g. in render() method - self.count = None - - navactive = navactive or [] - navactive.append(url_name) - self.navactive = navactive - - def render(self, request): - return render_to_string(self.template, - {'item': self}, - request=request) + :param MenuItemHook: _description_ + :type MenuItemHook: _type_ + """ + def __init_subclass__(cls) -> None: + return super().__init_subclass__() class UrlHook: diff --git a/allianceauth/services/modules/discord/templates/services/discord/discord_service_ctrl.html b/allianceauth/services/modules/discord/templates/services/discord/discord_service_ctrl.html index cfece366..55aae356 100644 --- a/allianceauth/services/modules/discord/templates/services/discord/discord_service_ctrl.html +++ b/allianceauth/services/modules/discord/templates/services/discord/discord_service_ctrl.html @@ -1,37 +1,34 @@ {% load i18n %} - - - - {% translate "Discord" %} - +
    +
    +
    {% translate "Discord" %}
    +

    {% if server_name %}{{ server_name }}{% else %}{% translate "Unlinked Server" %}{% endif %}

    +

    +

    {% if not user_has_account %} - (not activated) + {% translate "(not activated)" %} {% else %} - {{discord_username}} + {{ discord_username }} {% endif %} - - - {{server_name}} - - +

    +
    + +
    diff --git a/allianceauth/services/modules/discourse/templates/services/discourse/discourse_service_ctrl.html b/allianceauth/services/modules/discourse/templates/services/discourse/discourse_service_ctrl.html index 2940f0f3..b4c2ced4 100644 --- a/allianceauth/services/modules/discourse/templates/services/discourse/discourse_service_ctrl.html +++ b/allianceauth/services/modules/discourse/templates/services/discourse/discourse_service_ctrl.html @@ -1,10 +1,20 @@ +{% extends "services/services_ctrl_base.html" %} {% load i18n %} - - Discourse - {{ char.character_name }} - {{ DISCOURSE_URL }} - - - - +{% block title %} + {% translate "Discourse" %} +{% endblock %} + +{% block url %} + {{ DISCOURSE_URL }} +{% endblock %} + +{% block user %} + Username: {{ char.character_name }} +{% endblock %} + +{% block controls %} + + + +{% endblock %} diff --git a/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html b/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html index 11643527..6e8605cc 100644 --- a/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html +++ b/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html @@ -1,28 +1,34 @@ - - {{ service_name }} - {{ username }} +{% load i18n %} +
    +
    +
    {{ service_name }}
    +

    {{ service_url }}

    +

    {% if username != '' %}Active{% else %}Disabled{% endif %}

    +

    Username: {{ username }}

    +
    + +
    diff --git a/allianceauth/services/modules/openfire/auth_hooks.py b/allianceauth/services/modules/openfire/auth_hooks.py index 91a71cd9..6165ce19 100644 --- a/allianceauth/services/modules/openfire/auth_hooks.py +++ b/allianceauth/services/modules/openfire/auth_hooks.py @@ -5,7 +5,8 @@ from django.template.loader import render_to_string from django.utils.translation import gettext_lazy as _ from allianceauth import hooks -from allianceauth.services.hooks import ServicesHook, MenuItemHook +from allianceauth.menu.hooks import MenuItemHook +from allianceauth.services.hooks import ServicesHook from .tasks import OpenfireTasks from .urls import urlpatterns diff --git a/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html index 736788be..3a163867 100644 --- a/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html +++ b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html @@ -1,27 +1,39 @@ +{% extends "services/services_ctrl_base.html" %} {% load i18n %} - - Teamspeak 3 - {{ authinfo.teamspeak3_uid }} - {{ TEAMSPEAK3_PUBLIC_URL }} - - {% if authinfo.teamspeak3_uid == "" %} - - - - {% else %} - - - - - - - - - - - - +{% block title %} + {% translate "Teamspeak 3" %} +{% endblock %} + +{% block url %} + {{ TEAMSPEAK3_PUBLIC_URL }} +{% endblock %} + +{% block active %} + {% if authinfo.teamspeak3_uid != '' %}Active{% else %}Disabled{% endif %} +{% endblock %} + +{% block user %} + {{ authinfo.teamspeak3_uid }} +{% endblock %} + +{% block controls %} + {% if authinfo.teamspeak3_uid == "" %} + + + + {% else %} + + + + + + + + + + + + {% endif %} - - +{% endblock %} diff --git a/allianceauth/services/templates/services/fleetformattertool.html b/allianceauth/services/templates/services/fleetformattertool.html index bcb8e02c..b176fd1f 100644 --- a/allianceauth/services/templates/services/fleetformattertool.html +++ b/allianceauth/services/templates/services/fleetformattertool.html @@ -1,4 +1,4 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load bootstrap %} {% load i18n %} diff --git a/allianceauth/services/templates/services/services.html b/allianceauth/services/templates/services/services.html index 203f5080..c8cdc362 100644 --- a/allianceauth/services/templates/services/services.html +++ b/allianceauth/services/templates/services/services.html @@ -1,29 +1,48 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} {% block page_title %}{% translate "Services Management" %}{% endblock page_title %} {% block extra_css %}{% endblock extra_css %} +{% block header_nav_brand %}{% translate "Available Services" %}{% endblock header_nav_brand %} + + {% block content %} -
    -

    {% translate "Available Services" %}

    -
    - - - - - - - - - - - {% for svc in service_ctrls %} - {{ svc }} - {% endfor %} - -
    {% translate "Service" %}{% translate "Username" %}{% translate "Domain" %}{% translate "Action" %}
    +
    + {% for svc in service_ctrls %} + {{ svc }} + {% endfor %} +
    +
    +

    Legend

    +
    +
    + + + +

    {% translate "Click to activate the service for your user." %}

    +
    +
    + + + +

    {% translate "Click to manually set your password." %}

    + +
    +
    + + + +

    {% translate "Click to randomly generate your password." %}

    +
    +
    + + + +

    {% translate "Click to deactivate the service for your user" %}

    +
    +

    {% translate "Some services provide different options. Hover over the buttons to see more." %}

    {% endblock content %} diff --git a/allianceauth/services/templates/services/services_ctrl.html b/allianceauth/services/templates/services/services_ctrl.html index 8bd84fde..6a841f99 100644 --- a/allianceauth/services/templates/services/services_ctrl.html +++ b/allianceauth/services/templates/services/services_ctrl.html @@ -1,32 +1,44 @@ +{% extends "services/services_ctrl_base.html" %} {% load i18n %} - - {{ service_name }} - {{ username }} - {{ service_url }} - - {% if username == "" %} - {% if urls.auth_activate %} - - - - {% endif %} - {% else %} - {% if urls.auth_set_password %} - - - - {% endif %} - {% if urls.auth_reset_password %} - - - - {% endif %} - {% if urls.auth_deactivate %} - - - - {% endif %} +{% block title %} + {{ service_name }} +{% endblock %} + +{% block url %} + {{ service_url }} +{% endblock %} + +{% block active %} + {% if username != '' %}Active{% else %}Disabled{% endif %} +{% endblock %} + +{% block user %} + Username: {{ username }} +{% endblock %} + +{% block controls %} + {% if username == "" %} + {% if urls.auth_activate %} + + + {% endif %} - - + {% else %} + {% if urls.auth_set_password %} + + + + {% endif %} + {% if urls.auth_reset_password %} + + + + {% endif %} + {% if urls.auth_deactivate %} + + + + {% endif %} + {% endif %} +{% endblock %} diff --git a/allianceauth/services/templates/services/services_ctrl_base.html b/allianceauth/services/templates/services/services_ctrl_base.html new file mode 100644 index 00000000..fa32e37e --- /dev/null +++ b/allianceauth/services/templates/services/services_ctrl_base.html @@ -0,0 +1,15 @@ +{% load i18n %} +
    +
    +
    {% block title %}{% endblock title %}
    +

    {% block url %}{% endblock url %}

    +

    + {% block active %} + Active + {% endblock active %} +

    +

    {% block user %}{% endblock user %}

    + {% block extra %}{% endblock extra %} +
    + +
    diff --git a/allianceauth/srp/auth_hooks.py b/allianceauth/srp/auth_hooks.py index f6a920c8..3a9c4306 100644 --- a/allianceauth/srp/auth_hooks.py +++ b/allianceauth/srp/auth_hooks.py @@ -1,7 +1,8 @@ from django.utils.translation import gettext_lazy as _ from allianceauth import hooks -from allianceauth.services.hooks import MenuItemHook, UrlHook +from allianceauth.menu.hooks import MenuItemHook +from allianceauth.services.hooks import UrlHook from . import urls from .managers import SRPManager diff --git a/allianceauth/srp/templates/srp/data.html b/allianceauth/srp/templates/srp/data.html index 0288306d..8c05b0d1 100644 --- a/allianceauth/srp/templates/srp/data.html +++ b/allianceauth/srp/templates/srp/data.html @@ -1,54 +1,13 @@ -{% extends "allianceauth/base.html" %} +{% extends "allianceauth/base-bs5.html" %} {% load i18n %} {% load humanize %} {% block page_title %}{% translate "Srp Fleet Data" %}{% endblock page_title %} -{% block extra_css %} - {% include 'bundles/datatables-css.html' %} - {% include 'bundles/x-editable.css.html' %} - {% include 'bundles/checkbox-css.html' %} - -{% endblock extra_css %} - {% block content %}

    {% translate "SRP Fleet Data" %} -
    +
    {% if perms.auth.srp_management %} {% if fleet_status == "Completed" %} @@ -67,7 +26,7 @@ {% csrf_token %}