1
0
Fork 0
mirror of https://github.com/Findus23/RPGnotes.git synced 2024-09-19 15:43:45 +02:00

migrate everything over to jinja2

This commit is contained in:
Lukas Winkler 2021-10-15 21:47:49 +02:00
parent 46dc3492ad
commit b5c5366608
Signed by: lukas
GPG key ID: 54DE4D798D244853
51 changed files with 373 additions and 532 deletions

View file

@ -70,7 +70,7 @@ class CampaignDeleteView(generic.DeleteView):
""" """
broken at the moment broken at the moment
""" """
template_name = "common/confirm_delete.html" template_name = "common/confirm_delete.jinja"
model = Campaign model = Campaign
slug_url_kwarg = "campslug" slug_url_kwarg = "campslug"
success_url = reverse_lazy('campaigndetail') success_url = reverse_lazy('campaigndetail')

View file

@ -1,16 +1,17 @@
{% extends "tenantbase.jinja" %} {% extends "tenantbase.jinja" %}
{% import "macros.jinja" as macros %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
<ul class="nav nav-pills flex-column"> <ul class="nav nav-pills flex-column">
{% for c in player_characters %} {% for c in player_characters %}
{# {% include "macros/character-pillar.html" with character=c %}#} {{ macros.character_pillar(c) }}
{% endfor %} {% endfor %}
</ul> </ul>
<ul class="nav nav-pills flex-column"> <ul class="nav nav-pills flex-column">
{% for c in npcs %} {% for c in npcs %}
{# {% include "macros/character-pillar.html" with character=c %}#} {{ macros.character_pillar(c) }}
{% endfor %} {% endfor %}
</ul> </ul>
<a class="btn btn-primary" href="{{ url("characteradd") }}">{% trans %}Add Character{% endtrans %}</a> <a class="btn btn-primary" href="{{ url("characteradd") }}">{% trans %}Add Character{% endtrans %}</a>
@ -18,14 +19,13 @@
<div class="col-8"> <div class="col-8">
<div class="character-heading" style="border-bottom-color: {{ character.color }}"> <div class="character-heading" style="border-bottom-color: {{ character.color }}">
{% if character.smaller_image %} {% if character.smaller_image %}
{# {% thumbnail character.smaller_image "150x150" crop="center" as im %}#} {% set im=thumbnail(character.smaller_image, "150x150", crop="center") %}
{# <a href="{{ character.smaller_image.url }}" class="image-viewer">#} <a href="{{ character.smaller_image.url }}" class="image-viewer">
{# <img class="avatar avatar-image avatar-large rounded-circle" src="{{ im.url }}"#} <img class="avatar avatar-image avatar-large rounded-circle" src="{{ im.url }}"
{# width="{{ im.width }}"#} width="{{ im.width }}"
{# height="{{ im.height }}"#} height="{{ im.height }}"
{# srcset="{{ im.url|srcset }}">#} srcset="{{ im.url|srcset }}">
{# </a>#} </a>
{# {% endthumbnail %}#}
{% else %} {% else %}
<div class="avatar avatar-text avatar-large" <div class="avatar avatar-text avatar-large"
style="background: {{ character.color }};color:{{ character.text_color }}">{{ character.initials }}</div> style="background: {{ character.color }};color:{{ character.text_color }}">{{ character.initials }}</div>
@ -47,7 +47,7 @@
{% endif %} {% endif %}
{% if character.faction %} {% if character.faction %}
<dt>{{ _("Faction") }}:</dt> <dt>{{ _("Faction") }}:</dt>
<dd><a href="{{ character.faction.get_absolute_url }}">{{ character.faction.name }}</a></dd> <dd><a href="{{ character.faction.get_absolute_url() }}">{{ character.faction.name }}</a></dd>
{% endif %} {% endif %}
</dl> </dl>
{{ character.description_html|safe }} {{ character.description_html|safe }}

View file

@ -30,14 +30,14 @@ class CharacterDetailView(generic.DetailView):
class CharacterCreateView(generic.CreateView): class CharacterCreateView(generic.CreateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Character model = Character
form_class = CharacterForm form_class = CharacterForm
context_object_name = "object" context_object_name = "object"
class CharacterEditView(generic.UpdateView): class CharacterEditView(generic.UpdateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Character model = Character
form_class = CharacterForm form_class = CharacterForm
@ -48,6 +48,6 @@ class CharacterEditView(generic.UpdateView):
class CharacterDeleteView(generic.DeleteView): class CharacterDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html" template_name = "common/confirm_delete.jinja"
model = Character model = Character
success_url = reverse_lazy('characterlist') success_url = reverse_lazy('characterlist')

View file

@ -1,16 +1,14 @@
from django import template
from django.template.defaultfilters import safe from django.template.defaultfilters import safe
from django_jinja import library
from utils.money import format_money as money_formatter from utils.money import format_money as money_formatter
register = template.Library()
@library.filter()
@register.filter()
def format_money(money): def format_money(money):
return money_formatter(money) return money_formatter(money)
@register.filter() @library.filter()
def format_money_html(money): def format_money_html(money):
return safe(money_formatter(money, html=True)) return safe(money_formatter(money, html=True))

View file

@ -0,0 +1,14 @@
from django.utils import translation
from django_jinja import library
from rpg_notes.settings import LANGUAGES
@library.global_function()
def language_code():
return translation.get_language()
@library.global_function()
def all_languages():
return LANGUAGES

View file

@ -1,11 +1,9 @@
from django import template
from sorl.thumbnail.templatetags.thumbnail import resolution
from django_jinja import library from django_jinja import library
from sorl.thumbnail import get_thumbnail from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.templatetags.thumbnail import resolution
from rpg_notes import settings from rpg_notes import settings
register = template.Library()
@library.global_function @library.global_function
def thumbnail(*args, **kwargs): def thumbnail(*args, **kwargs):

View file

@ -1,11 +1,9 @@
from django import template from django_jinja import library
from rpg_notes.settings import DEBUG, DOMAIN from rpg_notes.settings import DEBUG, DOMAIN
register = template.Library()
@library.global_function
@register.simple_tag
def main_url(): def main_url():
protocol = "http" if DEBUG else "https" protocol = "http" if DEBUG else "https"
return f"{protocol}://{DOMAIN}" return f"{protocol}://{DOMAIN}"

View file

@ -1,12 +1,12 @@
from functools import lru_cache
from subprocess import run from subprocess import run
from django import template
from django.core.cache import cache from django.core.cache import cache
from django_jinja import library
register = template.Library()
@register.simple_tag @library.global_function
@lru_cache(maxsize=None)
def commit_id(): def commit_id():
commit = cache.get("commit") commit = cache.get("commit")
if not commit: if not commit:

View file

@ -1,6 +1,7 @@
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render from django.shortcuts import render
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django_jinja.views import ServerError
from ipware import get_client_ip from ipware import get_client_ip
from sentry_sdk import last_event_id from sentry_sdk import last_event_id
@ -13,7 +14,7 @@ class PublicHomepageView(TemplateView):
class LanguageSelectView(TemplateView): class LanguageSelectView(TemplateView):
template_name = "common/languageselect.html" template_name = "common/languageselect.jinja"
def print_ip(request): def print_ip(request):
@ -32,9 +33,8 @@ def debug_css_sourcemap(request):
css, source_map = get_css(debug=True) css, source_map = get_css(debug=True)
return HttpResponse(source_map, content_type="application/json") return HttpResponse(source_map, content_type="application/json")
def handler500(request, *args, **argv): def handler500(request, *args, **argv):
return render(request, "500.html", { return render(request, "500.jinja", {
"sentry_event_id": last_event_id(), "sentry_event_id": last_event_id(),
"sentry_dsn": SENTRY_DSN "sentry_dsn": SENTRY_DSN
}, status=500) }, status=500)

View file

@ -1,6 +1,5 @@
{% extends "tenantbase.html" %} {% extends "tenantbase.jinja" %}
{% load i18n %} {% import "macros.jinja" as macros %}
{% load humanize %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -8,34 +7,31 @@
<ul class="nav nav-pills flex-column"> <ul class="nav nav-pills flex-column">
{% for d in days %} {% for d in days %}
<li class="nav-item"> <li class="nav-item">
<a href="{% url "daydetail" d.day %}" <a href="{{ url("daydetail", d.day) }}"
class="nav-link {% if d.id == day.id %}active{% endif %}"> class="nav-link {% if d.id == day.id %}active{% endif %}">
{{ d.prettyname }} {{ d.prettyname }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<a class="btn btn-primary add-button" href="{% url "dayadd" %}">{% translate "Add Day" %}</a> <a class="btn btn-primary add-button" href="{{ url("dayadd") }} ">{{ _("Add Day") }}</a>
</div> </div>
<div class="col-8"> <div class="col-8">
<div class="day-heading"> <div class="day-heading">
<h1> <h1>
{{ day.prettyname }} {{ day.prettyname }}
<a href="{% url "dayedit" day.day %}"> <a href="{{ url("daydetail", day.day) }}">
{% translate "Edit" %} {{ _("Edit") }}
</a> </a>
</h1> </h1>
</div> </div>
{{ day.description_html|safe }} {{ day.description_html|safe }}
<dl> <dl>
<dt>{% translate "Sessions" %}:</dt> <dt>{{ _("Sessions") }}:</dt>
<dd>{{ day.sessions.all|join:", " }}</dd> <dd>{{ day.sessions.all()|join(", ") }}</dd>
</dl> </dl>
<div> {{ macros.last_edited(day) }}
<small>{% translate "Last updated" %}: {{ day.last_modified|naturaltime }}
{% translate "by" %} {{ day.history.first.history_user }} </small>
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -14,7 +14,7 @@ def list_day_redirect(request, *args, **kwargs):
class DayDetailView(generic.DetailView): class DayDetailView(generic.DetailView):
template_name = "days/day_detail.html" template_name = "days/day_detail.jinja"
model = IngameDay model = IngameDay
context_object_name = "day" context_object_name = "day"
@ -28,14 +28,14 @@ class DayDetailView(generic.DetailView):
class DayCreateView(generic.CreateView): class DayCreateView(generic.CreateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = IngameDay model = IngameDay
form_class = DayForm form_class = DayForm
context_object_name = "object" context_object_name = "object"
class DayEditView(generic.UpdateView): class DayEditView(generic.UpdateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = IngameDay model = IngameDay
form_class = DayForm form_class = DayForm
@ -49,7 +49,7 @@ class DayEditView(generic.UpdateView):
class DayDeleteView(generic.DeleteView): class DayDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html" template_name = "common/confirm_delete.jinja"
model = IngameDay model = IngameDay
success_url = reverse_lazy('daylist') success_url = reverse_lazy('daylist')

View file

@ -1,6 +1,5 @@
{% extends "tenantbase.html" %} {% extends "tenantbase.jinja" %}
{% load i18n %} {% import "macros.jinja" as macros %}
{% load humanize %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -8,37 +7,34 @@
<ul class="nav nav-pills flex-column"> <ul class="nav nav-pills flex-column">
{% for f in factions %} {% for f in factions %}
<li class="nav-item"> <li class="nav-item">
<a href="{% url "factiondetail" f.slug %}" <a href="{{ url("factiondetail", f.slug) }}"
class="nav-link {% if f.id == faction.id %}active{% endif %}"> class="nav-link {% if f.id == faction.id %}active{% endif %}">
{{ f.name }} {{ f.name }}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<a class="btn btn-primary add-button" href="{% url "factionadd" %}">{% translate "Add Faction" %}</a> <a class="btn btn-primary add-button" href="{{ url("factionadd") }}">{{ _("Add Faction") }}</a>
</div> </div>
<div class="col-8"> <div class="col-8">
<div class="faction-heading"> <div class="faction-heading">
<h1> <h1>
{{ faction.name }} {{ faction.name }}
<a href="{% url "factionedit" faction.slug %}"> <a href="{{ url("factionedit", faction.slug) }}">
{% translate "Edit" %} {{ _("Edit") }}
</a> </a>
</h1> </h1>
</div> </div>
<dl> <dl>
<dt>{% translate "Members" %}:</dt> <dt>{{ _("Members") }}:</dt>
<dd> <dd>
{% for char in faction.characters.all %} {% for char in faction.characters.all() %}
<a href="{{ char.get_absolute_url }}">{{ char.name }}</a> <a href="{{ char.get_absolute_url() }}">{{ char.name }}</a>
{% endfor %} {% endfor %}
</dd> </dd>
</dl> </dl>
{{ faction.description_html|safe }} {{ faction.description_html|safe }}
<div> {{ macros.last_edited(faction) }}
<small>{% translate "Last updated" %}: {{ faction.last_modified|naturaltime }}
{% translate "by" %} {{ faction.history.first.history_user }} </small>
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -15,7 +15,7 @@ def list_faction_redirect(request, *args, **kwargs):
class FactionDetailView(generic.DetailView): class FactionDetailView(generic.DetailView):
template_name = "factions/detail.html" template_name = "factions/detail.jinja"
model = Faction model = Faction
context_object_name = "faction" context_object_name = "faction"
@ -26,14 +26,14 @@ class FactionDetailView(generic.DetailView):
class FactionCreateView(generic.CreateView): class FactionCreateView(generic.CreateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Faction model = Faction
form_class = FactionForm form_class = FactionForm
context_object_name = "object" context_object_name = "object"
class FactionEditView(generic.UpdateView): class FactionEditView(generic.UpdateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Faction model = Faction
form_class = FactionForm form_class = FactionForm
@ -44,6 +44,6 @@ class FactionEditView(generic.UpdateView):
class FactionDeleteView(generic.DeleteView): class FactionDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html" template_name = "common/confirm_delete.jinja"
model = Faction model = Faction
success_url = reverse_lazy('factionlist') success_url = reverse_lazy('factionlist')

View file

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-15 19:45+0200\n" "POT-Creation-Date: 2021-10-15 20:50+0200\n"
"PO-Revision-Date: 2021-10-03 17:19+0200\n" "PO-Revision-Date: 2021-10-03 17:19+0200\n"
"Last-Translator: Lukas Winkler <translations@lw1.at>\n" "Last-Translator: Lukas Winkler <translations@lw1.at>\n"
"Language-Team: \n" "Language-Team: \n"
@ -32,16 +32,16 @@ msgid "Add new campaign"
msgstr "Neue Campagne erstellen" msgstr "Neue Campagne erstellen"
#: campaigns/templates/campaigns/campaign_edit.jinja:9 #: campaigns/templates/campaigns/campaign_edit.jinja:9
#: loot/templates/loot/edit.html:29 loot/templates/loot/edit.html:32 #: loot/templates/loot/edit.jinja:25 loot/templates/loot/edit.jinja:28
msgid "Add" msgid "Add"
msgstr "Hinzufügen" msgstr "Hinzufügen"
#: campaigns/templates/campaigns/campaign_overview.jinja:3 #: campaigns/templates/campaigns/campaign_overview.jinja:3
#: campaigns/templates/campaigns/campaign_overview.jinja:8 #: campaigns/templates/campaigns/campaign_overview.jinja:9
msgid "Campaign Overview" msgid "Campaign Overview"
msgstr "Kampagnenübersicht" msgstr "Kampagnenübersicht"
#: campaigns/templates/campaigns/campaign_overview.jinja:13 #: campaigns/templates/campaigns/campaign_overview.jinja:14
msgid "create Campaign" msgid "create Campaign"
msgstr "Campaign erstellen" msgstr "Campaign erstellen"
@ -53,7 +53,7 @@ msgstr "Spitzname"
msgid "Subtitle" msgid "Subtitle"
msgstr "Untertitel" msgstr "Untertitel"
#: characters/models.py:26 characters/templates/characters/detail.html:48 #: characters/models.py:26 characters/templates/characters/detail.jinja:45
msgid "Player" msgid "Player"
msgstr "Spieler" msgstr "Spieler"
@ -61,13 +61,13 @@ msgstr "Spieler"
msgid "If no player is selected, this character is considered an NPC." msgid "If no player is selected, this character is considered an NPC."
msgstr "Wenn kein Spieler ausgewählt ist, ist dies ein NPC." msgstr "Wenn kein Spieler ausgewählt ist, ist dies ein NPC."
#: characters/models.py:32 characters/templates/characters/detail.html:52 #: characters/models.py:32 characters/templates/characters/detail.jinja:49
#: factions/models.py:15 #: factions/models.py:15
msgid "Faction" msgid "Faction"
msgstr "Fraktion" msgstr "Fraktion"
#: characters/models.py:36 locations/models.py:25 loot/models.py:24 #: characters/models.py:36 locations/models.py:25 loot/models.py:24
#: loot/templates/loot/overview.html:19 #: loot/templates/loot/overview.jinja:17
msgid "Location" msgid "Location"
msgstr "Ort" msgstr "Ort"
@ -96,30 +96,27 @@ msgstr "Charakter"
msgid "Characters" msgid "Characters"
msgstr "Charaktere" msgstr "Charaktere"
#: characters/templates/characters/detail.html:20 #: characters/templates/characters/detail.jinja:17
msgid "Add Character" msgid "Add Character"
msgstr "Charakter hinzufügen" msgstr "Charakter hinzufügen"
#: characters/templates/characters/detail.html:41 #: characters/templates/characters/detail.jinja:38
#: days/templates/days/day_detail.html:25 #: days/templates/days/day_detail.jinja:24
#: factions/templates/factions/detail.html:25 #: factions/templates/factions/detail.html:25
#: loot/templates/loot/overview.html:54 #: locations/templates/locations/detail.jinja:22
#: loot/templates/loot/overview.jinja:51
msgid "Edit" msgid "Edit"
msgstr "Bearbeiten" msgstr "Bearbeiten"
#: characters/templates/characters/detail.html:70 #: characters/templates/characters/detail.jinja:66
#: days/templates/days/day_detail.html:36
#: factions/templates/factions/detail.html:39 #: factions/templates/factions/detail.html:39
#: locations/templates/locations/detail.html:71 #: notes/templates/notes/detail.html:61 templates/macros.jinja:28
#: notes/templates/notes/detail.html:61
msgid "Last updated" msgid "Last updated"
msgstr "Zuletzt geändert" msgstr "Zuletzt geändert"
#: characters/templates/characters/detail.html:71 #: characters/templates/characters/detail.jinja:67
#: days/templates/days/day_detail.html:37
#: factions/templates/factions/detail.html:40 #: factions/templates/factions/detail.html:40
#: locations/templates/locations/detail.html:72 #: notes/templates/notes/detail.html:62 templates/macros.jinja:29
#: notes/templates/notes/detail.html:62
msgid "by" msgid "by"
msgstr "von" msgstr "von"
@ -139,7 +136,7 @@ msgstr "Datum"
msgid "Session" msgid "Session"
msgstr "Session" msgstr "Session"
#: days/models.py:17 days/templates/days/day_detail.html:31 #: days/models.py:17 days/templates/days/day_detail.jinja:30
msgid "Sessions" msgid "Sessions"
msgstr "Sessions" msgstr "Sessions"
@ -155,7 +152,7 @@ msgstr "Tage"
msgid "day" msgid "day"
msgstr "Tag" msgstr "Tag"
#: days/templates/days/day_detail.html:18 #: days/templates/days/day_detail.jinja:17
msgid "Add Day" msgid "Add Day"
msgstr "Tag hinzufügen" msgstr "Tag hinzufügen"
@ -172,7 +169,7 @@ msgstr "Fraktion hinzufügen"
msgid "Members" msgid "Members"
msgstr "Mitglieder" msgstr "Mitglieder"
#: locations/models.py:18 locations/templates/locations/detail.html:44 #: locations/models.py:18 locations/templates/locations/detail.jinja:41
#: notes/models.py:18 notes/templates/notes/detail.html:44 #: notes/models.py:18 notes/templates/notes/detail.html:44
msgid "Part of" msgid "Part of"
msgstr "Teil von" msgstr "Teil von"
@ -188,15 +185,15 @@ msgstr "Token Bild"
msgid "Locations" msgid "Locations"
msgstr "Orte" msgstr "Orte"
#: locations/templates/locations/detail.html:18 #: locations/templates/locations/detail.jinja:15
msgid "Add Location" msgid "Add Location"
msgstr "Ort hinzufügen" msgstr "Ort hinzufügen"
#: locations/templates/locations/detail.html:48 #: locations/templates/locations/detail.jinja:45
msgid "Contains" msgid "Contains"
msgstr "" msgstr ""
#: loot/models.py:12 loot/templates/loot/overview.html:16 #: loot/models.py:12 loot/templates/loot/overview.jinja:14
msgid "Quantity" msgid "Quantity"
msgstr "Anzahl" msgstr "Anzahl"
@ -208,7 +205,7 @@ msgstr "Wert (Gold)"
msgid "Weight (lb)" msgid "Weight (lb)"
msgstr "Gewicht (lb)" msgstr "Gewicht (lb)"
#: loot/models.py:18 loot/templates/loot/overview.html:18 #: loot/models.py:18 loot/templates/loot/overview.jinja:16
msgid "Claimant" msgid "Claimant"
msgstr "Beansprucht von" msgstr "Beansprucht von"
@ -216,56 +213,52 @@ msgstr "Beansprucht von"
msgid "Magic Item" msgid "Magic Item"
msgstr "Magisches Item" msgstr "Magisches Item"
#: loot/models.py:31 loot/models.py:32 loot/templates/loot/overview.html:5 #: loot/models.py:31 loot/models.py:32 loot/templates/loot/overview.jinja:3
#: loot/templates/loot/overview.html:8 templates/tenantbase.html:45 #: loot/templates/loot/overview.jinja:6 templates/tenantbase.html:45
#: templates/tenantbase.jinja:42 #: templates/tenantbase.jinja:42
msgid "Loot" msgid "Loot"
msgstr "Loot" msgstr "Loot"
#: loot/templates/loot/edit.html:8 #: loot/templates/loot/edit.jinja:5
#, python-format #, python-format
msgid "Edit \"%(name)s\"" msgid "Edit \"%(name)s\""
msgstr "\"%(name)s\" bearbeiten" msgstr "\"%(name)s\" bearbeiten"
#: loot/templates/loot/edit.html:10 loot/templates/loot/edit.html:12 #: loot/templates/loot/edit.jinja:7 loot/templates/loot/edit.jinja:9
#: loot/templates/loot/edit.html:14 loot/templates/loot/edit.html:16 #: loot/templates/loot/edit.jinja:11 loot/templates/loot/edit.jinja:13
msgid "Delete" msgid "Delete"
msgstr "Löschen" msgstr "Löschen"
#: loot/templates/loot/edit.html:19 #: loot/templates/loot/edit.jinja:16
msgid "Add new" msgid "Add new"
msgstr "Neu erstellen" msgstr "Neu erstellen"
#: loot/templates/loot/edit.html:29 loot/templates/loot/edit.html:32 #: loot/templates/loot/edit.jinja:25 loot/templates/loot/edit.jinja:28
#: templates/common/languageselect.html:19 #: templates/common/languageselect.html:19
#: templates/registration/registration_form.html:13 #: templates/registration/registration_form.html:13
#: users/templates/users/edit.html:13 #: users/templates/users/edit.html:13
msgid "Save" msgid "Save"
msgstr "Speichern" msgstr "Speichern"
#: loot/templates/loot/overview.html:15 #: loot/templates/loot/overview.jinja:13
msgid "Item" msgid "Item"
msgstr "Objekt" msgstr "Objekt"
#: loot/templates/loot/overview.html:17 loot/templates/loot/overview.html:74 #: loot/templates/loot/overview.jinja:15 loot/templates/loot/overview.jinja:72
msgid "Total Value" msgid "Total Value"
msgstr "Gesamtwert" msgstr "Gesamtwert"
#: loot/templates/loot/overview.html:41 #: loot/templates/loot/overview.jinja:56
msgid "Nobody"
msgstr "Niemand"
#: loot/templates/loot/overview.html:58
msgid "Value each" msgid "Value each"
msgstr "Wert pro Stück" msgstr "Wert pro Stück"
#: loot/templates/loot/overview.html:62 #: loot/templates/loot/overview.jinja:60
#, fuzzy #, fuzzy
#| msgid "Weight (lb)" #| msgid "Weight (lb)"
msgid "Weight" msgid "Weight"
msgstr "Gewicht (lb)" msgstr "Gewicht (lb)"
#: loot/templates/loot/overview.html:77 #: loot/templates/loot/overview.jinja:75
msgid "Add Loot" msgid "Add Loot"
msgstr "Loot hinzufügen" msgstr "Loot hinzufügen"
@ -282,11 +275,11 @@ msgstr "Notizen"
msgid "Add Note" msgid "Add Note"
msgstr "Notiz hinzufügen" msgstr "Notiz hinzufügen"
#: rpg_notes/settings.py:194 #: rpg_notes/settings.py:195
msgid "German" msgid "German"
msgstr "Deutsch" msgstr "Deutsch"
#: rpg_notes/settings.py:195 #: rpg_notes/settings.py:196
msgid "English" msgid "English"
msgstr "Englisch" msgstr "Englisch"
@ -310,10 +303,6 @@ msgstr "Abmelden"
msgid "Log in" msgid "Log in"
msgstr "Anmelden" msgstr "Anmelden"
#: templates/base.jinja:42
msgid "test"
msgstr ""
#: templates/common/homepage.jinja:8 #: templates/common/homepage.jinja:8
msgid "" msgid ""
"An experimental, collaborative note taking app and wiki optimized for RPG " "An experimental, collaborative note taking app and wiki optimized for RPG "
@ -399,3 +388,6 @@ msgstr ""
#: users/views.py:61 #: users/views.py:61
msgid "User account was updated successfully" msgid "User account was updated successfully"
msgstr "" msgstr ""
#~ msgid "Nobody"
#~ msgstr "Niemand"

View file

@ -1,8 +1,5 @@
{% extends "tenantbase.html" %} {% extends "tenantbase.jinja" %}
{% load i18n %} {% import "macros.jinja" as macros %}
{% load thumbutils %}
{% load thumbnail %}
{% load humanize %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -10,26 +7,26 @@
<div class="list-group"> <div class="list-group">
{% for p in roots %} {% for p in roots %}
<a class="tree-{{ p.tree_depth }} list-group-item list-group-item-action {% if location.id == p.id %}active{% endif %}" <a class="tree-{{ p.tree_depth }} list-group-item list-group-item-action {% if location.id == p.id %}active{% endif %}"
href="{{ p.get_absolute_url }}"> href="{{ p.get_absolute_url() }}">
{{ p }} {{ p }}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
<a class="btn btn-primary" href="{% url "locationadd" %}">{% translate "Add Location" %}</a> <a class="btn btn-primary" href="{{ url("locationadd") }} ">{{ _("Add Location") }}</a>
</div> </div>
<div class="col-8"> <div class="col-8">
<div class="character-heading"> <div class="character-heading">
<h1> <h1>
{{ location.name }} {{ location.name }}
<a href="{% url "locationedit" location.slug %}"> <a href="{{ url("locationedit", location.slug) }}">
edit {{ _("Edit") }}
</a> </a>
</h1> </h1>
<nav aria-label="breadcrumb" class="breadcrumbs"> <nav aria-label="breadcrumb" class="breadcrumbs">
<ol class="breadcrumb"> <ol class="breadcrumb">
{% for ancestor in location.ancestors %} {% for ancestor in location.ancestors() %}
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{{ ancestor.get_absolute_url }}">{{ ancestor }}</a> <a href="{{ ancestor.get_absolute_url() }}">{{ ancestor }}</a>
</li> </li>
{% endfor %} {% endfor %}
<li class="breadcrumb-item active" aria-current="page"> <li class="breadcrumb-item active" aria-current="page">
@ -41,36 +38,32 @@
<dl> <dl>
{% if location.part_of %} {% if location.part_of %}
<dt>{% translate "Part of" %}:</dt> <dt>{{ _("Part of") }}:</dt>
<dd><a href="{{ location.part_of.get_absolute_url }}">{{ location.part_of }}</a></dd> <dd><a href="{{ location.part_of.get_absolute_url() }}">{{ location.part_of }}</a></dd>
{% endif %} {% endif %}
{% if location.loot %} {% if location.loot %}
<dt>{% translate "Contains" %}:</dt> <dt>{{ _("Contains") }}:</dt>
<dd> <dd>
<ul> <ul>
{% for l in location.loot.all %} {% for l in location.loot.all() %}
<li><a href="{{ l.get_absolute_url }}">{{ l.name }}</a></li> <li><a href="{{ l.get_absolute_url() }}">{{ l.name }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</dd> </dd>
{% endif %} {% endif %}
{% if location.image %} {% if location.image %}
{% thumbnail location.image "860" crop="center" as im %} {% set im=thumbnail(location.image, "860", crop="center") %}
<a href="{{ location.image.url }}" class="image-viewer"> <a href="{{ location.image.url }}" class="image-viewer">
<img class="img-fluid" src="{{ im.url }}" <img class="img-fluid" src="{{ im.url }}"
width="{{ im.width }}" width="{{ im.width }}"
height="{{ im.height }}" height="{{ im.height }}"
srcset="{{ im.url|srcset }}"> srcset="{{ im.url|srcset }}">
</a> </a>
{% endthumbnail %}
{% endif %} {% endif %}
</dl> </dl>
{{ location.description_html|safe }} {{ location.description_html|safe }}
<div> {{ macros.last_edited(location) }}
<small>{% translate "Last updated" %}: {{ location.last_modified|naturaltime }}
{% translate "by" %} {{ location.history.first.history_user }} </small>
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -15,7 +15,7 @@ def list_location_redirect(request, *args, **kwargs):
class LocationDetailView(generic.DetailView): class LocationDetailView(generic.DetailView):
template_name = "locations/detail.html" template_name = "locations/detail.jinja"
model = Location model = Location
context_object_name = "location" context_object_name = "location"
@ -26,14 +26,14 @@ class LocationDetailView(generic.DetailView):
class LocationCreateView(generic.CreateView): class LocationCreateView(generic.CreateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Location model = Location
form_class = LocationForm form_class = LocationForm
context_object_name = "object" context_object_name = "object"
class LocationEditView(generic.UpdateView): class LocationEditView(generic.UpdateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Location model = Location
form_class = LocationForm form_class = LocationForm
@ -44,6 +44,6 @@ class LocationEditView(generic.UpdateView):
class LocationDeleteView(generic.DeleteView): class LocationDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html" template_name = "common/confirm_delete.jinja"
model = Location model = Location
success_url = reverse_lazy('locationlist') success_url = reverse_lazy('locationlist')

View file

@ -1,41 +0,0 @@
{% extends 'tenantbase.html' %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block heading %}
{% if edit %}
<h1>{% blocktrans with name=object.name %}Edit "{{ name }}"{% endblocktrans %}</h1>
{% if request.resolver_match.view_name == "lootedit" %}
<a class="btn btn-danger" href="{% url "lootdelete" object.id %}">{% translate "Delete" %}</a>
{% elif request.resolver_match.view_name == "dayedit" %}
<a class="btn btn-danger" href="{% url "daydelete" object.id %}">{% translate "Delete" %}</a>
{% elif request.resolver_match.view_name == "locationedit" %}
<a class="btn btn-danger" href="{% url "locationdelete" object.slug %}">{% translate "Delete" %}</a>
{% elif request.resolver_match.view_name == "characteredit" %}
<a class="btn btn-danger" href="{% url "characterdelete" object.slug %}">{% translate "Delete" %}</a>
{% endif %}
{% else %}
<h1>{% translate "Add new" %}</h1>
{% endif %}
{% endblock %}
{% block content %}
<form method="post"
{% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{% translate "Save" %}{% else %}{% translate "Add" %}{% endif %}">
{% bootstrap_form form %}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{% translate "Save" %}{% else %}{% translate "Add" %}{% endif %}">
</form>
{% endblock %}
{% block extra_js %}
<script src="{% static "libs/easymde.min.js" %}"></script>
<script src="{% static "libs/fontawesome-solid.min.js" %}"></script>
<script src="{% static "libs/fontawesome.min.js" %}"></script>
<script src="{% static "js/markdown.js" %}"></script>
{% endblock %}

View file

@ -0,0 +1,37 @@
{% extends 'tenantbase.jinja' %}
{% block heading %}
{% if edit %}
<h1>{% trans name=object.name %}Edit "{{ name }}"{% endtrans %}</h1>
{% if request.resolver_match.view_name == "lootedit" %}
<a class="btn btn-danger" href="{{ url("lootdelete", object.id) }}">{{ _("Delete") }}</a>
{% elif request.resolver_match.view_name == "dayedit" %}
<a class="btn btn-danger" href="{{ url("daydelete", object.id) }}">{{ _("Delete") }}</a>
{% elif request.resolver_match.view_name == "locationedit" %}
<a class="btn btn-danger" href="{{ url("locationdelete", object.id) }}">{{ _("Delete") }}</a>
{% elif request.resolver_match.view_name == "characteredit" %}
<a class="btn btn-danger" href="{{ url("characterdelete", object.id) }}">{{ _("Delete") }}</a>
{% endif %}
{% else %}
<h1>{{ _("Add new") }}</h1>
{% endif %}
{% endblock %}
{% block content %}
<form method="post" {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{{ _("Save") }}{% else %}{{ _("Add") }}{% endif %}">
{{ bootstrap_form(form) }}
<input type="submit" class="btn btn-primary"
value="{% if edit %}{{ _("Save") }}{% else %}{{ _("Add") }}{% endif %}">
</form>
{% endblock %}
{% block extra_js %}
<script src="{{ static("libs/easymde.min.js") }}"></script>
<script src="{{ static("libs/fontawesome-solid.min.js") }}"></script>
<script src="{{ static("libs/fontawesome.min.js") }}"></script>
<script src="{{ static("js/markdown.js") }}"></script>
{% endblock %}

View file

@ -1,22 +1,20 @@
{% extends "tenantbase.html" %} {% extends "tenantbase.jinja" %}
{% load i18n %}
{% load formatters %}
{% block title %}{% translate "Loot" %}{% endblock %} {% block title %}{% trans %}Loot{% endtrans %} {% endblock %}
{% block heading %} {% block heading %}
<h1>{% translate "Loot" %}</h1> <h1>{% trans %}Loot{% endtrans %}</h1>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<td></td> <td></td>
<td>{% translate "Item" %}</td> <td>{{ _("Item") }}</td>
<td>{% translate "Quantity" %}</td> <td>{{ _("Quantity") }}</td>
<td>{% translate "Total Value" %}</td> <td>{{ _("Total Value") }}</td>
<td>{% translate "Claimant" %}</td> <td>{{ _("Claimant") }}</td>
<td>{% translate "Location" %}</td> <td>{{ _("Location") }}</td>
<td></td> <td></td>
</tr> </tr>
</thead> </thead>
@ -38,9 +36,8 @@
<td>{{ l.name }}</td> <td>{{ l.name }}</td>
<td>{{ l.quantity }}</td> <td>{{ l.quantity }}</td>
<td>{{ l.value_gold|format_money_html }}</td> <td>{{ l.value_gold|format_money_html }}</td>
{% trans 'Nobody' as nobody %} <td>{{ l.owner|default(_('Nobody')) }}</td>
<td>{{ l.owner|default:nobody }}</td> <td>{{ l.location|default("") }}</td>
<td>{{ l.location|default:"" }}</td>
<td> <td>
<svg class="chev" viewBox="0 0 640 1024" xmlns="http://www.w3.org/2000/svg"> <svg class="chev" viewBox="0 0 640 1024" xmlns="http://www.w3.org/2000/svg">
<path d="M512 320L320 512 128 320 0 448l320 320 320-320L512 320z"/> <path d="M512 320L320 512 128 320 0 448l320 320 320-320L512 320z"/>
@ -51,15 +48,16 @@
<td colspan="7" class="collapse-cell"> <td colspan="7" class="collapse-cell">
<div class="collapse" id="row-{{ l.id }}"> <div class="collapse" id="row-{{ l.id }}">
<div class="cell-box"> <div class="cell-box">
<h3>{{ l.name }} <a href="{% url "lootedit" l.id %}">{% translate "Edit" %}</a></h3> <h3>{{ l.name }} <a href="{{ url("lootedit", l.id) }}">{{ _("Edit") }}</a>
</h3>
{{ l.description_html|safe }} {{ l.description_html|safe }}
<dl> <dl>
{% if l.value_per_unit and l.quantity > 1 %} {% if l.value_per_unit and l.quantity > 1 %}
<dt>{% translate "Value each" %}</dt> <dt>{{ _("Value each") }}</dt>
<dd>{{ l.value_per_unit|format_money_html }}</dd> <dd>{{ l.value_per_unit|format_money_html }}</dd>
{% endif %} {% endif %}
{% if l.weight %} {% if l.weight %}
<dt>{% translate "Weight" %}</dt> <dt>{{ _("Weight") }}</dt>
<dd>{{ l.weight }} lb</dd> <dd>{{ l.weight }} lb</dd>
{% endif %} {% endif %}
</dl> </dl>
@ -71,10 +69,10 @@
</tbody> </tbody>
</table> </table>
<dl> <dl>
<dd>{% translate "Total Value" %}:</dd> <dd>{{ _("Total Value") }}:</dd>
<dt>{{ total_value|format_money_html }}</dt> <dt>{{ total_value|format_money_html }}</dt>
</dl> </dl>
<a href="{% url "lootadd" %}" class="btn btn-primary">{% translate "Add Loot" %}</a> <a href="{{ url("lootadd") }} " class="btn btn-primary">{{ _("Add Loot") }}</a>
{% endblock %} {% endblock %}

View file

@ -7,7 +7,7 @@ from loot.models import Loot
class LootListView(generic.ListView): class LootListView(generic.ListView):
template_name = "loot/overview.html" template_name = "loot/overview.jinja"
model = Loot model = Loot
context_object_name = "loot" context_object_name = "loot"
@ -24,7 +24,7 @@ class LootListView(generic.ListView):
class LootCreateView(generic.CreateView): class LootCreateView(generic.CreateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Loot model = Loot
form_class = LootForm form_class = LootForm
@ -32,7 +32,7 @@ class LootCreateView(generic.CreateView):
class LootEditView(generic.UpdateView): class LootEditView(generic.UpdateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Loot model = Loot
form_class = LootForm form_class = LootForm
context_object_name = "object" context_object_name = "object"
@ -46,7 +46,7 @@ class LootEditView(generic.UpdateView):
class LootDeleteView(generic.DeleteView): class LootDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html" template_name = "common/confirm_delete.jinja"
model = Loot model = Loot
success_url = reverse_lazy("lootlist") success_url = reverse_lazy("lootlist")

View file

@ -1,8 +1,5 @@
{% extends "tenantbase.html" %} {% extends "tenantbase.jinja" %}
{% load i18n %} {% import "macros.jinja" as macros %}
{% load thumbutils %}
{% load thumbnail %}
{% load humanize %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -10,26 +7,26 @@
<div class="list-group"> <div class="list-group">
{% for p in roots %} {% for p in roots %}
<a class="tree-{{ p.tree_depth }} list-group-item list-group-item-action {% if note.id == p.id %}active{% endif %}" <a class="tree-{{ p.tree_depth }} list-group-item list-group-item-action {% if note.id == p.id %}active{% endif %}"
href="{{ p.get_absolute_url }}"> href="{{ p.get_absolute_url() }}">
{{ p }} {{ p }}
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
<a class="btn btn-primary" href="{% url "noteadd" %}">{% translate "Add Note" %}</a> <a class="btn btn-primary" href="{{ url("noteadd") }} ">{{ _("Add Note") }}</a>
</div> </div>
<div class="col-8"> <div class="col-8">
<div class="character-heading"> <div class="character-heading">
<h1> <h1>
{{ note.name }} {{ note.name }}
<a href="{% url "noteedit" note.slug %}"> <a href="{{ url("noteedit", note.slug) }}">
edit {{ _("Edit") }}
</a> </a>
</h1> </h1>
<nav aria-label="breadcrumb" class="breadcrumbs"> <nav aria-label="breadcrumb" class="breadcrumbs">
<ol class="breadcrumb"> <ol class="breadcrumb">
{% for ancestor in note.ancestors %} {% for ancestor in note.ancestors() %}
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="{{ ancestor.get_absolute_url }}">{{ ancestor }}</a> <a href="{{ ancestor.get_absolute_url() }}">{{ ancestor }}</a>
</li> </li>
{% endfor %} {% endfor %}
<li class="breadcrumb-item active" aria-current="page"> <li class="breadcrumb-item active" aria-current="page">
@ -41,26 +38,22 @@
<dl> <dl>
{% if note.part_of %} {% if note.part_of %}
<dt>{% translate "Part of" %}:</dt> <dt>{{ _("Part of") }}:</dt>
<dd><a href="{{ note.part_of.get_absolute_url }}">{{ note.part_of }}</a></dd> <dd><a href="{{ note.part_of.get_absolute_url() }}">{{ note.part_of }}</a></dd>
{% endif %} {% endif %}
{% if note.image %} {% if note.image %}
{% thumbnail note.image "860" crop="center" as im %} {% set im=thumbnail(note.image, "860", crop="center") %}
<a href="{{ note.image.url }}" class="image-viewer"> <a href="{{ note.image.url }}" class="image-viewer">
<img class="img-fluid" src="{{ im.url }}" <img class="img-fluid" src="{{ im.url }}"
width="{{ im.width }}" width="{{ im.width }}"
height="{{ im.height }}" height="{{ im.height }}"
srcset="{{ im.url|srcset }}"> srcset="{{ im.url|srcset }}">
</a> </a>
{% endthumbnail %}
{% endif %} {% endif %}
</dl> </dl>
{{ note.description_html|safe }} {{ note.description_html|safe }}
<div> {{ macros.last_edited(note) }}
<small>{% translate "Last updated" %}: {{ note.last_modified|naturaltime }}
{% translate "by" %} {{ note.history.first.history_user }} </small>
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -15,7 +15,7 @@ def list_note_redirect(request, *args, **kwargs):
class NoteDetailView(generic.DetailView): class NoteDetailView(generic.DetailView):
template_name = "notes/detail.html" template_name = "notes/detail.jinja"
model = Note model = Note
context_object_name = "note" context_object_name = "note"
@ -26,14 +26,14 @@ class NoteDetailView(generic.DetailView):
class NoteCreateView(generic.CreateView): class NoteCreateView(generic.CreateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Note model = Note
form_class = NoteForm form_class = NoteForm
context_object_name = "object" context_object_name = "object"
class NoteEditView(generic.UpdateView): class NoteEditView(generic.UpdateView):
template_name = "loot/edit.html" template_name = "loot/edit.jinja"
model = Note model = Note
form_class = NoteForm form_class = NoteForm
@ -44,6 +44,6 @@ class NoteEditView(generic.UpdateView):
class NoteDeleteView(generic.DeleteView): class NoteDeleteView(generic.DeleteView):
template_name = "common/confirm_delete.html" template_name = "common/confirm_delete.jinja"
model = Note model = Note
success_url = reverse_lazy('notelist') success_url = reverse_lazy('notelist')

View file

@ -126,10 +126,9 @@ TEMPLATES = [
# 'jdj_tags.extensions.DjangoCompat', # 'jdj_tags.extensions.DjangoCompat',
# ] # ]
'context_processors': [ 'context_processors': [
'django.template.context_processors.request',
'django.template.context_processors.debug',
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
], ],
"bytecode_cache": { "bytecode_cache": {

View file

@ -7,7 +7,7 @@ from common import views
from rpg_notes import settings from rpg_notes import settings
urlpatterns = [ urlpatterns = [
path('', include('django.contrib.auth.urls')), path('', include('rpg_notes.urls_auth')),
path('i18n/', include('django.conf.urls.i18n')), path('i18n/', include('django.conf.urls.i18n')),
path("language/", views.LanguageSelectView.as_view(), name="change_language"), path("language/", views.LanguageSelectView.as_view(), name="change_language"),
# path("ip", views.print_ip, name="ip"), # path("ip", views.print_ip, name="ip"),

25
rpg_notes/urls_auth.py Normal file
View file

@ -0,0 +1,25 @@
# The views used below are normally mapped in the AdminSite instance.
# This URLs file is used to provide a reliable view deployment for test purposes.
# It is also provided as a convenience to those who want to deploy these URLs
# elsewhere.
from django.contrib.auth import views
from django.urls import path
class CustomLoginView(views.LoginView):
template_name = "registration/login.jinja"
urlpatterns = [
path('login/', CustomLoginView.as_view(), name='login'),
path('logout/', views.LogoutView.as_view(), name='logout'),
path('password_change/', views.PasswordChangeView.as_view(), name='password_change'),
path('password_change/done/', views.PasswordChangeDoneView.as_view(), name='password_change_done'),
path('password_reset/', views.PasswordResetView.as_view(), name='password_reset'),
path('password_reset/done/', views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>/', views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
path('reset/done/', views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
]

View file

@ -2,6 +2,7 @@ import debug_toolbar
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.urls import path, include from django.urls import path, include
from django_jinja.views import PermissionDenied
from common import views from common import views
from rpg_notes import settings from rpg_notes import settings
@ -9,7 +10,7 @@ from users import views as user_views
urlpatterns = [ urlpatterns = [
path('', include('users.urls')), path('', include('users.urls')),
path('', include('django.contrib.auth.urls')), path('', include('rpg_notes.urls_auth')),
path('', views.PublicHomepageView.as_view()), path('', views.PublicHomepageView.as_view()),
path("profile/", user_views.UserEditView.as_view(), name="edit_profile"), path("profile/", user_views.UserEditView.as_view(), name="edit_profile"),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),

View file

@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "base.jinja" %}
{% load i18n %} {% load i18n %}
{% load urls %} {% load urls %}

View file

@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "base.jinja" %}
{% block mainpage %} {% block mainpage %}

View file

@ -1,68 +0,0 @@
{% load i18n %}
{% load version %}
{% load django_bootstrap5 %}
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock %} - RPGnotes</title>
<!-- Bootstrap -->
{% if debug %}
<link rel="stylesheet" href="{% url "css" %}">
{% else %}
<link rel="stylesheet" href="{% static "css/main.css" %}">
{% endif %}
</head>
<body>
<div class="container">
{% bootstrap_messages %}
{% block mainpage %}{% endblock %}
</div>
<footer>
<nav class="navbar navbar-dark bg-dark navbar-expand">
<div class="container-fluid">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://github.com/Findus23/RPGnotes/tree/{% commit_id %}"
target="_blank" rel="noopener" title="{% commit_id %}">
Source
</a>
</li>
<li class="nav-item">
{% if user.is_authenticated %}
<a class="nav-link" href="{% url "logout" %}">{% translate "Log out" %}</a>
{% else %}
<a class="nav-link" href="{% url "login" %}">{% translate "Log in" %}</a>
{% endif %}
</ul>
</div>
</nav>
</footer>
<script src="{% static "libs/bootstrap.min.js" %}"></script>
<script src="{% static "libs/luminous.min.js" %}"></script>
<script nonce="{{ request.csp_nonce }}">
document.addEventListener('DOMContentLoaded', function () {
const galleries = document.querySelectorAll("a.image-viewer");
console.info(galleries)
new LuminousGallery(galleries)
});
</script>
{% if sentry_event_id %}
<script src="{% static "libs/bundle.min.js" %}"></script>
<script nonce="{{ request.csp_nonce }}">
Sentry.init({dsn: "{{ sentry_dsn }}"});
{% get_current_language as LANGUAGE_CODE %}
Sentry.showReportDialog({eventId: "{{ sentry_event_id }}", lang: "{{ LANGUAGE_CODE }}"});
</script>
{% endif %}
{% block extra_js %}{% endblock %}
</body>
</html>

View file

@ -54,8 +54,7 @@
<script src="{{ static("libs/bundle.min.js") }}"></script> <script src="{{ static("libs/bundle.min.js") }}"></script>
<script nonce="{{ request.csp_nonce }}"> <script nonce="{{ request.csp_nonce }}">
Sentry.init({dsn: "{{ sentry_dsn }}"}); Sentry.init({dsn: "{{ sentry_dsn }}"});
{# {% get_current_language as LANGUAGE_CODE %}#} Sentry.showReportDialog({eventId: "{{ sentry_event_id }}", lang: "{{ language_code() }}"});
Sentry.showReportDialog({eventId: "{{ sentry_event_id }}"});
</script> </script>
{% endif %} {% endif %}
{% block extra_js %}{% endblock %} {% block extra_js %}{% endblock %}

View file

@ -1,6 +1,4 @@
{% extends 'tenantbase.html' %} {% extends 'tenantbase.jinja' %}
{% load django_bootstrap5 %}
{% load static %}
{% block heading %} {% block heading %}
<h1>Delete Object</h1> <h1>Delete Object</h1>
@ -11,4 +9,5 @@
<form method="post">{% csrf_token %} <form method="post">{% csrf_token %}
<p>Are you sure you want to delete "{{ object }}"?</p> <p>Are you sure you want to delete "{{ object }}"?</p>
<input class="btn btn-primary" type="submit" value="Confirm"> <input class="btn btn-primary" type="submit" value="Confirm">
</form>{% endblock %} </form>
{% endblock %}

View file

@ -1,22 +0,0 @@
{% extends "tenantbase.html" %}
{% load i18n %}
{% block content %}
<h1>{% translate "Change Language" %}</h1>
<form action="{% url 'set_language' %}" method="post">{% csrf_token %}
<div class="input-group">
<select name="language" class="form-select">
{% 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{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-outline-secondary">{% translate "Save" %}</button>
</div>
</form>
{% endblock %}

View file

@ -0,0 +1,20 @@
{% extends "tenantbase.jinja" %}
{% block title %}{{ _("Change Language") }} - RPGnotes{% endblock %}
{% block content %}
<h1>{{ _("Change Language") }}</h1>
<form action="{{ url("set_language") }}" method="post">{% csrf_token %}
<div class="input-group">
<select name="language" class="form-select">
{% set current_langcode=language_code() %}
{% for code,language in all_languages() %}
<option value="{{ code }}"{% if code == current_langcode %} selected{% endif %}>
{{ language }} ({{ code }})
</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-outline-secondary">{{ _("Save") }}</button>
</div>
</form>
{% endblock %}

View file

@ -0,0 +1,31 @@
{% macro character_pillar(character) %}
<li class="nav-item">
<div class="side-card">
<div class="image-col">
{% if character.smaller_image %}
{% set im=thumbnail(character.smaller_image, "48x48", crop="center") %}
<img class="avatar avatar-image rounded-circle" src="{{ im.url }}" width="{{ im.width }}"
height="{{ im.height }}"
srcset="{{ im.url|srcset }}">
{% else %}
<div class="avatar avatar-text"
style="background: {{ character.color }};color:{{ character.text_color }}">{{ character.initials }}</div>
{% endif %}
</div>
<div class="text-col">
<a class="stretched-link"
href="{{ character.get_absolute_url() }}">
{{ character.name }}
</a>
<div>{{ character.subtitle }}</div>
</div>
</div>
</li>
{% endmacro %}
{% macro last_edited(obj) %}
<div>
<small>{{ _("Last updated") }}: {{ obj.last_modified|naturaltime }}
{{ _("by") }} {{ obj.history.first().history_user }} </small>
</div>
{% endmacro %}

View file

@ -1,25 +0,0 @@
{% load thumbutils %}
{% load thumbnail %}
<li class="nav-item">
<div class="side-card">
<div class="image-col">
{% if character.smaller_image %}
{% thumbnail character.smaller_image "48x48" crop="center" as im %}
<img class="avatar avatar-image rounded-circle" src="{{ im.url }}" width="{{ im.width }}"
height="{{ im.height }}"
srcset="{{ im.url|srcset }}">
{% endthumbnail %}
{% else %}
<div class="avatar avatar-text"
style="background: {{ character.color }};color:{{ character.text_color }}">{{ character.initials }}</div>
{% endif %}
</div>
<div class="text-col">
<a class="stretched-link"
href="{{ character.get_absolute_url }}">
{{ character.name }}
</a>
<div>{{ character.subtitle }}</div>
</div>
</div>
</li>

View file

@ -1,8 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block mainpage %}
<h1>{% translate "Activation failed" %}</h1>
<p>Maybe this activation link has already been clicked before.</p>
{% endblock %}

View file

@ -0,0 +1,8 @@
{% extends 'base.jinja' %}
{% load i18n %}
{% block mainpage %}
<h1>{% trans %}Activation failed{% endtrans %} </h1>
<p>{% trans %}Maybe this activation link has already been clicked before.{% endtrans %} </p>
{% endblock %}

View file

@ -1,28 +0,0 @@
{% extends "base.html" %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block mainpage %}
<h1>{% translate "Login" %}</h1>
{% if next %}
<div class="alert alert-info">
{% blocktranslate %}You need to log in before you can access <code>{{ next }}</code>.{% endblocktranslate %}
</div>
{% endif %}
<form method="post" class="form">
{% csrf_token %}
{% bootstrap_form form %}
{% url 'admin_password_reset' as password_reset_url %}
<div class="password-reset-link">
<a href="{% url 'password_reset' %}">{% translate "Forgotten your password or username?" %}</a>
</div>
<button type="submit" class="btn btn-lg btn-primary btn-block">
{% translate "Log in" %}
</button>
</form>
{% endblock %}

View file

@ -0,0 +1,24 @@
{% extends "base.jinja" %}
{% block mainpage %}
<h1>{{ _("Login") }}</h1>
{% if next %}
<div class="alert alert-info">
{% trans %}You need to log in before you can access <code>{{ next }}</code>.{% endtrans %}
</div>
{% endif %}
<form method="post" class="form">
{% csrf_token %}
{{ bootstrap_form(form) }}
<div class="password-reset-link">
<a href="{{ url("password_reset") }}">{% trans %}Forgotten your password or username?{% endtrans %} </a>
</div>
<button type="submit" class="btn btn-lg btn-primary btn-block">
{{ _("Log in") }}
</button>
</form>
{% endblock %}

View file

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block mainpage %}
<h1>{% translate "Registration closed" %}</h1>
{% endblock %}

View file

@ -0,0 +1,6 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Registration closed") }}</h1>
{% endblock %}

View file

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% block mainpage %}
<h1>{% translate "Registration complete" %}</h1>
{% endblock %}

View file

@ -0,0 +1,6 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Registration complete") }}</h1>
{% endblock %}

View file

@ -1,15 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block mainpage %}
<h1>{% translate "Registration" %}</h1>
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<input type="submit" class="btn btn-primary" value="{% translate "Save" %}">
</form>
{% endblock %}

View file

@ -0,0 +1,11 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Registration") }}</h1>
<form method="post">
{% csrf_token %}
{{ bootstrap_form(form) }}
<input type="submit" class="btn btn-primary" value="{{ _("Save") }}">
</form>
{% endblock %}

View file

@ -1,77 +0,0 @@
{% extends "base.html" %}
{% load urls %}
{% load i18n %}
{% load version %}
{% block title %}{{ object }}{% endblock %}
{% block mainpage %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
{% with url_name=request.resolver_match.url_name %}
<li class="nav-item">
<a class="nav-link {% if url_name == 'campaigndetail' %}active{% endif %}"
href="{% url "campaigndetail" %}">{% translate "Home" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'characterdetail' %}active{% endif %}"
href="{% url "characterlist" %}">{% translate "Characters" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'locationdetail' %}active{% endif %}"
href="{% url "locationlist" %}">{% translate "Locations" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'notedetail' %}active{% endif %}"
href="{% url "notelist" %}">{% translate "Notes" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'factiondetail' %}active{% endif %}"
href="{% url "factionlist" %}">{% translate "Factions" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'daydetail' %}active{% endif %}"
href="{% url "daylist" %}">{% translate "Timeline" %}</a>
</li>
<li class="nav-item">
<a class="nav-link {% if url_name == 'lootlist' %}active{% endif %}"
href="{% url "lootlist" %}">{% translate "Loot" %}</a>
</li>
{% endwith %}
</ul>
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a href="#" class="navbar-text nav-link dropdown-toggle" id="navbarDropdown" role="button"
data-bs-toggle="dropdown"
aria-expanded="false">{{ user }}</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item"
href="{% url "change_language" %}">{% translate "Change Language" %}</a></li>
{% if user.is_staff %}
<li><a class="dropdown-item" href="/admin/">Admin</a></li>
{% endif %}
<li><a class="dropdown-item"
href="{% main_url %}/profile/">{% translate "Edit User Account" %}</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="{% url "logout" %}">{% translate "Log out" %}</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
{% block heading %}{% endblock %}
{% block content %}
{% endblock %}
{% endblock %}

View file

@ -55,8 +55,8 @@
{% if user.is_staff %} {% if user.is_staff %}
<li><a class="dropdown-item" href="/admin/">Admin</a></li> <li><a class="dropdown-item" href="/admin/">Admin</a></li>
{% endif %} {% endif %}
{# <li><a class="dropdown-item"#} <li><a class="dropdown-item"
{# href="{% main_url %}/profile/">{% trans %}Edit User Account{% endtrans %}</a></li>#} href="{{ main_url() }}/profile/">{% trans %}Edit User Account{% endtrans %}</a></li>
<li> <li>
<hr class="dropdown-divider"> <hr class="dropdown-divider">
</li> </li>

View file

@ -1,16 +0,0 @@
{% extends 'base.html' %}
{% load i18n %}
{% load django_bootstrap5 %}
{% load static %}
{% block mainpage %}
<h1>{% translate "Edit User Account" %}</h1>
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<input type="submit" class="btn btn-primary" value="{% translate "Save" %}">
</form>
{% endblock %}

View file

@ -0,0 +1,13 @@
{% extends 'base.jinja' %}
{% block mainpage %}
<h1>{{ _("Edit User Account") }}</h1>
<form method="post">
{{ csrf_token }}
{{ bootstrap_form(form) }}
<input type="submit" class="btn btn-primary" value="{{ _("Save") }}">
</form>
{% endblock %}

View file

@ -17,7 +17,7 @@ urlpatterns = [
path( path(
"register/closed/", "register/closed/",
TemplateView.as_view( TemplateView.as_view(
template_name="registration/registration_closed.html" template_name="registration/registration_closed.jinja"
), ),
name="django_registration_disallowed", name="django_registration_disallowed",
), ),

View file

@ -13,7 +13,7 @@ from users.models import TenantUser
class CustomRegistrationView(RegistrationView): class CustomRegistrationView(RegistrationView):
email_body_template = "registration/activation_email_body.html" email_body_template = "registration/activation_email_body.html"
email_subject_template = "registration/activation_email_subject.html" email_subject_template = "registration/activation_email_subject.html"
template_name = "registration/registration_form.html" template_name = "registration/registration_form.jinja"
form_class = CustomRegistrationForm form_class = CustomRegistrationForm
success_url = reverse_lazy("login") success_url = reverse_lazy("login")
@ -40,7 +40,7 @@ class CustomRegistrationView(RegistrationView):
class CustomActivationView(ActivationView): class CustomActivationView(ActivationView):
success_url = reverse_lazy("login") success_url = reverse_lazy("login")
template_name = "registration/activation_failed.html" template_name = "registration/activation_failed.jinja"
def activate(self, *args, **kwargs): def activate(self, *args, **kwargs):
username = self.validate_key(kwargs.get("activation_key")) username = self.validate_key(kwargs.get("activation_key"))
@ -54,7 +54,7 @@ class CustomActivationView(ActivationView):
class UserEditView(SuccessMessageMixin, UpdateView): class UserEditView(SuccessMessageMixin, UpdateView):
template_name = "users/edit.html" template_name = "users/edit.jinja"
model = TenantUser model = TenantUser
form_class = CustomUserChangeForm form_class = CustomUserChangeForm
success_url = "/" success_url = "/"