Skip to content

Commit dd933f7

Browse files
authored
Merge pull request #7335 from emilghittasv/improve-badge-page
Improve badges/badge page UI
2 parents 24baeae + b93e639 commit dd933f7

File tree

2 files changed

+67
-34
lines changed

2 files changed

+67
-34
lines changed

kitsune/kbadge/jinja2/badger/badge_detail.html

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,55 @@ <h1 class="sumo-page-heading">
99
{% endtrans %}
1010
</h1>
1111

12-
<dl class="sumo-dl badge-details" data-slug="{{ badge.slug }}">
13-
{% if badge.image %}
14-
<dt>{{ _('Image:') }}</dt>
15-
<dd class="image"><a href="{{ badge.get_absolute_url() }}" class="image"><img src="{{ badge.image.url }}" width="256" height="256" /></a></dd>
16-
{% endif %}
17-
18-
{% if badge.description %}
19-
<dt>{{ _('Description:') }}</dt>
20-
<dd class="description">{{ pgettext('DB: badger.Badge.description', badge.description) }}</dd>
21-
{% endif %}
22-
23-
{% if badge.creator %}
24-
<dt>{{ _('Creator:') }}</dt>
25-
<dd><a rel="nofollow" href="{{ profile_url(badge.creator) }}">{{ display_name(badge.creator) }}</a></dd>
26-
{% endif %}
27-
28-
<dt>{{ _('Created:') }}</dt>
29-
<dd>{{ datetimeformat(badge.created) }}</dd>
30-
31-
<dt>{{ _('Modified:') }}</dt>
32-
<dd>{{ datetimeformat(badge.modified) }}</dd>
33-
</dl>
34-
</div>
35-
36-
{% if award_list %}
37-
<h2 class="sumo-page-subheading">{{ _('Recent awardees') }}</h2>
38-
<ul class="awardees">
39-
{% for award in award_list %}
40-
<li>
41-
<a href="{{ award.get_absolute_url() }}"><img class="avatar" src="{{ profile_avatar(award.user) }}" alt="" title="{{ award.user }}"></a>
42-
</li>
43-
{% endfor %}
44-
</ul>
45-
{% endif %}
12+
<div class="card elevation-01 lg-pad mb" data-slug="{{ badge.slug }}">
13+
<div class="avatar-group">
14+
{% if badge.image %}
15+
<figure class="avatar-group--figure text-center">
16+
<a href="{{ badge.get_absolute_url() }}">
17+
<img src="{{ badge.image.url }}" alt="{{ pgettext('DB: badger.Badge.title', badge.title) }}" width="160" height="160" />
18+
</a>
19+
</figure>
20+
{% endif %}
21+
22+
<div class="avatar-group--details">
23+
<dl class="sumo-dl">
24+
{% if badge.description %}
25+
<dt><strong>{{ _('Description:') }}</strong></dt>
26+
<dd>{{ pgettext('DB: badger.Badge.description', badge.description) }}</dd>
27+
{% endif %}
28+
29+
{% if badge.creator %}
30+
<dt><strong>{{ _('Creator:') }}</strong></dt>
31+
<dd>
32+
<img class="avatar" src="{{ profile_avatar(badge.creator) }}" alt="{{ display_name(badge.creator) }}" width="24" height="24" />
33+
<a rel="nofollow" href="{{ profile_url(badge.creator) }}">{{ display_name(badge.creator) }}</a>
34+
</dd>
35+
{% endif %}
36+
37+
<dt><strong>{{ _('Created:') }}</strong></dt>
38+
<dd>{{ datetimeformat(badge.created) }}</dd>
39+
40+
<dt><strong>{{ _('Modified:') }}</strong></dt>
41+
<dd>{{ datetimeformat(badge.modified) }}</dd>
42+
</dl>
43+
</div>
44+
</div>
45+
</div>
46+
47+
{% if award_list %}
48+
<h2 class="sumo-page-subheading">{{ _('Recent awardees') }}</h2>
49+
<ul class="badges-list">
50+
{% for award in award_list %}
51+
<li>
52+
<a class="display-block" href="{{ award.get_absolute_url() }}" title="{{ display_name(award.user) }}">
53+
<figure>
54+
<img class="avatar display-block" src="{{ profile_avatar(award.user) }}" alt="{{ display_name(award.user) }}" width="64" height="64" />
55+
<figcaption>{{ display_name(award.user) }}</figcaption>
56+
</figure>
57+
</a>
58+
</li>
59+
{% endfor %}
60+
</ul>
61+
{% endif %}
4662

4763
{% endblock %}

kitsune/sumo/static/sumo/scss/layout/_profile.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,21 @@
3333
max-width: 150px;
3434
margin: 0 20px 20px 0;
3535
}
36+
37+
figure {
38+
display: flex;
39+
flex-direction: column;
40+
align-items: center;
41+
gap: p.$spacing-xs;
42+
}
43+
44+
figcaption {
45+
max-width: 100%;
46+
overflow: hidden;
47+
text-overflow: ellipsis;
48+
white-space: nowrap;
49+
@include c.text-body-xs;
50+
text-align: center;
51+
color: var(--color-marketing-gray-07);
52+
}
3653
}

0 commit comments

Comments
 (0)