Skip to content

Commit

Permalink
Refactor URLs and templates for improved readability and maintainability
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersSeverinsen committed Dec 27, 2024
1 parent 13d6ad9 commit 01c3487
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion bartenders/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def send_confirmation_email(self, pk):
Telefonnummer: {phoneNumber}
{extra_info}
/snek""",
/Bestyrelsen""",
text_format={**d},
html_format={
**d,
Expand Down
4 changes: 2 additions & 2 deletions bartenders/templates/barplan.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h2 id="barplan">{% translate "Barplan" %}</h2>
</span>
</div>

<a href="/barplan/shifts.ics">iCal feed</a>
<a href="{% url 'shifts_feed' %}">iCal feed</a>

<hr>

Expand Down Expand Up @@ -172,7 +172,7 @@ <h2 id="pantvagter">{% translate "Pantvagter" %}</h2>
</span>
</div>

<a href="/barplan/deposit_shifts.ics">iCal feed</a>
<a href="{% url 'deposit_shifts_feed' %}">iCal feed</a>

<script>
$('b').hover(function(e){
Expand Down
40 changes: 19 additions & 21 deletions web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
<a href="/{{ LANGUAGE_CODE }}/">
<a href="/">
<h1>
<img src="{% static 'images/logo.png' %}" height="50" class="logo">
Fredagscaféen
Expand Down Expand Up @@ -71,46 +71,44 @@ <h1>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/{{ LANGUAGE_CODE }}/">{% translate "Forside" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/barplan">{% translate "Barplan" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/bartenders">{% translate "Bartendere" %}</a></li>
<!--<li><a href="/prices">Sortiment</a></li>-->
<li><a href="/">{% translate "Forside" %}</a></li>
<li><a href="{% url 'barplan' %}">{% translate "Barplan" %}</a></li>
<li><a href="{% url 'bartenders' %}">{% translate "Bartendere" %}</a></li>
<li><a href="{% url 'prices' %}">{% translate "Sortiment" %}</a></li>

<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% translate "Udlejning" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/{{ LANGUAGE_CODE }}/udlejning">{% translate "Udlejning af fadølsanlæg" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/udlejningGrill">{% translate "Udlejning af grill" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/udlejningProjector">{% translate "Udlejning af projektor" %} &amp; {% translate "lærred" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/udlejningSpeakers">{% translate "Udlejning af højtalere" %}</a></li>
<li><a href="{% url 'udlejning' %}">{% translate "Udlejning af fadølsanlæg" %}</a></li>
<li><a href="{% url 'udlejningGrill' %}">{% translate "Udlejning af grill" %}</a></li>
<li><a href="{% url 'udlejningProjector' %}">{% translate "Udlejning af projektor" %} &amp; {% translate "lærred" %}</a></li>
<li><a href="{% url 'udlejningSpeakers' %}">{% translate "Udlejning af højtalere" %}</a></li>
</ul>
</li>

<li><a href="/{{ LANGUAGE_CODE }}/guides">{% translate "Guides" %}</a></li>
<!--<li><a href="https://www.facebook.com/fredagscafeen.dk/" target="_blank" rel="noopener"><span class="glyphicon glyphicon-new-window"></span> Facebook</a></li>-->
<li><a href="/{{ LANGUAGE_CODE }}/board">{% translate "Bestyrelsen" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/events">{% translate "Events" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/gallery">{% translate "Gallery" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/prices">{% translate "Sortiment" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/about">{% translate "Om baren" %}</a></li>
<li><a href="{% url 'guides' %}">{% translate "Guides" %}</a></li>
<li><a href="{% url 'board' %}">{% translate "Bestyrelsen" %}</a></li>
<li><a href="{% url 'events' %}">{% translate "Events" %}</a></li>
<li><a href="{% url 'gallery_index' %}">{% translate "Gallery" %}</a></li>
<li><a href="{% url 'prices' %}">{% translate "Sortiment" %}</a></li>
<li><a href="{% url 'about' %}">{% translate "Om baren" %}</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% translate "Profil" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/{{ LANGUAGE_CODE }}/bartab">{% translate "Krydlistestatus" %}</a></li>
<li><a href="{% url 'bartab' %}">{% translate "Krydlistestatus" %}</a></li>
<li class="divider"></li>
<li><a href="/{{ LANGUAGE_CODE }}/profile">{% translate "Bartenderprofil" %}</a></li>
<li><a href="{% url 'profile' %}">{% translate "Bartenderprofil" %}</a></li>
</ul>
</li>
<li><a href="/{{ LANGUAGE_CODE }}/admin">{% translate "Admin" %}</a></li>
<li><a href="/{{ LANGUAGE_CODE }}/admin/">{% translate "Admin" %}</a></li>
</ul>
{% if user.is_authenticated %}
<form action="/{{ LANGUAGE_CODE }}/logout/" method="post">
<form action="{% url 'logout' %}logout" method="post">
{% csrf_token %}
<button type="submit" style="background-color: None; color: #c3c3c3;" class="btn navbar-btn pull-right">{% translate "Log ud" %}</button>
</form>
{% endif %}
</div>

</div>
</nav>

Expand Down
18 changes: 10 additions & 8 deletions web/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
from web.views import About, Login, email_login_view, logout_view

urlpatterns = [
path("about/", About.as_view()),
path("bartenders/", BartenderList.as_view()),
path("about/", About.as_view(), name="about"),
path("bartenders/", BartenderList.as_view(), name="bartenders"),
path("barplan/", Barplan.as_view(), name="barplan"),
path("barplan/shifts.ics", UserBarplan()),
path("barplan/shifts.ics", UserBarplan(), name="shifts_feed"),
path("barplan/shifts/<username>.ics", UserBarplan(), name="user_shifts"),
path("barplan/deposit_shifts.ics", UserDepositShifts()),
path("barplan/deposit_shifts.ics", UserDepositShifts(), name="deposit_shifts_feed"),
path("barplan/deposit_shifts/<username>.ics", UserDepositShifts()),
path(
"barplan/<username>/", RedirectView.as_view(pattern_name="user_shifts")
Expand All @@ -49,10 +49,12 @@
path("login/", Login.as_view(), name="login"),
path("login/<email>/<token>/", email_login_view, name="email_login"),
path("logout/", logout_view, name="logout"),
path("udlejning/", Udlejninger.as_view()),
path("udlejningGrill/", UdlejningerGrill.as_view()),
path("udlejningProjector/", UdlejningerProjector.as_view()),
path("udlejningSpeakers/", UdlejningerSpeakers.as_view()),
path("udlejning/", Udlejninger.as_view(), name="udlejning"),
path("udlejningGrill/", UdlejningerGrill.as_view(), name="udlejningGrill"),
path(
"udlejningProjector/", UdlejningerProjector.as_view(), name="udlejningProjector"
),
path("udlejningSpeakers/", UdlejningerSpeakers.as_view(), name="udlejningSpeakers"),
path("guides/", Guides.as_view(), name="guides"),
path("gallery/", include("gallery.urls")),
]

0 comments on commit 01c3487

Please sign in to comment.