Skip to content

Commit

Permalink
Merge pull request #542 from scidsg/me
Browse files Browse the repository at this point in the history
Fix rendering of empty `extra_fields` div
  • Loading branch information
glenn-sorrentino authored Sep 9, 2024
2 parents 3f2d742 + 4a96744 commit f79113b
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions hushline/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,29 @@ <h2 class="submit">
{'label': user.extra_field_label4, 'value': user.extra_field_value4, 'verified': user.extra_field_verified4}
]
%}
{%- set valid_fields = extra_fields | selectattr('label', 'defined') | selectattr('value', 'defined') | selectattr('value') | list -%}

{% if extra_fields | selectattr('label', 'defined') | selectattr('value', 'defined') %}
{% if valid_fields | length > 0 %}
<div class="extra-fields">
{% for field in extra_fields %}
{% if field.label and field.value %}
<p class="extra-field">
<span class="extra-field-label">{{ field.label }}</span>
<span class="extra-field-value">
{% if field.verified %}
<span class="icon verifiedURL" title="Verified Address"></span>
{% endif %}
{% if field.value.startswith('https://') %}
<a
href="{{ field.value }}"
target="_blank"
rel="noopener noreferrer me"
>{{ field.value }}</a
>
{% else %}
{{ field.value }}
{% endif %}
</span>
</p>
{% endif %}
{% for field in valid_fields %}
<p class="extra-field">
<span class="extra-field-label">{{ field.label }}</span>
<span class="extra-field-value">
{% if field.verified %}
<span class="icon verifiedURL" title="Verified Address"></span>
{% endif %}
{% if field.value.startswith('https://') %}
<a
href="{{ field.value }}"
target="_blank"
rel="noopener noreferrer me"
>{{ field.value }}</a
>
{% else %}
{{ field.value }}
{% endif %}
</span>
</p>
{% endfor %}
</div>
{% endif %}
Expand Down

0 comments on commit f79113b

Please sign in to comment.