Compare commits

...

9 Commits

Author SHA1 Message Date
T'rahk Rokym
3538428736 Merge branch 'doc-update' into 'master'
Change the installation instructions to match the correct packages

See merge request allianceauth/allianceauth!1759
2025-09-21 02:43:42 +00:00
Ariel Rin
188295daac Merge branch 'optimer-html-fix' into 'master'
[FIX] Optimer table HTML

See merge request allianceauth/allianceauth!1760
2025-09-21 02:43:26 +00:00
Ariel Rin
0447697106 Merge branch 'make-request-available' into 'master'
[CHANGE] Make the `request` object available in theme js/css templates

See merge request allianceauth/allianceauth!1761
2025-09-21 02:43:19 +00:00
Ariel Rin
1608950d43 Merge branch 'user-agent' into 'master'
[CHANGE] User-Agent to our proposed default format

See merge request allianceauth/allianceauth!1762
2025-09-21 02:41:49 +00:00
Ariel Rin
23c283c0bb Merge branch 'mobile-menu-template' into 'master'
[ADD] Mobile menu templates to framework

See merge request allianceauth/allianceauth!1763
2025-09-21 02:41:20 +00:00
Peter Pfeufer
b76fa4282a
[ADD] Mobile menu templates to framework 2025-09-11 12:52:48 +02:00
Peter Pfeufer
d88cb57cf0
[CHANGE] User-Agent to our proposed default format 2025-09-09 11:06:37 +02:00
Peter Pfeufer
787140dd7e
[CHANGE] Make the request object available in theme js/css templates 2025-09-07 09:39:22 +02:00
Peter Pfeufer
77caa5543d
[FIX] Optimer table HTML 2025-09-06 15:47:59 +02:00
16 changed files with 128 additions and 74 deletions

View File

@ -11,7 +11,7 @@
{% endblock header_nav_brand %} {% endblock header_nav_brand %}
{% block header_nav_collapse_left %} {% block header_nav_collapse_left %}
<li class="nav-item dropdown"> <li class="nav-item dropdown mb-2 mb-lg-0">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false"> <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">
{% translate "Corporations" %} {% translate "Corporations" %}
</a> </a>
@ -26,11 +26,7 @@
{% endfor %} {% endfor %}
{% if perms.corputils.add_corpstats %} {% if perms.corputils.add_corpstats %}
{% if available.count >= 1 %} <li class="mt-3">
<li>&nbsp;</li>
{% endif %}
<li>
<a class="dropdown-item" href="{% url 'corputils:add' %}"> <a class="dropdown-item" href="{% url 'corputils:add' %}">
{% translate "Add corporation" %} {% translate "Add corporation" %}
</a> </a>

View File

@ -0,0 +1,13 @@
<li class="nav-item">
<a href="{{ url }}" class="nav-link py-lg-0">
<span class="btn btn-{{ btn_modifier|default:'primary' }} d-none d-lg-inline-block">
{% if fa_icon and icon_on_desktop %}<i class="{{ fa_icon }} me-2"></i>{% endif %}
{{ title }}
</span>
<span class="d-inline-block d-lg-none">
{% if fa_icon and icon_on_mobile %}<i class="{{ fa_icon }} fa-fw me-2"></i>{% endif %}
{{ title }}
</span>
</a>
</li>

View File

@ -0,0 +1,12 @@
<li class="nav-item">
<a href="{{ url }}" class="nav-link">
<span class="d-none d-lg-inline-block" title="{{ title }}">
<i class="{{ fa_icon }}"></i>
</span>
<span class="d-inline-block d-lg-none">
{% if icon_on_mobile %}<i class="{{ fa_icon }} me-2 fa-fw"></i>{% endif %}
{{ title }}
</span>
</a>
</li>

View File

@ -5,10 +5,10 @@
<li class="nav-item" id="menu_item_notifications"> <li class="nav-item" id="menu_item_notifications">
<a class="nav-link {% navactive request 'notifications:' %}" href="{% url 'notifications:list' %}"> <a class="nav-link {% navactive request 'notifications:' %}" href="{% url 'notifications:list' %}">
{% with unread_count=request.user|user_unread_notification_count %} {% with unread_count=request.user|user_unread_notification_count %}
<i class="fa-solid fa-bell{% if unread_count %} text-danger{% endif %}"></i> <i class="fa-solid fa-bell me-2 fa-fw{% if unread_count %} text-danger{% endif %}"></i>
{% endwith %} {% endwith %}
<span class="d-lg-none d-md-inline m-2"> <span class="d-lg-none d-md-inline">
{% translate "Notifications" %} {% translate "Notifications" %}
</span> </span>
</a> </a>

View File

@ -28,17 +28,13 @@
{% endblock %} {% endblock %}
{% block header_nav_collapse_right %} {% block header_nav_collapse_right %}
<li class="nav-item"> {% translate "Mark all notifications as read" as nav_item_title %}
<a href="{% url 'notifications:mark_all_read' %}" class="nav-link" title="{% translate 'Mark all notifications as read' %}"> {% url "notifications:mark_all_read" as nav_item_link %}
<i class="fa-solid fa-check-double"></i> {% include "framework/header/nav-collapse-icon.html" with fa_icon="fa-solid fa-check-double" url=nav_item_link title=nav_item_title icon_on_mobile=True %}
</a>
</li>
<li class="nav-item"> {% translate "Delete all read notifications" as nav_item_title %}
<a href="{% url 'notifications:delete_all_read' %}" class="nav-link" title="{% translate 'Delete all read notifications' %}"> {% url "notifications:mark_all_read" as nav_item_link %}
<i class="fa-solid fa-trash-can"></i> {% include "framework/header/nav-collapse-icon.html" with fa_icon="fa-solid fa-trash-can" url=nav_item_link title=nav_item_title icon_on_mobile=True %}
</a>
</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -22,8 +22,8 @@
</tr> </tr>
</thead> </thead>
{% for ops in timers %} <tbody>
<tbody> {% for ops in timers %}
<tr> <tr>
<td> <td>
{{ ops.operation_name }} {{ ops.operation_name }}
@ -55,8 +55,8 @@
</td> </td>
{% endif %} {% endif %}
</tr> </tr>
</tbody> {% endfor %}
{% endfor %} </tbody>
</table> </table>
</div> </div>
{% endblock content %} {% endblock content %}

View File

@ -13,11 +13,9 @@
{% block header_nav_collapse_right %} {% block header_nav_collapse_right %}
{% if perms.auth.optimer_management %} {% if perms.auth.optimer_management %}
<li class="nav-item"> {% translate "Create Operation" as nav_item_title %}
<a class="btn btn-success" href="{% url 'optimer:add' %}"> {% url "optimer:add" as nav_item_link %}
{% translate "Create Operation" %} {% include "framework/header/nav-collapse-button.html" with btn_modifier="success" url=nav_item_link title=nav_item_title fa_icon="fa-solid fa-plus" icon_on_mobile=True %}
</a>
</li>
{% endif %} {% endif %}
{% endblock header_nav_collapse_right %} {% endblock header_nav_collapse_right %}

View File

@ -16,8 +16,7 @@ from redis import Redis
from allianceauth.utils.cache import get_redis_client from allianceauth.utils.cache import get_redis_client
from allianceauth import __title__ as AUTH_TITLE from allianceauth import __title_useragent__, __url__, __version__
from allianceauth import __url__, __version__
from .. import __title__ from .. import __title__
from ..utils import LoggerAddTag from ..utils import LoggerAddTag
@ -647,7 +646,7 @@ class DiscordClient:
if self.is_rate_limited: if self.is_rate_limited:
self._ensure_rate_limed_not_exhausted(uid) self._ensure_rate_limed_not_exhausted(uid)
headers = { headers = {
'User-Agent': f'{AUTH_TITLE} ({__url__}, {__version__})', 'User-Agent': f'{__title_useragent__}/{__version__} (+{__url__})',
'accept': 'application/json', 'accept': 'application/json',
'X-RateLimit-Precision': 'millisecond', 'X-RateLimit-Precision': 'millisecond',
'authorization': str(authorization) 'authorization': str(authorization)

View File

@ -7,8 +7,7 @@ import requests_mock
from redis import Redis from redis import Redis
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from allianceauth import __title__ as AUTH_TITLE from allianceauth import __title_useragent__, __url__, __version__
from allianceauth import __url__, __version__
from allianceauth.utils.testing import NoSocketsTestCase from allianceauth.utils.testing import NoSocketsTestCase
from ...utils import set_logger_to_file from ...utils import set_logger_to_file
@ -46,7 +45,7 @@ API_BASE_URL = 'https://discord.com/api/'
TEST_RETRY_AFTER = 3000 TEST_RETRY_AFTER = 3000
DEFAULT_REQUEST_HEADERS = { DEFAULT_REQUEST_HEADERS = {
'User-Agent': f'{AUTH_TITLE} ({__url__}, {__version__})', 'User-Agent': f'{__title_useragent__}/{__version__} (+{__url__})',
'accept': 'application/json', 'accept': 'application/json',
'authorization': 'Bot ' + TEST_BOT_TOKEN 'authorization': 'Bot ' + TEST_BOT_TOKEN
} }

View File

@ -4,7 +4,7 @@ import requests
from django.contrib.auth.models import User from django.contrib.auth.models import User
from allianceauth import NAME from allianceauth import __title_useragent__, __url__, __version__
from allianceauth.srp.providers import esi from allianceauth.srp.providers import esi
from .models import SrpUserRequest from .models import SrpUserRequest
@ -24,7 +24,7 @@ class SRPManager:
def get_kill_data(kill_id): def get_kill_data(kill_id):
url = ("https://zkillboard.com/api/killID/%s/" % kill_id) url = ("https://zkillboard.com/api/killID/%s/" % kill_id)
headers = { headers = {
'User-Agent': NAME, 'User-Agent': f'{__title_useragent__}/{__version__} (+{__url__})',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} }
r = requests.get(url, headers=headers) r = requests.get(url, headers=headers)

View File

@ -20,17 +20,15 @@
{% block header_nav_collapse_right %} {% block header_nav_collapse_right %}
{% if perms.auth.srp_management %} {% if perms.auth.srp_management %}
<li class="nav-item"> {% if fleet_status == "Completed" %}
{% if fleet_status == "Completed" %} {% translate "Mark Incomplete" as nav_item_title %}
<a class="btn btn-warning" href="{% url 'srp:mark_uncompleted' fleet_id %}"> {% url "srp:mark_uncompleted" fleet_id as nav_item_link %}
{% translate "Mark Incomplete" %} {% include "framework/header/nav-collapse-button.html" with btn_modifier="warning" url=nav_item_link title=nav_item_title %}
</a> {% else %}
{% else %} {% translate "Mark Completed" as nav_item_title %}
<a class="btn btn-success" href="{% url 'srp:mark_completed' fleet_id %}"> {% url "srp:mark_completed" fleet_id as nav_item_link %}
{% translate "Mark Completed" %} {% include "framework/header/nav-collapse-button.html" with btn_modifier="warning" url=nav_item_link title=nav_item_title %}
</a> {% endif %}
{% endif %}
</li>
{% endif %} {% endif %}
{% endblock header_nav_collapse_right %} {% endblock header_nav_collapse_right %}

View File

@ -22,11 +22,9 @@
{% endblock header_nav_collapse_left %} {% endblock header_nav_collapse_left %}
{% block header_nav_collapse_right %} {% block header_nav_collapse_right %}
{% if perms.srp.add_srpfleetmain or perms.auth.srp_management %} {% if perms.srp.add_srpfleetmain or perms.auth.srp_management %}
<li class="nav-item"> {% translate "Add SRP Fleet" as nav_item_title %}
<a class="btn btn-success" href="{% url 'srp:add' %}"> {% url "srp:add" as nav_item_link %}
{% translate "Add SRP Fleet" %} {% include "framework/header/nav-collapse-button.html" with btn_modifier="success" url=nav_item_link title=nav_item_title fa_icon="fa-solid fa-plus" icon_on_mobile=True %}
</a>
</li>
{% endif %} {% endif %}
{% endblock header_nav_collapse_right %} {% endblock header_nav_collapse_right %}
{% block content %} {% block content %}

View File

@ -1,21 +1,17 @@
{% load i18n %} {% load i18n %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<li class="nav-item"> {% translate "Add Character" as nav_item_title %}
<a href="{% url 'authentication:add_character' %}" class="nav-link" title="{% translate 'Add Character' %}"> {% url "authentication:add_character" as nav_item_link %}
<i class="fa-solid fa-user-plus"></i> {% include "framework/header/nav-collapse-icon.html" with fa_icon="fa-solid fa-user-plus" url=nav_item_link title=nav_item_title icon_on_mobile=True %}
<span class="d-lg-none d-md-inline m-2">{% translate "Add Character" %}</span>
</a> {% translate "Change Main" as nav_item_title %}
</li> {% url "authentication:change_main_character" as nav_item_link %}
<li class="nav-item"> {% include "framework/header/nav-collapse-icon.html" with fa_icon="fa-solid fa-shuffle" url=nav_item_link title=nav_item_title icon_on_mobile=True %}
<a href="{% url 'authentication:change_main_character' %}" class="nav-link" title="{% translate 'Change Main' %}">
<i class="fa-solid fa-shuffle"></i>
<span class="d-lg-none d-md-inline m-2">{% translate "Change Main" %}</span>
</a>
</li>
{% else %} {% else %}
<li class="nav-item"> <li class="nav-item">
<a href="{% url 'authentication:login' %}" class="nav-link" title="{% translate 'Sign In' %}"> <a href="{% url 'authentication:login' %}" class="nav-link" title="{% translate 'Sign In' %}">
<i class="fa-solid fa-right-to-bracket fa-fw "></i> {% translate "Sign In" %} <i class="fa-solid fa-right-to-bracket fa-fw me-2"></i> {% translate "Sign In" %}
</a> </a>
</li> </li>
{% endif %} {% endif %}

View File

@ -37,7 +37,8 @@ def get_theme(request):
def get_theme_context(request): def get_theme_context(request):
return { return {
'theme': get_theme(request) 'theme': get_theme(request),
'request': request
} }

View File

@ -17,11 +17,9 @@
{% block header_nav_collapse_right %} {% block header_nav_collapse_right %}
{% if perms.auth.timer_management %} {% if perms.auth.timer_management %}
<li class="nav-item"> {% translate "Create Structure Timer" as nav_item_title %}
<a class="btn btn-success" href="{% url 'timerboard:add' %}"> {% url "timerboard:add" as nav_item_link %}
{% translate "Create Structure Timer" %} {% include "framework/header/nav-collapse-button.html" with btn_modifier="success" url=nav_item_link title=nav_item_title fa_icon="fa-solid fa-plus" icon_on_mobile=True %}
</a>
</li>
{% endif %} {% endif %}
{% endblock header_nav_collapse_right %} {% endblock header_nav_collapse_right %}

View File

@ -66,3 +66,53 @@ To use it, you can use the following code in your template:
</div> </div>
{% endblock %} {% endblock %}
``` ```
### Top Navigation Buttons
To ensure a unified style for top navigation buttons, we provide a template partial for this.
To use it, you can use the following code in your template:
```django
{% block header_nav_collapse_right %}
{% translate "My Awesome Link" as nav_item_title %}
{% url "my_app:my_function" as nav_item_link %}
{% include "framework/header/nav-collapse-button.html" with btn_modifier="success" url=nav_item_link title=nav_item_title fa_icon="fa-solid fa-plus" icon_on_mobile=True icon_on_desktop=True %}
{% endblock header_nav_collapse_right %}
```
This template takes care of the mobile responsiveness and the styling. In mobile view,
the button will be changed to a text link. The icon will be placed in front of the text
link if `icon_on_mobile` is set to `True`.
#### Button Parameters
- `btn_modifier`: (Optional) The button modifier class, e.g. `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark`, `link`. Default is `primary`.
- `url`: The URL the button should point to.
- `title`: The title of the button.
- `fa_icon`: (Optional) The FontAwesome icon class to use, e.g. `fa-solid fa-plus`.
- `icon_on_mobile`: (Optional) Boolean to indicate if the icon should be shown on mobile devices in front of the text link. Default is `False`.
- `icon_on_desktop`: (Optional) Boolean to indicate if the icon should be shown on desktop devices in front of the button text. Default is `False`.
### Top Navigation FontAwesome Icons
To ensure a unified style for top navigation FontAwesome icons, we provide a template partial for this.
To use it, you can use the following code in your template:
```django
{% block header_nav_collapse_right %}
{% translate "My Awesome Link as FontAwesome Icon" as nav_item_title %}
{% url "my_app:my_function" as nav_item_link %}
{% include "framework/header/nav-collapse-icon.html" with fa_icon="fa-solid fa-check-double" url=nav_item_link title=nav_item_title icon_on_mobile=True %}
{% endblock header_nav_collapse_right %}
```
This template takes care of the mobile responsiveness and the styling. In mobile view,
the icon will be changed to a text link. The icon will be placed in front of the text
link if `icon_on_mobile` is set to `True`.
#### Icon Parameters
- `fa_icon`: The FontAwesome icon class to use, e.g. `fa-solid fa-check-double`.
- `url`: The URL the icon should point to.
- `title`: The title of the icon (used as tooltip).
- `icon_on_mobile`: (Optional) Boolean to indicate if the icon should be shown on mobile devices in front of the text link. Default is `False`.