Skip to content

Commit b9bb266

Browse files
authored
Merge pull request #1962 from codidact/0valt/1599/inbox-community-names
Show community logo & name for inbox notifications
2 parents b9c1daf + b128ff9 commit b9bb266

5 files changed

Lines changed: 58 additions & 37 deletions

File tree

app/assets/stylesheets/application.scss

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ a {
4343
overflow-wrap: break-word;
4444
}
4545

46-
a.header--site-name {
47-
display: flex !important;
48-
}
49-
.header .header--item.is-complex:not(.is-mobile-menu) {
50-
align-items: center !important;
51-
display: flex !important;
52-
}
53-
5446
@media all and (max-width: 73.5em) {
5547
.grid {
5648
margin-left: 0;
@@ -88,18 +80,6 @@ a.header--site-name {
8880
font-size: 14px;
8981
}
9082

91-
header {
92-
&.header {
93-
z-index: 5;
94-
position: relative;
95-
box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.2);
96-
}
97-
&.header.sticky {
98-
position: sticky;
99-
top: 0;
100-
}
101-
}
102-
10383
.notice a.has-font-size-larger {
10484
font-size: 19px;
10585
}
@@ -156,10 +136,6 @@ hr {
156136
overflow-y: scroll;
157137
}
158138

159-
.header--container {
160-
align-items: center !important;
161-
}
162-
163139
img {
164140
align-self: flex-start;
165141
}
@@ -242,20 +218,10 @@ table.is-with-hover tr:hover td {
242218
background-color: #eee
243219
}
244220

245-
/* The default header size (2.5rem) is too huge for small headers. */
246-
.header.is-small .header--brand .header--site-name {
247-
font-size: 2rem;
248-
}
249-
250221
.notice {
251222
z-index: 9999;
252223
}
253224

254-
/* Fix header images being stretched - https://meta.codidact.com/posts/278377 */
255-
img.header--item-image {
256-
object-fit: contain;
257-
}
258-
259225
.widget--header-link {
260226
margin: 0 0 0 0.5em;
261227
}

app/assets/stylesheets/header.scss

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@import 'variables';
2+
3+
a.header--site-name:any-link {
4+
display: flex;
5+
}
6+
7+
.header .header--item.is-complex:not(.is-mobile-menu) {
8+
align-items: center !important;
9+
display: flex !important;
10+
}
11+
12+
13+
header {
14+
&.header {
15+
z-index: 5;
16+
position: relative;
17+
box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.2);
18+
}
19+
20+
&.header.sticky {
21+
position: sticky;
22+
top: 0;
23+
}
24+
}
25+
26+
.header--container {
27+
align-items: center !important;
28+
}
29+
30+
/* The default header size (2.5rem) is too huge for small headers. */
31+
.header.is-small .header--brand .header--site-name {
32+
font-size: 2rem;
33+
}
34+
35+
/* Fix header images being stretched - https://meta.codidact.com/posts/278377 */
36+
img.header--item-image {
37+
object-fit: contain;
38+
}

app/assets/stylesheets/notifications.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
}
3535
}
3636

37+
.notification--icon {
38+
max-height: 1em;
39+
}
40+
3741
.notification--timestamp {
3842
line-break: strict;
3943
}

app/assets/stylesheets/utilities.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,15 @@ div:hover > .copy-button {
263263
}
264264
}
265265

266-
.__mobile-only {
266+
.__mobile-only,
267+
a.__mobile-only:any-link {
267268
@media screen and (min-width: $screen-sm) {
268269
display: none;
269270
}
270271
}
271272

272-
.__desktop-only {
273+
.__desktop-only,
274+
a.__desktop-only:any-link {
273275
@media screen and (max-width: $screen-sm) {
274276
display: none;
275277
}

app/views/notifications/_notification.html.erb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,21 @@
55
notification : Notification to render
66
"%>
77

8+
<%
9+
mobile_logo_path = SiteSetting['MobileLogoPath', community: notification.community]
10+
full_logo_path = SiteSetting['SiteLogoPath', community: notification.community]
11+
logo_path = mobile_logo_path.presence || full_logo_path
12+
%>
13+
814
<div class="notification">
915
<div class="notification-content">
1016
<div class="form-caption">
11-
<%= notification.rendered_timestamp %>
17+
<% if logo_path.present? %>
18+
<img class="notification--icon"
19+
src="<%= logo_path %>"
20+
alt="<% notification.community_name %> logo" />
21+
<% end %>
22+
<%= notification.community_name %> &middot; <%= notification.rendered_timestamp %>
1223
</div>
1324
<a href="<%= notification.link %>"><%= render_pings_text(notification.content) %></a>
1425
</div>

0 commit comments

Comments
 (0)