Browse Source

Based on #157 and #158, revert back to existence checks and length rather than default empty array initialization for ease of reading

pull/40/head
Benjamin Southall 5 years ago
parent
commit
8dfdc5e335
  1. 2
      templates/mod/inbox.html
  2. 2
      templates/mod/themes.html
  3. 2
      templates/mod/user.html
  4. 6
      templates/mod/view_ip.html
  5. 2
      templates/themes/basic/index.html
  6. 2
      templates/themes/categories/news.html
  7. 2
      templates/themes/frameset/news.html
  8. 2
      templates/themes/recent/recent.html

2
templates/mod/inbox.html

@ -1,4 +1,4 @@
{% if messages|default([])|length == 0 %} {% if not messages %}
<p style="text-align:center" class="unimportant">({% trans 'No private messages for you.' %})</p> <p style="text-align:center" class="unimportant">({% trans 'No private messages for you.' %})</p>
{% else %} {% else %}
<table class="modlog"> <table class="modlog">

2
templates/mod/themes.html

@ -1,4 +1,4 @@
{% if themes|default([])|length == 0 %} {% if not themes %}
<p style="text-align:center" class="unimportant">({% trans 'There are no themes available.' %})</p> <p style="text-align:center" class="unimportant">({% trans 'There are no themes available.' %})</p>
{% else %} {% else %}
<table class="modlog"> <table class="modlog">

2
templates/mod/user.html

@ -87,7 +87,7 @@
</ul> </ul>
</form> </form>
{% if logs|default([])|length > 0 %} {% if logs and logslength > 0 %}
<table class="modlog" style="width:600px"> <table class="modlog" style="width:600px">
<tr> <tr>
<th>{% trans 'IP address' %}</th> <th>{% trans 'IP address' %}</th>

6
templates/mod/view_ip.html

@ -18,7 +18,7 @@
<legend>{{ notes|count }} {% trans notes_on_record %}</legend> <legend>{{ notes|count }} {% trans notes_on_record %}</legend>
</legend> </legend>
{% if notes|default([])|length > 0 %} {% if notes and noteslength > 0 %}
<table class="modlog"> <table class="modlog">
<tr> <tr>
<th>{% trans 'Staff' %}</th> <th>{% trans 'Staff' %}</th>
@ -81,7 +81,7 @@
</fieldset> </fieldset>
{% endif %} {% endif %}
{% if bans|default([])|length > 0 and mod|hasPermission(config.mod.view_ban) %} {% if bans and bans|length > 0 and mod|hasPermission(config.mod.view_ban) %}
<fieldset id="bans"> <fieldset id="bans">
{% set bans_on_record = 'ban' ~ (bans|count != 1 ? 's' : '') ~ ' on record' %} {% set bans_on_record = 'ban' ~ (bans|count != 1 ? 's' : '') ~ ' on record' %}
<legend>{{ bans|count }} {% trans bans_on_record %}</legend> <legend>{{ bans|count }} {% trans bans_on_record %}</legend>
@ -174,7 +174,7 @@
</fieldset> </fieldset>
{% endif %} {% endif %}
{% if logs|default([])|length > 0 %} {% if logs and logs|length > 0 %}
<fieldset id="history"> <fieldset id="history">
<legend>History</legend> <legend>History</legend>
<table class="modlog" style="width:100%"> <table class="modlog" style="width:100%">

2
templates/themes/basic/index.html

@ -24,7 +24,7 @@
<img src="static/lain_is_cute_datass_small_teal.png" alt="mascot"/> <img src="static/lain_is_cute_datass_small_teal.png" alt="mascot"/>
</center> </center>
<div class="ban"> <div class="ban">
{% if news|default([])|length == 0 %} {% if not news %}
<p style="text-align:center" class="unimportant">(No news to show.)</p> <p style="text-align:center" class="unimportant">(No news to show.)</p>
{% else %} {% else %}
{% for entry in news %} {% for entry in news %}

2
templates/themes/categories/news.html

@ -14,7 +14,7 @@
</header> </header>
<div class="ban"> <div class="ban">
{% if news|default([])|length == 0 %} {% if not news %}
<p style="text-align:center" class="unimportant">{% trans %}(No news to show.){% endtrans %}</p> <p style="text-align:center" class="unimportant">{% trans %}(No news to show.){% endtrans %}</p>
{% else %} {% else %}
{% for entry in news %} {% for entry in news %}

2
templates/themes/frameset/news.html

@ -13,7 +13,7 @@
</header> </header>
<div class="ban"> <div class="ban">
{% if news|default([])|length == 0 %} {% if not news %}
<p style="text-align:center" class="unimportant">(No news to show.)</p> <p style="text-align:center" class="unimportant">(No news to show.)</p>
{% else %} {% else %}
{% for entry in news %} {% for entry in news %}

2
templates/themes/recent/recent.html

@ -36,7 +36,7 @@
<br> <br>
<div class="ban" id="global3"> <div class="ban" id="global3">
<h2>Latest News</h2> <h2>Latest News</h2>
{% if recent_news|default([])|length == 0 %} {% if not recent_news %}
<p style="text-align:center" class="unimportant">(No news to show.)</p> <p style="text-align:center" class="unimportant">(No news to show.)</p>
{% else %} {% else %}
{% for entry in recent_news %} {% for entry in recent_news %}

Loading…
Cancel
Save