[ticket/17359] Get rid of template code duplication

PHPBB-17359
This commit is contained in:
rxu 2024-07-01 00:54:20 +07:00
parent 8aef7b5659
commit e53db0775a
No known key found for this signature in database
GPG key ID: 955F0567380E586A

View file

@ -42,87 +42,52 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<!-- IF .enabled --> {% for list in ['enabled', 'disabled', 'available'] %}
<tr> {% set blockname = attribute(loops, list) %}
<td class="row3" colspan="4"><strong>{L_EXTENSIONS_ENABLED}</strong><!-- EVENT acp_ext_list_enabled_title_after --></td> {% if blockname|length %}
</tr> <tr>
<!-- BEGIN enabled --> <td class="row3" colspan="4"><strong>{{ lang('EXTENSIONS_' ~ list|upper) }}</strong>
<tr class="ext_enabled row-highlight"> {% if list == 'enabled' %}
<td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_enabled_name_after --></td> {% EVENT acp_ext_list_enabled_title_after %}
<td style="text-align: center;"> {% elseif list == 'disabled' %}
<!-- IF enabled.S_VERSIONCHECK --> {% EVENT acp_ext_list_disabled_title_after %}
<strong class="<!-- IF enabled.S_UP_TO_DATE -->current-ext<!-- ELSE -->outdated-ext<!-- ENDIF -->">{enabled.META_VERSION}</strong> {% elseif list == 'available' %}
<!-- IF not enabled.S_UP_TO_DATE --><i class="fa fa-exclamation-circle outdated-ext" aria-hidden="true"></i><!-- ENDIF --> {% EVENT acp_ext_list_available_title_after %}
<!-- ELSE --> {% endif %}
{enabled.META_VERSION} </td>
<!-- ENDIF --> </tr>
</td> {% for data in blockname %}
<td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td> <tr class="ext_{{ list }} row-highlight">
<td style="text-align: center;"> <td><strong title="{{ data.NAME }}">{{ data.META_DISPLAY_NAME }}</strong>
<!-- BEGIN actions --> {% if list == 'enabled' %}
<a href="{enabled.actions.U_ACTION}"<!-- IF enabled.actions.L_ACTION_EXPLAIN --> title="{enabled.actions.L_ACTION_EXPLAIN}"<!-- ENDIF -->>{enabled.actions.L_ACTION}</a> {% EVENT acp_ext_list_enabled_name_after %}
<!-- IF not enabled.actions.S_LAST_ROW -->&nbsp;|&nbsp;<!-- ENDIF --> {% elseif list == 'disabled' %}
<!-- END actions --> {% EVENT acp_ext_list_disabled_name_after %}
</td> {% elseif list == 'available' %}
</tr> {% EVENT acp_ext_list_available_name_after %}
<!-- END enabled --> {% endif %}
<!-- ENDIF --> </td>
<td style="text-align: center;">
<!-- IF .disabled --> {% if data.S_VERSIONCHECK %}
<tr> <strong class="{% if data.S_UP_TO_DATE %}current-ext{% else %}outdated-ext{% endif %}">{{ data.META_VERSION }}</strong>
<td class="row3" colspan="4"><strong>{L_EXTENSIONS_DISABLED}</strong><!-- EVENT acp_ext_list_disabled_title_after --></td> {% if not data.S_UP_TO_DATE %}<i class="fa fa-exclamation-circle outdated-ext" aria-hidden="true"></i>{% endif %}
</tr> {% else %}
<!-- BEGIN disabled --> {{ data.META_VERSION }}
<tr class="ext_disabled row-highlight"> {% endif %}
<td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_disabled_name_after --></td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
<!-- IF disabled.S_VERSIONCHECK --> {% if data.U_DETAILS %}<a href="{{ data.U_DETAILS }}">{{ lang ('DETAILS') }}</a>{% endif %}
<strong class="<!-- IF disabled.S_UP_TO_DATE -->current-ext<!-- ELSE -->outdated-ext<!-- ENDIF -->">{disabled.META_VERSION}</strong> </td>
<!-- IF not disabled.S_UP_TO_DATE --><i class="fa fa-exclamation-circle outdated-ext" aria-hidden="true"></i><!-- ENDIF --> <td style="text-align: center;">
<!-- ELSE --> {% for actions in data.actions %}
{disabled.META_VERSION} <a href="{{ actions.U_ACTION }}"{% if actions.L_ACTION_EXPLAIN %} title="{{ actions.L_ACTION_EXPLAIN }}"{% endif %}>{{ actions.L_ACTION }}</a>
<!-- ENDIF --> {% if not actions.S_LAST_ROW %}&nbsp;|&nbsp;{% endif %}
</td> {% endfor %}
<td style="text-align: center;"> </td>
<!-- IF disabled.U_DETAILS --><a href="{disabled.U_DETAILS}">{L_DETAILS}</a><!-- ENDIF --> </tr>
</td> {% endfor %}
<td style="text-align: center;"> {% endif %}
<!-- BEGIN actions --> {% endfor %}
<a href="{disabled.actions.U_ACTION}"<!-- IF disabled.actions.L_ACTION_EXPLAIN --> title="{disabled.actions.L_ACTION_EXPLAIN}"<!-- ENDIF -->>{disabled.actions.L_ACTION}</a>
<!-- IF not disabled.actions.S_LAST_ROW -->&nbsp;|&nbsp;<!-- ENDIF -->
<!-- END actions -->
</td>
</tr>
<!-- END disabled -->
<!-- ENDIF -->
<!-- IF .available -->
<tr>
<td class="row3" colspan="4"><strong>{L_EXTENSIONS_AVAILABLE}</strong><!-- EVENT acp_ext_list_available_title_after --></td>
</tr>
<!-- BEGIN available -->
<tr class="ext_available row-highlight">
<td><strong title="{available.NAME}">{available.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_available_name_after --></td>
<td style="text-align: center;">
<!-- IF available.S_VERSIONCHECK -->
<strong class="<!-- IF available.S_UP_TO_DATE -->current-ext<!-- ELSE -->outdated-ext<!-- ENDIF -->">{available.META_VERSION}</strong>
<!-- IF not available.S_UP_TO_DATE --><i class="fa fa-exclamation-circle outdated-ext" aria-hidden="true"></i><!-- ENDIF -->
<!-- ELSE -->
{available.META_VERSION}
<!-- ENDIF -->
</td>
<td style="text-align: center;">
<!-- IF available.U_DETAILS --><a href="{available.U_DETAILS}">{L_DETAILS}</a><!-- ENDIF -->
</td>
<td style="text-align: center;">
<!-- BEGIN actions -->
<a href="{available.actions.U_ACTION}"<!-- IF available.actions.L_ACTION_EXPLAIN --> title="{available.actions.L_ACTION_EXPLAIN}"<!-- ENDIF -->>{available.actions.L_ACTION}</a>
<!-- IF not available.actions.S_LAST_ROW -->&nbsp;|&nbsp;<!-- ENDIF -->
<!-- END actions -->
</td>
</tr>
<!-- END available -->
<!-- ENDIF -->
</tbody> </tbody>
</table> </table>