Fix most of html templates
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ from kaehmy.models import PresetRole, CustomRole, Application, Comment, KaehmyBa
|
||||
|
||||
|
||||
class CheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
|
||||
option_template_name = "checkbox_option.html"
|
||||
option_template_name = "kaehmy/checkbox_option.html"
|
||||
|
||||
def create_option(
|
||||
self, name, value, label, selected, index, subindex=None, attrs=None
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
{% extends "project.html" %}
|
||||
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="{% static "kaehmy/css/base.css" %}">
|
||||
<link rel="stylesheet" href="{% static "kaehmy/css/header.css" %}">
|
||||
<link rel="stylesheet" href="{% static "kaehmy/css/nav.css" %}">
|
||||
<link rel="stylesheet" href="{% static "kaehmy/css/footer.css" %}">
|
||||
{% endblock styles %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
{% block header %}
|
||||
<div class="kaehmy_header">
|
||||
{% include "kaehmy:header.html" %}
|
||||
</div>
|
||||
{% endblock header %}
|
||||
|
||||
{% block navigation %}
|
||||
{% include "kaehmy:navigation.html" %}
|
||||
{% endblock %}
|
||||
|
||||
<div class="kaehmy-content">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="footer">
|
||||
{% block footer %}
|
||||
{% include "kaehmy:footer.html" %}
|
||||
{% endblock footer %}
|
||||
</div>
|
||||
|
||||
{% endblock body %}
|
||||
@@ -1,4 +0,0 @@
|
||||
<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>
|
||||
{% include "django/forms/widgets/input.html" %}
|
||||
{{ widget.label }}</label>
|
||||
<span class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="{{ widget.description }}"></span>
|
||||
@@ -1,18 +0,0 @@
|
||||
{% extends "kaehmy:base.html" %}
|
||||
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<div>
|
||||
<h3>{% trans "Error" %}</h3>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-danger">
|
||||
{{ error|safe }}
|
||||
</div>
|
||||
<div>
|
||||
<button onclick="window.history.back();" class="btn btn-primary">{% trans "Back" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -1,26 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<div>
|
||||
<div>
|
||||
<h2 style="padding-top: 1rem">{% trans "All applications" %}</h2>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>{% trans "Board applications" %}</h4>
|
||||
{{ board_table|safe }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>{% trans "Non-board applications" %}</h4>
|
||||
{{ non_board_table|safe }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="/kaehmy" class="btn btn-primary">{% trans "Front page" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -1,23 +0,0 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
<footer style="text-align: center">
|
||||
<div>
|
||||
<form class="lang-form form" action="{% url 'set_language' %}" method="post">{% csrf_token %}
|
||||
<span>
|
||||
<input name="next" type="hidden" value="{{ redirect_to }}" />
|
||||
<select onchange="this.form.submit()" class="lang-select form-control" name="language">
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
{% get_available_languages as LANGUAGES %}
|
||||
{% get_language_info_list for LANGUAGES as languages %}
|
||||
{% for language in languages %}
|
||||
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
|
||||
{{ language.name_local }} ({{ language.code }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
</form>
|
||||
<span>{% trans "Copyright Aalto-yliopiston Sähköinsinöörikilta ry" %} {% now 'Y' %}</span>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -1,7 +0,0 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="kaehmy_header-content">
|
||||
<div class="kaehmy-banner logo">
|
||||
<a href="/kaehmy"><img class="kaehmy-banner-image" src="/static/kaehmy/img/kaehmy_banner.png" alt="Aalto-yliopiston Sähköinsinöörikilta ry"></a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,89 +0,0 @@
|
||||
{% extends "kaehmy:base.html" %}
|
||||
|
||||
{% load bootstrap3 %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block navigation %}
|
||||
{% include "kaehmy:navigation.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div>
|
||||
<h2 style="padding-top: 1rem">{% trans "Kaehmylomake" %}</h2>
|
||||
|
||||
<div id="input_form">
|
||||
<p>
|
||||
{% blocktrans %}Kaehmykoneella voit ilmaista kiinnostuksesi toimia killassa ensi vuonna.
|
||||
Listassa on vastuualueittain sekä hallitus- että toimihenkilövirkoja.
|
||||
Koska lista ei ole koskaan täydellinen, voit myös ehdottaa ihan uutta toimenkuvaa.
|
||||
Jos sinulla on kysyttävää mistä tahansa virasta, kannattaa konsultoida <a href="https://static.sahkoinsinoorikilta.fi/uus_webi/kahmyopas.pdf">kaehmyopasta</a>
|
||||
tai olla yhteydessä kyseistä virkaa tänä vuonna toimittavaan henkilöön.{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans %}(HUOM! Kaehmytekstin maksimipituus on 300 merkkiä. Tarvittaessa voit kirjoittaa lisätietoja kommenteihin.){% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans %}Muista, että kaehmyn lähettäminen on kiinnostuksen ilmaus
|
||||
eikä siis missään nimessä sitova ilmoittautumien mihinkään tehtävään!{% endblocktrans %}
|
||||
</p>
|
||||
<h5>{% trans "Päivämääriä & deadlineja" %}</h5>
|
||||
<ul>
|
||||
<li><strong>25.10.</strong> {% blocktrans %}Vaalikokous, osa 1 (puheenjohtajan valinta) ja hallitustyrkkypaneeli{% endblocktrans %}</li>
|
||||
<li><strong>01.11.</strong> {% blocktrans %}Vaalikokous, osa 2 (hallituksen valinta){% endblocktrans %}</li>
|
||||
<li><strong>09.11.</strong> {% blocktrans %}Toimikunta-appro{% endblocktrans %}</li>
|
||||
<li><strong>17.11.</strong> {% blocktrans %}Vaalikokous, osa 3 (toimarien valinta){% endblocktrans %}</li>
|
||||
</ul>
|
||||
<form name="kaehmyForm" action="/kaehmy/submit/" method="post" class="form">{% csrf_token %}
|
||||
{% bootstrap_field form.name %}
|
||||
{% bootstrap_field form.email %}
|
||||
{% bootstrap_field form.phone_number %}
|
||||
{% bootstrap_field form.year %}
|
||||
|
||||
<h4>{% trans "Preset roles" %}</h4>
|
||||
{% for preset_field in form %}
|
||||
{% if "preset_roles_" in preset_field.name %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{{ preset_field.label }}
|
||||
</div>
|
||||
<div class="card-block">
|
||||
{% bootstrap_field preset_field show_label=False %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% for custom_field in form %}
|
||||
{% if custom_field.name == 'custom_roles' %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{{ custom_field.label }}
|
||||
</div>
|
||||
<div class="card-block">
|
||||
{% bootstrap_field custom_field show_label=False %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
{% bootstrap_field form.custom_role_name %}
|
||||
{% bootstrap_field form.custom_role_is_board %}
|
||||
</div>
|
||||
</div>
|
||||
{% bootstrap_field form.text %}
|
||||
|
||||
<input type="checkbox" required name="gdpr" value="1">
|
||||
<span>{% blocktrans %}
|
||||
Hyväksyn <a href="https://static.sahkoinsinoorikilta.fi/GDPR/Tietosuojaseloste%20%23U2013%20Toimihenkil%23U00f6ksi%20hakemisen%20rekisteri.pdf" target="_blank">tietosuojaselosteen</a> ja tietojeni tallentamisen.
|
||||
{% endblocktrans %}
|
||||
</span>
|
||||
{% buttons %}
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{% trans "Submit" %}
|
||||
</button>
|
||||
{% endbuttons %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -1,108 +0,0 @@
|
||||
{% extends "kaehmy:base.html" %}
|
||||
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block navigation %}
|
||||
{% include "kaehmy:navigation.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<script>
|
||||
function commentOn(id, op) {
|
||||
setTimeout(function() {
|
||||
document.getElementById("commentNameField").focus();
|
||||
}, 50);
|
||||
|
||||
document.getElementById("collapse_add_comment").scrollIntoView();
|
||||
document.getElementById("commentOP").innerHTML = op;
|
||||
document.getElementById("commentId").value = id;
|
||||
}
|
||||
</script>
|
||||
<div>
|
||||
<div>
|
||||
<h2 style="padding-top: 1rem">{% trans "All kaehmys" %}</h2>
|
||||
</div>
|
||||
|
||||
<div class="collapse" id="collapse_add_comment">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<form method="POST" action="/kaehmy/add_comment" class="form">{% csrf_token %}
|
||||
<div class="form-group">
|
||||
{% trans "Commenting on post by " %} <span id="commentOP"></span>
|
||||
<input type="hidden" name="parent" id="commentId">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{% trans "Name" %}</label>
|
||||
<input id="commentNameField" name="name" type="text" class="form-control" placeholder="Teemu Teekkari">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{% trans "Email" %}</label>
|
||||
<input name="email" type="email" class="form-control" placeholder="teemu@teekka.ri">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{% trans "Comment" %}</label>
|
||||
<textarea name="message" class="form-control" rows=3 placeholder="Hei!"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" class="btn btn-primary" value={% trans "Send" %}>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<form class="role-filter-form form-inline" method="GET">
|
||||
<label><strong>{% trans "Filter kaehmys" %}:</strong></label>
|
||||
<select onchange="this.form.submit()" name="role" class="form-control">
|
||||
<option value="-1">{% trans "All kaehmys" %}</option>
|
||||
{% for option in filter_options %}
|
||||
<option value={{ option.0 }} {% if request.GET.role|slugify == option.0|slugify %} selected="selected"{% endif %}>
|
||||
{{ option.1 }} ({{ option.2 }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h6 style="padding-bottom: 1rem">{% trans "Total kaehmys:" %} {{ application_count }}</h6>
|
||||
</div>
|
||||
|
||||
|
||||
{% for application in applications %}
|
||||
<div class="card">
|
||||
<h4 class="card-header">{{ application.name }}</h4>
|
||||
<div class="card-block">
|
||||
{% if application.board_roles|length > 0 %}
|
||||
<h5 style="padding-bottom: 1rem" class="card-subtitle mb-2 text-muted">{{ application.board_roles }}</h5>
|
||||
{% endif %}
|
||||
{% if application.official_roles|length > 0 %}
|
||||
<h5 style="padding-bottom: 1rem" class="card-subtitle mb-2 text-muted">{{ application.official_roles }}</h5>
|
||||
{% endif %}
|
||||
<p class="card-text">{{ application.text|linebreaks|urlize }}</p>
|
||||
|
||||
{% if application.comment_count > 0 %}
|
||||
<a class="comment-button text-primary" data-toggle="collapse" data-target="#collapse_{{ application.id }}" aria-expanded="false" aria-controls="collapse_{{ application.id }}">
|
||||
{% trans "Show comments" %} ({{ application.comment_count }})
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<a onclick="commentOn({{ application.id }}, '{{ application.name }}')" class="comment-button text-primary" data-toggle="collapse" data-target="#collapse_add_comment" aria-expanded="false" aria-controls="collapse_add_comment">
|
||||
{% trans "Add comment" %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="collapse" id="collapse_{{ application.id }}">
|
||||
{% for message in application.messages.all %}
|
||||
{% include "kaehmy:message.html" with messages=message.messages.all %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -1,21 +0,0 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="card" style="margin-top: 0.5rem; margin-bottom: 0">
|
||||
<div class="card-block">
|
||||
<h4>{{ message.name }}</h4>
|
||||
<p>{{ message.message|linebreaks|urlize }}</p>
|
||||
|
||||
<h6 class="card-subtitle mb-2 text-muted">{{ message.timestamp }}</h6>
|
||||
<div>
|
||||
<a class="comment-button text-primary" onclick="commentOn({{ message.id }}, '{{ message.name }}')" data-toggle="collapse" data-target="#collapse_add_comment" aria-expanded="false" aria-controls="collapse_add_comment">
|
||||
{% trans "Reply" %}
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
{% for message in messages %}
|
||||
{% include "message.html" with messages=message.messages.all %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,12 +0,0 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
<div class="kaehmy_navigation">
|
||||
<nav class="navbar-border navbar navbar-toggleable-md navbar-light bg-faded">
|
||||
<div class="navbar-nav">
|
||||
<a class="nav-item nav-link" href="/kaehmy">{% trans "List kaehmys" %}</a>
|
||||
<a class="nav-item nav-link" href="/kaehmy/new">{% trans "New kaehmy" %} <span class="sr-only">(current)</span></a>
|
||||
<a class="nav-item nav-link" href="/kaehmy/statistics">{% trans "Statistics" %}</a>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -1,30 +0,0 @@
|
||||
{% extends "kaehmy:base.html" %}
|
||||
|
||||
{% load bootstrap3 %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block navigation %}
|
||||
{% include "kaehmy:navigation.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div>
|
||||
<div>
|
||||
<h2 style="padding-top: 1rem">{% trans "Statistics" %}</h2>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 1rem" class="card">
|
||||
<div class="card-header">
|
||||
<h5>{% trans "Total kaehmys:" %} {{ application_count }}</h5>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
{% for role in role_list %}
|
||||
<div>
|
||||
<p>{{ role.0 }} <strong data-toggle="tooltip" data-placement="right" title="{{ role.2 }}">({{ role.1 }})</strong></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
||||
+6
-6
@@ -52,7 +52,7 @@ def list_view(request, *args, **kwargs):
|
||||
"filter_options": filter_options,
|
||||
}
|
||||
|
||||
return render(request, "kaehmy:list.html", context)
|
||||
return render(request, "kaehmy/kaehmy_list.html", context)
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
@@ -77,7 +77,7 @@ def comment(request, *args, **kwargs):
|
||||
return redirect("/kaehmy")
|
||||
else:
|
||||
context = {"error": form.errors}
|
||||
return render(request, "kaehmy:error.html", context)
|
||||
return render(request, "kaehmy/kaehmy_error.html", context)
|
||||
|
||||
|
||||
@require_http_methods(["GET"])
|
||||
@@ -102,14 +102,14 @@ def statistics_view(request, *args, **kwargs):
|
||||
"application_count": len(applications),
|
||||
"role_list": role_list,
|
||||
}
|
||||
return render(request, "kaehmy:statistics.html", context)
|
||||
return render(request, "kaehmy/statistics.html", context)
|
||||
|
||||
|
||||
@require_http_methods(["GET"])
|
||||
def view(request, *args, **kwargs):
|
||||
"""Render Kaehmy form page."""
|
||||
form = ApplicationForm()
|
||||
return render(request, "kaehmy:kaehmy.html", {"form": form})
|
||||
return render(request, "kaehmy/kaehmy.html", {"form": form})
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
@@ -144,7 +144,7 @@ def submit(request, *args, **kwargs):
|
||||
processHooks(message=f"Uusi New kaehmy! {name} -> {url}", eventType="kaehmy")
|
||||
else:
|
||||
context = {"error": form.errors}
|
||||
return render(request, "kaehmy:error.html", context)
|
||||
return render(request, "kaehmy/error.html", context)
|
||||
return HttpResponseRedirect("/kaehmy")
|
||||
|
||||
|
||||
@@ -171,4 +171,4 @@ def export_view(request, *args, **kwargs):
|
||||
"non_board_table": make_table(non_board),
|
||||
"board_table": make_table(board),
|
||||
}
|
||||
return render(request, "kaehmy:export.html", context)
|
||||
return render(request, "kaehmy/export.html", context)
|
||||
|
||||
Reference in New Issue
Block a user