refactor: remove dependencies on Bootstrap and jQuery

This commit is contained in:
Luca 2024-11-02 19:21:47 +01:00
parent 6823e11ff0
commit 1c8047a006
4 changed files with 61 additions and 64 deletions

View File

@ -1,11 +1,14 @@
document.addEventListener("DOMContentLoaded", function() { onReady(() => {
const updateRequireAllVisibility = () => { const updateRequireAllVisibility = () => {
if (document.querySelector("#id_tags").value) { if (document.querySelector("#id_tags").value) {
document.querySelector("#requireAll").classList.remove("d-none") document.querySelector("#requireAll").classList.remove("d-none")
} else { } else {
document.querySelector("#requireAll").classList.add("d-none") document.querySelector("#requireAll").classList.add("d-none")
}
} }
}
$("#id_tags").on("change", updateRequireAllVisibility) document
updateRequireAllVisibility() .querySelector("#id_tags")
.addEventListener("change", updateRequireAllVisibility)
updateRequireAllVisibility()
}) })

View File

@ -1,22 +1,8 @@
{% extends "orga/base.html" %} {% extends "orga/base.html" %}
{% load bootstrap4 %}
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<h2>{% blocktranslate with title=submission.title %}Assignee for {{ quotation_open }}{{ title }}{{ quotation_close }}{% endblocktranslate %}</h2> <h2>{% blocktranslate with title=submission.title %}Assignee for {{ quotation_open }}{{ title }}{{ quotation_close }}{% endblocktranslate %}</h2>
<form method="post"> {% include "orga/includes/base_form.html" %}
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_field form.user layout='event' %}
<div class="submit-group panel">
<span></span>
<span>
<button type="submit" class="btn btn-success btn-lg">
<i class="fa fa-check"></i>
{% translate "Save" %}
</button>
</span>
</div>
</form>
{% endblock %} {% endblock %}

View File

@ -1,17 +1,37 @@
{% extends "orga/base.html" %} {% extends "orga/base.html" %}
{% load bootstrap4 %}
{% load compress %} {% load compress %}
{% load i18n %} {% load i18n %}
{% load rules %} {% load rules %}
{% load static %} {% load static %}
{% load url_replace %}
{% block scripts %} {% block scripts %}
{% compress js %} {% compress js %}
<script src="{% static "orga/js/submission_filter.js" %}"></script> <script defer src="{% static "orga/js/submission_filter.js" %}"></script>
{% endcompress %} {% endcompress %}
{% compress js %} {% compress js %}
<script src="{% static "pretalx_musicrate/submission_filter.js" %}"></script> <script defer src="{% static "pretalx_musicrate/submission_filter.js" %}"></script>
{% endcompress %}
{% endblock %}
{% block stylesheets %}
{% compress css %}
<style>
.search-form {
#requireAll .form-group {
margin-bottom: 0;
}
#requireAll label {
display: inline-block;
color: #6c757d;
}
}
#requireAll .form-group-inline {
flex-direction: row;
align-items: center;
}
</style>
{% endcompress %} {% endcompress %}
{% endblock %} {% endblock %}
@ -29,20 +49,26 @@
<div class="submit-group search-submit-group"> <div class="submit-group search-submit-group">
<form class="search-form"> <form class="search-form">
{% bootstrap_field filter_form.q %} {{ filter_form.q.as_field_group }}
{% if show_submission_types and filter_form.submission_type %}{% bootstrap_field filter_form.submission_type %}{% endif %} {% if show_submission_types and filter_form.submission_type %}{{ filter_form.submission_type.as_field_group }}{% endif %}
<div class="d-flex flex-column form-group"> <div class="d-flex flex-column form-group">
{% bootstrap_field filter_form.state layout='inline' %} {{ filter_form.state.as_field_group }}
<div id="pending" class="d-none">{% bootstrap_field filter_form.pending_state__isnull layout='inline' %}</div> <div id="pending" class="ml-1 d-none">{{ filter_form.pending_state__isnull.as_field_group }}</div>
</div> </div>
{% if filter_form.track %}{% bootstrap_field filter_form.track %}{% endif %} {% if filter_form.track %}{{ filter_form.track.as_field_group }}{% endif %}
{% if filter_form.tags %} {% if filter_form.tags %}
<div class="d-flex flex-column form-group"> <div class="d-flex flex-column form-group">
{% bootstrap_field filter_form.tags layout='inline' %} {{ filter_form.tags.as_field_group }}
<div id="requireAll" class="d-none">{% bootstrap_field filter_form.require_all_tags layout='inline' %}</div> <div id="requireAll" class="ml-1 d-none">{{ filter_form.require_all_tags.as_field_group }}</div>
</div> </div>
{% endif %} {% endif %}
{% if filter_form.content_locale %}{% bootstrap_field filter_form.content_locale %}{% endif %} {% if filter_form.content_locale %}{{ filter_form.content_locale.as_field_group }}{% endif %}
{# These fields are hidden, but included to keep question search intact #}
{% if request.GET.question %} <input type="hidden" name="question" value="{{ request.GET.question }}"> {% endif %}
{% if request.GET.answer__options %} <input type="hidden" name="answer__options" value="{{ request.GET.answer__options }}"> {% endif %}
{% if request.GET.answer %} <input type="hidden" name="answer" value="{{ request.GET.answer }}"> {% endif %}
{% if request.GET.unanswered %} <input type="hidden" name="unanswered" value="{{ request.GET.unanswered }}"> {% endif %}
<button class="btn btn-success" type="submit">{% translate "Search" %}</button> <button class="btn btn-success" type="submit">{% translate "Search" %}</button>
</form> </form>
{% if filter_form.is_valid and filter_form.cleaned_data.question %} {% if filter_form.is_valid and filter_form.cleaned_data.question %}
@ -51,7 +77,7 @@
{% blocktranslate trimmed with question=filter_form.cleaned_data.question.question %} {% blocktranslate trimmed with question=filter_form.cleaned_data.question.question %}
List filtered by answers to question "{{ question }}". List filtered by answers to question "{{ question }}".
{% endblocktranslate %} {% endblocktranslate %}
<a href="?{% url_replace request 'question' '' 'answer' '' 'answer__options' '' %}" class="text-muted"> <a href="{% querystring question="" answer="" answer__options="" %}" class="text-muted">
<span class="fa fa-times"></span> <span class="fa fa-times"></span>
{% translate "Remove filter" %} {% translate "Remove filter" %}
</a> </a>
@ -65,13 +91,13 @@
<tr> <tr>
<th> <th>
{% translate "Rating" %} {% translate "Rating" %}
<a href="?{% url_replace request 'sort' 'score__value' %}"><i class="fa fa-caret-down" title="{% translate "Sort by rating (0-10)" %}"></i></a> <a href="{% querystring sort="score__value" %}"><i class="fa fa-caret-down" title="{% translate "Sort by rating (0-10)" %}"></i></a>
<a href="?{% url_replace request 'sort' '-score__value' %}"><i class="fa fa-caret-up" title="{% translate "Sort by rating (10-0)" %}"></i></a> <a href="{% querystring sort="-score__value" %}"><i class="fa fa-caret-up" title="{% translate "Sort by rating (10-0)" %}"></i></a>
</th> </th>
<th> <th>
{% translate "Title" %} {% translate "Title" %}
<a href="?{% url_replace request 'sort' 'title' %}"><i class="fa fa-caret-down" title="{% translate "Sort by title (a-z)" %}"></i></a> <a href="?{% querystring sort="title" %}"><i class="fa fa-caret-down" title="{% translate "Sort by title (a-z)" %}"></i></a>
<a href="?{% url_replace request 'sort' '-title' %}"><i class="fa fa-caret-up" title="{% translate "Sort by title (z-a)" %}"></i></a> <a href="?{% querystring sort="-title" %}"><i class="fa fa-caret-up" title="{% translate "Sort by title (z-a)" %}"></i></a>
</th> </th>
{% if show_submission_types %} {% if show_submission_types %}
<th> <th>
@ -80,13 +106,13 @@
{% endif %} {% endif %}
<th> <th>
{% translate "State" %} {% translate "State" %}
<a href="?{% url_replace request 'sort' 'state' %}"><i class="fa fa-caret-down" title="{% translate "Sort by state (a-z)" %}"></i></a> <a href="?{% querystring sort="state" %}"><i class="fa fa-caret-down" title="{% translate "Sort by state (a-z)" %}"></i></a>
<a href="?{% url_replace request 'sort' '-state' %}"><i class="fa fa-caret-up" title="{% translate "Sort by state (z-a)" %}"></i></a> <a href="?{% querystring sort="-state" %}"><i class="fa fa-caret-up" title="{% translate "Sort by state (z-a)" %}"></i></a>
</th> </th>
<th> <th>
{% translate "Assignee" %} {% translate "Assignee" %}
<a href="?{% url_replace request 'sort' 'assignee' %}"><i class="fa fa-caret-down" title="{% translate "Sort by assignee (a-z)" %}"></i></a> <a href="?{% querystring sort="assignee" %}"><i class="fa fa-caret-down" title="{% translate "Sort by assignee (a-z)" %}"></i></a>
<a href="?{% url_replace request 'sort' '-assignee' %}"><i class="fa fa-caret-up" title="{% translate "Sort by assignee (z-a)" %}"></i></a> <a href="?{% querystring sort="-assignee" %}"><i class="fa fa-caret-up" title="{% translate "Sort by assignee (z-a)" %}"></i></a>
</th> </th>
{% if can_change_submission %} {% if can_change_submission %}
<th></th> <th></th>

View File

@ -1,29 +1,11 @@
{% extends "orga/base.html" %} {% extends "orga/base.html" %}
{% load bootstrap4 %}
{% load compress %} {% load compress %}
{% load i18n %} {% load i18n %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<h2>{% translate "pretalx-musicrate settings" %}</h2> <h2>{% translate "pretalx-musicrate settings" %}</h2>
<form method="post"> {% include "orga/includes/base_form.html" %}
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_field form.submission_types layout='event' %}
{% bootstrap_field form.genre_question layout='event' %}
{% bootstrap_field form.origin_question layout='event' %}
{% bootstrap_field form.link_questions layout='event' %}
{% bootstrap_field form.advance_threshold layout='event' %}
<div class="submit-group panel">
<span></span>
<span>
<button type="submit" class="btn btn-success btn-lg">
<i class="fa fa-check"></i>
{% translate "Save" %}
</button>
</span>
</div>
</form>
<hr> <hr>
<a class="btn btn-success btn-lg btn-block" href="{% url "plugins:pretalx_musicrate:export" event=request.event.slug %}"> <a class="btn btn-success btn-lg btn-block" href="{% url "plugins:pretalx_musicrate:export" event=request.event.slug %}">
<i class="fa fa-download"></i> <i class="fa fa-download"></i>