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 '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)
- 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" %}
{% 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 %}

View File

@@ -1,9 +1,7 @@
{% block input_group_description %}
{% include "forms/inputs/abstract/description.html.twig" with
{
"type" : "group",
"current_value" : group.description,
"col_width" : col_width
}
%}
{% endblock %}
%}

View File

@@ -1,4 +1,3 @@
{% block input_group_icon %}
{% include "forms/inputs/abstract/icon.html.twig" with
{
"type" : "group",
@@ -7,5 +6,4 @@
"placeholder" : translate('GROUP.ICON_EXPLAIN'),
"col_width" : col_width
}
%}
{% endblock %}
%}

View File

@@ -1,4 +1,3 @@
{% block input_group_name %}
{% include "forms/inputs/abstract/name.html.twig" with
{
"type" : "group",
@@ -7,5 +6,4 @@
"placeholder" : translate('GROUP.NAME_EXPLAIN'),
"col_width" : col_width
}
%}
{% endblock %}
%}

View File

@@ -1,9 +1,7 @@
{% block input_group_slug %}
{% include "forms/inputs/abstract/slug.html.twig" with
{
"type" : "group",
"current_value" : group.slug,
"col_width" : col_width
}
%}
{% endblock %}
%}

View File

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

View File

@@ -1,4 +1,3 @@
{% block input_register_locale %}
{% if 'locale' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group">
@@ -13,5 +12,4 @@
<p class="help-block">{{translate("LOCALE.ACCOUNT")}}.</p>
</div>
{% if col_width %}</div>{% endif %}
{% endif %}
{% endblock %}
{% endif %}

View File

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

View File

@@ -1,4 +1,3 @@
{% block input_user_password %}
{% if 'password' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group">
@@ -10,5 +9,4 @@
<input type="password" id="input-register-passwordc" name="passwordc" placeholder="{{translate('PASSWORD.CONFIRM')}}" class="form-control">
</div>
{% if col_width %}</div>{% endif %}
{% endif %}
{% endblock %}
{% endif %}

View File

@@ -1,4 +1,3 @@
{% block input_register_user_name %}
{% if 'user_name' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="form-group">
@@ -7,5 +6,4 @@
<input type="text" id="input-register-username" name="user_name" placeholder="{{translate('USERNAME.CHOOSE')}}" class="form-control" autocomplete="off">
</div>
{% if col_width %}</div>{% endif %}
{% endif %}
{% endblock %}
{% endif %}

View File

@@ -1,9 +1,7 @@
{% block input_role_description %}
{% include "forms/inputs/abstract/description.html.twig" with
{
"type" : "role",
"current_value" : role.description,
"col_width" : col_width
}
%}
{% endblock %}
%}

View File

@@ -1,4 +1,3 @@
{% block input_role_name %}
{% include "forms/inputs/abstract/name.html.twig" with
{
"type" : "role",
@@ -6,5 +5,4 @@
"placeholder" : translate('ROLE.NAME_EXPLAIN'),
"col_width" : col_width
}
%}
{% endblock %}
%}

View File

@@ -1,9 +1,7 @@
{% block input_role_slug %}
{% include "forms/inputs/abstract/slug.html.twig" with
{
"type" : "role",
"current_value" : role.slug,
"col_width" : col_width
}
%}
{% endblock %}
%}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,3 @@
{% block input_user_name %}
{% if 'name' not in form.fields.hidden %}
{% if col_width %}<div class="{{col_width}}">{% endif %}
<div class="row">
@@ -6,5 +5,4 @@
{% include "forms/inputs/user-last_name.html.twig" with { 'col_width': 'col-sm-6' } %}
</div>
{% if col_width %}</div>{% endif %}
{% endif %}
{% endblock %}
{% endif %}

View File

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

View File

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

View File

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

View File

@@ -5,21 +5,32 @@
<div class="row">
{% 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">
<label>Spiderbro: Don't change me bro, I'm tryin'a catch some flies!</label>
<input name="spiderbro" id="spiderbro" value="http://"/>
</div>
{% block tos %}
<div class="col-sm-12 text-left">
<p>
{{translate('TOS_AGREEMENT', {
@@ -28,6 +39,7 @@
}) | raw}}
</p>
</div>
{% endblock %}
{% endblock %}
</div>

View File

@@ -4,11 +4,17 @@
</div>
<div class="row">
{% 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 %}
</div><br>
<div class="row">

View File

@@ -10,11 +10,15 @@
{% block settings_account %}
<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 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>
{% if 'password' not in form.fields.hidden %}
@@ -22,7 +26,9 @@
{% endif %}
<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>
{% endblock %}
</div>

View File

@@ -7,11 +7,15 @@
{% block settings_profile %}
<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 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>
{% endblock %}
</div>

View File

@@ -1,19 +1,33 @@
{% extends "@admin/forms/user.html.twig" %}
{% 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 %}
{% include "forms/partials/user-set-password.html.twig" %}
{% endif %}
{% block input_user_description %}
{% if 'password' not in form.fields.hidden %}
{% include "forms/partials/user-set-password.html.twig" %}
{% endif %}
{% endblock %}
{% endblock %}