Block definitions should be at the top level, not the included level

This commit is contained in:
2023-06-05 11:52:09 +01:00
parent 9b229fc6ee
commit 83bf9a7307
29 changed files with 99 additions and 93 deletions

View File

@@ -14,4 +14,4 @@ Fixes/tweaks a few "issues" with the default UserFrosting installation, includin
- Added 'hasRole' twig function to check if a user has a role (if a role doesn't exist, always returns false) - Added 'hasRole' twig function to check if a user has a role (if a role doesn't exist, always returns false)
- Added 'Auditer' role and split the activities permission away from site-admins (exclusive only) and everyone else - Added 'Auditer' role and split the activities permission away from site-admins (exclusive only) and everyone else
- Made the input elements on the account settings page more in line with the other inputs (including the "hidden" and "disabled" mechanisms) - Made the input elements on the account settings page more in line with the other inputs (including the "hidden" and "disabled" mechanisms)
- Update the "User" form to use the partial form elements for common styling with accounts page - Updated all* forms to use partial form elements.

View File

@@ -1,11 +1,19 @@
{% extends "@admin/forms/group.html.twig" %} {% extends "@admin/forms/group.html.twig" %}
{% block group_form %} {% block group_form %}
{% include "forms/inputs/group-name.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_group_name %}
{% include "forms/inputs/group-name.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/group-slug.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_group_slug %}
{% include "forms/inputs/group-slug.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/group-icon.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_group_icon %}
{% include "forms/inputs/group-icon.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/group-description.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_group_description %}
{% include "forms/inputs/group-description.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% endblock %} {% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_group_description %}
{% include "forms/inputs/abstract/description.html.twig" with {% include "forms/inputs/abstract/description.html.twig" with
{ {
"type" : "group", "type" : "group",
@@ -6,4 +5,3 @@
"col_width" : col_width "col_width" : col_width
} }
%} %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_group_icon %}
{% include "forms/inputs/abstract/icon.html.twig" with {% include "forms/inputs/abstract/icon.html.twig" with
{ {
"type" : "group", "type" : "group",
@@ -8,4 +7,3 @@
"col_width" : col_width "col_width" : col_width
} }
%} %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_group_name %}
{% include "forms/inputs/abstract/name.html.twig" with {% include "forms/inputs/abstract/name.html.twig" with
{ {
"type" : "group", "type" : "group",
@@ -8,4 +7,3 @@
"col_width" : col_width "col_width" : col_width
} }
%} %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_group_slug %}
{% include "forms/inputs/abstract/slug.html.twig" with {% include "forms/inputs/abstract/slug.html.twig" with
{ {
"type" : "group", "type" : "group",
@@ -6,4 +5,3 @@
"col_width" : col_width "col_width" : col_width
} }
%} %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_locale %}
{% if site.registration.captcha %} {% if site.registration.captcha %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -14,4 +13,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_register_locale %}
{% if 'locale' not in form.fields.hidden %} {% if 'locale' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -14,4 +13,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_locale %}
{% if 'locale' not in form.fields.hidden %} {% if 'locale' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<label for="input-register-first_name">{{translate('NAME_AND_EMAIL')}}</label> <label for="input-register-first_name">{{translate('NAME_AND_EMAIL')}}</label>
@@ -25,4 +24,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_password %}
{% if 'password' not in form.fields.hidden %} {% if 'password' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -11,4 +10,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_register_user_name %}
{% if 'user_name' not in form.fields.hidden %} {% if 'user_name' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -8,4 +7,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_role_description %}
{% include "forms/inputs/abstract/description.html.twig" with {% include "forms/inputs/abstract/description.html.twig" with
{ {
"type" : "role", "type" : "role",
@@ -6,4 +5,3 @@
"col_width" : col_width "col_width" : col_width
} }
%} %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_role_name %}
{% include "forms/inputs/abstract/name.html.twig" with {% include "forms/inputs/abstract/name.html.twig" with
{ {
"type" : "role", "type" : "role",
@@ -7,4 +6,3 @@
"col_width" : col_width "col_width" : col_width
} }
%} %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_role_slug %}
{% include "forms/inputs/abstract/slug.html.twig" with {% include "forms/inputs/abstract/slug.html.twig" with
{ {
"type" : "role", "type" : "role",
@@ -6,4 +5,3 @@
"col_width" : col_width "col_width" : col_width
} }
%} %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_current_password %}
{% if 'password' not in form.fields.hidden %} {% if 'password' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -10,4 +9,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_email %}
{% if 'email' not in form.fields.hidden %} {% if 'email' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -17,4 +16,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_first_name %}
{% if 'first_name' not in form.fields.hidden %} {% if 'first_name' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -10,4 +9,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_group %}
{% if 'group' not in form.fields.hidden %} {% if 'group' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -20,4 +19,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_last_name %}
{% if 'last_name' not in form.fields.hidden %} {% if 'last_name' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -10,4 +9,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_locale %}
{% if 'locale' not in form.fields.hidden %} {% if 'locale' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -18,4 +17,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_name %}
{% if 'name' not in form.fields.hidden %} {% if 'name' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="row"> <div class="row">
@@ -7,4 +6,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_new_password %}
{% if 'password' not in form.fields.hidden %} {% if 'password' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -17,4 +16,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_theme %}
{% if 'theme' not in form.fields.hidden %} {% if 'theme' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -18,4 +17,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -1,4 +1,3 @@
{% block input_user_user_name %}
{% if 'user_name' not in form.fields.hidden %} {% if 'user_name' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %} {% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group"> <div class="form-group">
@@ -10,4 +9,3 @@
</div> </div>
{% if col_width %}</div>{% endif %} {% if col_width %}</div>{% endif %}
{% endif %} {% endif %}
{% endblock %}

View File

@@ -5,21 +5,32 @@
<div class="row"> <div class="row">
{% block register_form %} {% block register_form %}
{% include "forms/inputs/register-name_email.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_register_name_email %}
{% include "forms/inputs/register-name_email.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/register-user_name.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_register_user_name %}
{% include "forms/inputs/register-user_name.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/register-password.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_register_password %}
{% include "forms/inputs/register-password.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/register-locale.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_register_locale %}
{% include "forms/inputs/register-locale.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/register-captcha.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_register_captcha %}
{% include "forms/inputs/register-captcha.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
<div class="col-sm-12 collapse"> <div class="col-sm-12 collapse">
<label>Spiderbro: Don't change me bro, I'm tryin'a catch some flies!</label> <label>Spiderbro: Don't change me bro, I'm tryin'a catch some flies!</label>
<input name="spiderbro" id="spiderbro" value="http://"/> <input name="spiderbro" id="spiderbro" value="http://"/>
</div> </div>
{% block tos %}
<div class="col-sm-12 text-left"> <div class="col-sm-12 text-left">
<p> <p>
{{translate('TOS_AGREEMENT', { {{translate('TOS_AGREEMENT', {
@@ -28,6 +39,7 @@
}) | raw}} }) | raw}}
</p> </p>
</div> </div>
{% endblock %}
{% endblock %} {% endblock %}
</div> </div>

View File

@@ -4,11 +4,17 @@
</div> </div>
<div class="row"> <div class="row">
{% block role_form %} {% block role_form %}
{% include "forms/inputs/role-name.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_role_name %}
{% include "forms/inputs/role-name.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/role-slug.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_role_slug %}
{% include "forms/inputs/role-slug.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/role-description.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_role_description %}
{% include "forms/inputs/role-description.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% endblock %} {% endblock %}
</div><br> </div><br>
<div class="row"> <div class="row">

View File

@@ -10,11 +10,15 @@
{% block settings_account %} {% block settings_account %}
<div class="row"> <div class="row">
{% include "forms/inputs/user-email.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_user_email %}
{% include "forms/inputs/user-email.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
</div> </div>
<div class="row"> <div class="row">
{% include "forms/inputs/user-new_password.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_user_new_password %}
{% include "forms/inputs/user-new_password.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
</div> </div>
{% if 'password' not in form.fields.hidden %} {% if 'password' not in form.fields.hidden %}
@@ -22,7 +26,9 @@
{% endif %} {% endif %}
<div class="row"> <div class="row">
{% include "forms/inputs/user-current_password.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_user_current_password %}
{% include "forms/inputs/user-current_password.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
</div> </div>
{% endblock %} {% endblock %}
</div> </div>

View File

@@ -7,11 +7,15 @@
{% block settings_profile %} {% block settings_profile %}
<div class="row"> <div class="row">
{% include "forms/inputs/user-name.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_user_name %}
{% include "forms/inputs/user-name.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
</div> </div>
<div class="row"> <div class="row">
{% include "forms/inputs/user-locale.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_user_locale %}
{% include "forms/inputs/user-locale.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
</div> </div>
{% endblock %} {% endblock %}
</div> </div>

View File

@@ -1,19 +1,33 @@
{% extends "@admin/forms/user.html.twig" %} {% extends "@admin/forms/user.html.twig" %}
{% block user_form %} {% block user_form %}
{% include "forms/inputs/user-user_name.html.twig" with { 'col_width': 'col-sm-6' } %} {% block input_user_user_name %}
{% include "forms/inputs/user-user_name.html.twig" with { 'col_width': 'col-sm-6' } %}
{% endblock %}
{% include "forms/inputs/user-group.html.twig" with { 'col_width': 'col-sm-6' } %} {% block input_user_group %}
{% include "forms/inputs/user-group.html.twig" with { 'col_width': 'col-sm-6' } %}
{% endblock %}
{% include "forms/inputs/user-name.html.twig" with { 'col_width': 'col-sm-12' } %} {% block input_user_name %}
{% include "forms/inputs/user-name.html.twig" with { 'col_width': 'col-sm-12' } %}
{% endblock %}
{% include "forms/inputs/user-email.html.twig" with { 'col_width': 'col-sm-6' } %} {% block input_user_email %}
{% include "forms/inputs/user-email.html.twig" with { 'col_width': 'col-sm-6' } %}
{% endblock %}
{% include "forms/inputs/user-theme.html.twig" with { 'col_width': 'col-sm-6' } %} {% block input_user_theme %}
{% include "forms/inputs/user-theme.html.twig" with { 'col_width': 'col-sm-6' } %}
{% endblock %}
{% include "forms/inputs/user-locale.html.twig" with { 'col_width': 'col-sm-6' } %} {% block input_user_locale %}
{% include "forms/inputs/user-locale.html.twig" with { 'col_width': 'col-sm-6' } %}
{% endblock %}
{% if 'password' not in form.fields.hidden %} {% block input_user_description %}
{% include "forms/partials/user-set-password.html.twig" %} {% if 'password' not in form.fields.hidden %}
{% endif %} {% include "forms/partials/user-set-password.html.twig" %}
{% endif %}
{% endblock %}
{% endblock %} {% endblock %}