[CHANGE] Switch to django_bootstrap5 forms

This commit is contained in:
Peter Pfeufer 2023-12-09 18:13:51 +01:00
parent 5f51ad4a6a
commit 2440e5d2b2
No known key found for this signature in database
GPG Key ID: 6051D2C6AD4EBC27
4 changed files with 103 additions and 91 deletions

View File

@ -17,39 +17,39 @@
<th class="text-center">{% translate "Eve Time" %}</th> <th class="text-center">{% translate "Eve Time" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for timer in timers %} {% for timer in timers %}
<tr> <tr>
<td class="text-center"> <td class="text-center">
{{ timer.details }} {{ timer.details }}
</td> </td>
<td class="text-center"> <td class="text-center">
{{ timer.get_timer_type_display }} {{ timer.get_timer_type_display }}
</td> </td>
<td class="text-center" nowrap> <td class="text-center" nowrap>
{% if timer.objective == "Hostile" %} {% if timer.objective == "Hostile" %}
<div class="badge bg-danger"> <div class="badge bg-danger">
{% translate "Hostile" %} {% translate "Hostile" %}
</div> </div>
{% endif %} {% endif %}
{% if timer.objective == "Friendly" %} {% if timer.objective == "Friendly" %}
<div class="badge bg-primary"> <div class="badge bg-primary">
{% translate "Friendly" %} {% translate "Friendly" %}
</div> </div>
{% endif %} {% endif %}
{% if timer.objective == "Neutral" %} {% if timer.objective == "Neutral" %}
<div class="badge bg-default"> <div class="badge bg-default">
{% translate "Neutral" %} {% translate "Neutral" %}
</div> </div>
{% endif %} {% endif %}
</td> </td>
<td class="text-center"><a href="{{ timer.system|dotlan_solar_system_url }}"> <td class="text-center"><a href="{{ timer.system|dotlan_solar_system_url }}">
{{ timer.system }} {{ timer.planet_moon }} {{ timer.system }} {{ timer.planet_moon }}
</a> </a>
</td> </td>
<td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td> <td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td>
</tr>
</tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>

View File

@ -1,29 +1,46 @@
{% extends "allianceauth/base-bs5.html" %} {% extends "allianceauth/base-bs5.html" %}
{% load bootstrap %}
{% load django_bootstrap5 %}
{% load i18n %} {% load i18n %}
{% block page_title %} {% block page_title %}
{% endblock page_title %} {% endblock page_title %}
{% block header_nav_brand %}
{% translate "Structure Timers" %}
{% endblock header_nav_brand %}
{% block content %} {% block content %}
<div class="col-lg-12"> <div>
<h1 class="page-header text-center"> <h1 class="page-header text-center mb-3">
{% block page_header %} {% block page_header %}
{% endblock page_header %} {% endblock page_header %}
{% include "timerboard/index_button.html" %} {% include "timerboard/index_button.html" %}
</h1> </h1>
<div class="container-fluid">
<div class="col-md-4 col-md-offset-4"> <div class="card card-primary border-0">
<div class="row"> <div class="card-header">
<form id="add-timer-form" class="form-signin" role="form" action="" method="POST"> <div class="card-title mb-0">
{% csrf_token %} {% translate "Structure Timer Details" %}
{{ form|bootstrap }} </div>
<br> </div>
<button class="btn btn-lg btn-primary btn-block" type="submit">
{% block submit_button_text %} <div class="card-body">
{% endblock submit_button_text %} <div class="row justify-content-center">
</button> <div class="col-md-6">
</form> <form class="form-signin" role="form" action="" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<div class="form-group mt-3 clearfix">
<button class="btn btn-primary" type="submit">
{% block submit_button_text %}
{% endblock submit_button_text %}
</button>
</div>
</form>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -32,19 +49,16 @@
{% endblock content %} {% endblock content %}
{% block extra_javascript %} {% block extra_javascript %}
{% include 'bundles/jquery-datetimepicker-js.html' %} {% include 'bundles/jquery-datetimepicker-js.html' %}
{% endblock %}
{% block extra_script %} <script>
$('#id_start').datetimepicker({ $(document).ready(() => {
setlocale: '{{ LANGUAGE_CODE }}', $('#id_start').datetimepicker({
{% if NIGHT_MODE %} setlocale: '{{ LANGUAGE_CODE }}',
theme: 'dark', mask: true,
{% else %} format: 'Y-m-d H:i',
theme: 'default', minDate: 0
{% endif %} });
mask: true, });
format: 'Y-m-d H:i', </script>
minDate: 0 {% endblock %}
});
{% endblock extra_script %}

View File

@ -14,17 +14,18 @@
{% endblock %} {% endblock %}
{% block extra_javascript %} {% block extra_javascript %}
{% include 'bundles/timerboard-js.html' %} {% include 'bundles/timerboard-js.html' %}
{% include 'bundles/jquery-datetimepicker-js.html' %} {% include 'bundles/jquery-datetimepicker-js.html' %}
{% include 'bundles/jquery-datetimepicker-css.html' %} {% include 'bundles/jquery-datetimepicker-css.html' %}
{% endblock %}
{% block extra_script %} <script>
$('input#id_absolute_time').datetimepicker({ $(document).ready(() => {
setlocale: '{{ LANGUAGE_CODE }}', $('input#id_absolute_time').datetimepicker({
theme: {% if NIGHT_MODE %}'dark'{% else %}'default'{% endif %}, setlocale: '{{ LANGUAGE_CODE }}',
format: 'Y-m-d H:i', format: 'Y-m-d H:i',
minDate: 0, minDate: 0,
defaultDate: null defaultDate: null
}); });
{% endblock extra_script %} });
</script>
{% endblock %}

View File

@ -14,21 +14,18 @@
{% endblock %} {% endblock %}
{% block extra_javascript %} {% block extra_javascript %}
{% include 'bundles/timerboard-js.html' %} {% include 'bundles/timerboard-js.html' %}
{% include 'bundles/jquery-datetimepicker-js.html' %} {% include 'bundles/jquery-datetimepicker-js.html' %}
{% include 'bundles/jquery-datetimepicker-css.html' %} {% include 'bundles/jquery-datetimepicker-css.html' %}
{% endblock %}
{% block extra_script %} <script>
$('input#id_absolute_time').datetimepicker({ $(document).ready(() => {
setlocale: '{{ LANGUAGE_CODE }}', $('input#id_absolute_time').datetimepicker({
{% if NIGHT_MODE %} setlocale: '{{ LANGUAGE_CODE }}',
theme: 'dark', mask: true,
{% else %} format: 'Y-m-d H:i',
theme: 'default', defaultDate: null
{% endif %} });
mask: true, });
format: 'Y-m-d H:i', </script>
defaultDate: null {% endblock %}
});
{% endblock extra_script %}