From e14db1a1332c554901b7147175b1940b8a7772db Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 28 Dec 2018 17:52:15 +0100 Subject: [PATCH] Hide the profile sidebar when there's no content for it. --- templates/user/profile.twig | 98 ++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/templates/user/profile.twig b/templates/user/profile.twig index ab01d19a..9e972310 100644 --- a/templates/user/profile.twig +++ b/templates/user/profile.twig @@ -105,60 +105,66 @@ {% endif %}
-
- {% if is_editing and perms.edit_background %} -
- {{ container_title('Background') }} + {% set show_profile_fields = is_editing ? perms.edit_profile : profile_fields|default([])|length > 0 %} + {% set show_background_settings = is_editing and perms.edit_background %} + {% set show_sidebar = current_user is not defined or show_profile_fields or show_background_settings %} -
- {{ input_file('background[file]', '', ['image/png', 'image/jpeg', 'image/gif'], {'id':'background-selection'}) }} + {% if show_sidebar %} +
+ {% if show_background_settings %} +
+ {{ container_title('Background') }} - {{ input_checkbox('background[attach]', 'None', true, '', 0, true, {'onchange':'profileChangeBackgroundAttach(this.value)'}) }} - {% for key, value in background_attachments %} - {{ input_checkbox('background[attach]', value|capitalize, key == profile.user_background_attachment, '', key, true, {'onchange':'profileChangeBackgroundAttach(this.value)'}) }} - {% endfor %} +
+ {{ input_file('background[file]', '', ['image/png', 'image/jpeg', 'image/gif'], {'id':'background-selection'}) }} - {{ input_checkbox('background[attr][blend]', 'Blend', profile.user_background_blend, '', '', false, {'onchange':'profileToggleBackgroundAttr(\'blend\', this.checked)'}) }} - {{ input_checkbox('background[attr][slide]', 'Slide', profile.user_background_slide, '', '', false, {'onchange':'profileToggleBackgroundAttr(\'slide\', this.checked)'}) }} + {{ input_checkbox('background[attach]', 'None', true, '', 0, true, {'onchange':'profileChangeBackgroundAttach(this.value)'}) }} + {% for key, value in background_attachments %} + {{ input_checkbox('background[attach]', value|capitalize, key == profile.user_background_attachment, '', key, true, {'onchange':'profileChangeBackgroundAttach(this.value)'}) }} + {% endfor %} + + {{ input_checkbox('background[attr][blend]', 'Blend', profile.user_background_blend, '', '', false, {'onchange':'profileToggleBackgroundAttr(\'blend\', this.checked)'}) }} + {{ input_checkbox('background[attr][slide]', 'Slide', profile.user_background_slide, '', '', false, {'onchange':'profileToggleBackgroundAttr(\'slide\', this.checked)'}) }} +
-
- {% endif %} - {% if current_user is not defined %} -
-
- You must log in to view full profiles! + {% endif %} + {% if current_user is not defined %} +
+
+ You must log in to view full profiles! +
-
- {% elseif is_editing ? perms.edit_profile : profile_fields|default([])|length > 0 %} -
- {{ container_title('Elsewhere') }} + {% elseif show_profile_fields %} +
+ {{ container_title('Elsewhere') }} -
- {% for name, data in profile_fields %} -
- {% endif %} -
+ {% endif %} +
+ {% endif %}
{% if (is_editing and perms.edit_about) or profile.user_about_content|length > 0 %}