BS5 Theme

This commit is contained in:
Aaron Kable
2023-10-07 08:20:22 +00:00
committed by Ariel Rin
parent 567d97f38a
commit 2e78aa5f26
161 changed files with 3198 additions and 1655 deletions

View File

@@ -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()

View File

@@ -0,0 +1,38 @@
{% load i18n %}
{% load evelinks %}
<div class="col-12 col-xl-6 align-self-stretch p-2">
<div class="card h-100">
<div class="card-body">
<h4 class="card-title text-center">{% translate "Upcoming Fleets" %}</h4>
<div class="card-body">
<div style="height: 300px;overflow:-moz-scrollbars-vertical;overflow-y:auto;">
<table class="table" style="--bs-table-bg: transparent;">
<thead>
<th class="text-center">{% translate "Operation" %}</th>
<th class="text-center">{% translate "Type" %}</th>
<th class="text-center">{% translate "Form Up System" %}</th>
<th class="text-center">{% translate "Start Time" %}</th>
</thead>
<tbody>
{% for ops in timers %}
<tr>
<td class="text-center">
{{ ops.operation_name }}
</td>
<td class="text-center">
({{ ops.type }})
</td>
<td class="text-center">
<a href="{{ ops.system|dotlan_solar_system_url }}">{{ ops.system }}</a>
</td>
<td class="text-center" nowrap>{{ ops.start | date:"Y-m-d H:i" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@@ -16,7 +16,7 @@
<th>{% translate "FC" %}</th>
{% if perms.auth.optimer_management %}
{# <th>{% translate "Creator" %}</th>#}
<th class="text-right" style="width: 150px;">{% translate "Action" %}</th>
<th class="text-end" style="width: 150px;">{% translate "Action" %}</th>
{% endif %}
</tr>
</thead>
@@ -40,7 +40,7 @@
<td>{{ ops.fc }}</td>
{% if perms.auth.optimer_management %}
{# <td>{{ ops.eve_character }}</td>#}
<td class="text-right">
<td class="text-end">
<a href="{% url 'optimer:remove' ops.id %}" class="btn btn-danger">
<span class="glyphicon glyphicon-remove"></span>
</a>

View File

@@ -8,7 +8,7 @@
{% block content %}
<div class="col-lg-12">
<h1 class="page-header text-center">{% translate "Fleet Operation Timers" %}
<div class="text-right">
<div class="text-end">
{% if perms.auth.optimer_management %}
<a href="{% url 'optimer:add' %}" class="btn btn-success">{% translate "Create Operation" %}</a>
{% endif %}
@@ -16,10 +16,10 @@
</h1>
<div class="col-lg-12 text-center row">
<div class="label label-info text-left">
<div class="badge badge-info text-start">
<b>{% translate "Current Eve Time:" %} </b>
</div>
<strong class="label label-info text-left" id="current-time"></strong>
<strong class="badge badge-info text-start" id="current-time"></strong>
<br>
</div>

View File

@@ -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 ""