Skip to content

Commit

Permalink
Use modern if template tag syntax
Browse files Browse the repository at this point in the history
For a long time, Django has supported this more natural syntax for
conditionals, so now we can use it too!
  • Loading branch information
SteveMarshall committed Apr 1, 2024
1 parent 0b2e7cb commit 379b00f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions global/templates/_base/masthead.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ <h1>Spacelog</h1>

<nav>
<ul>
{% ifequal page "about" %}
{% if page == "about" %}
<li><span class="current">About</span></li>
{% else %}
<li><a href="/about/">About</a></li>
{% endifequal %}
{% ifequal page "press" %}
{% endif %}
{% if page == "press" %}
<li><span class="current">Press</span></li>
{% else %}
<li><a href="/press/">Press</a></li>
{% endifequal %}
{% ifequal page "get-involved" %}
{% endif %}
{% if page == "get-involved" %}
<li><span class="current">Get Involved</span></li>
{% else %}
<li><a href="/get-involved/">Get Involved</a></li>
{% endifequal %}
{% endif %}
</ul>
</nav>

Expand Down
4 changes: 2 additions & 2 deletions website/templates/homepage/homepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ <h2>Jump into the story</h2>
<ol>
{% for number, act in acts %}
<li>
{% ifequal 1 number %}
{% if 1 == number %}
<a href='{% url "view_page" %}'>
{% else %}
<a href='{% timestamp_to_url act.start %}'>
{% endifequal %}
{% endif %}
{% if act.homepage %}
<img src="{% mission_static mission.name "images/homepage" act.homepage %}"
alt="" width="220" height="140"/>
Expand Down
4 changes: 2 additions & 2 deletions website/templates/homepage/memorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ <h1>{{ mission.upper_title }} <em>{{ mission.lower_title }}</em></h1>
{% for group in people %}
{% for person in group.members %}
{% cycle "<div class='group'>" "" "" %}
{% ifequal group.view "full" %}
{% if group.view == "full" %}
{% include "people/_person.html" %}
{% else %}
{% include "people/_simple_person.html" %}
{% endifequal %}
{% endif %}
{% cycle "" "" "</div>" %}
{% endfor %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions website/templates/people/people.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ <h1>People</h1>
<h2>{{ group.name }}</h2>
{% for person in group.members %}
{% cycle "<div class='group'>" "" "" %}
{% ifequal group.view "full" %}
{% if group.view == "full" %}
{% include "people/_person.html" %}
{% else %}
{% include "people/_simple_person.html" %}
{% endifequal %}
{% endif %}
{% cycle "" "" "</div>" %}
{% endfor %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions website/templates/transcripts/phases.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ <h2>Phase:</h2>

<div class='details'>
<h1>{{ act.title }}</h1>
{% ifequal act.number 0 %}
{% if act.number == 0 %}
<a class='league-gothic read-button' href="{% url "view_page" %}">Start reading</a>
{% else %}
<a class='league-gothic read-button' href="{% timestamp_to_url act.start %}">Start reading</a>
{% endifequal %}
{% endif %}

<p class='description'>{{ act.description|linkify }}</p>

Expand Down

0 comments on commit 379b00f

Please sign in to comment.