Skip to content

Commit 2abc96a

Browse files
committed
added proper partial for rendering notifications
1 parent b37bcea commit 2abc96a

3 files changed

Lines changed: 18 additions & 17 deletions

File tree

app/assets/stylesheets/notifications.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
border-top: 1px solid $muted-graphic;
1010
display: grid;
1111
gap: 0.75em;
12-
grid-template-columns: max-content auto;
12+
grid-template-columns: auto 1fr;
1313
align-items: center;
1414
padding: 0.5em;
1515

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<%#
2+
"Renders an inbox notification
3+
4+
Variables:
5+
notification : Notification to render
6+
"%>
7+
8+
<div class="notification">
9+
<div class="notification-content">
10+
<div class="form-caption">
11+
<%= notification.rendered_timestamp %>
12+
</div>
13+
<a href="<%= notification.link %>"><%= render_pings_text(notification.content) %></a>
14+
</div>
15+
</div>

app/views/notifications/index.html.erb

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,7 @@
2929
<h2>Unread</h2>
3030
<% end %>
3131
<% unread_notifications.each do |notif| %>
32-
<div class="notification">
33-
<div class="notification-content">
34-
<div class="form-caption">
35-
<%= CGI.unescape_html(notif.created_at.strftime('%b&nbsp;%-d,&nbsp;%Y&nbsp;at&nbsp;%H:%M')).html_safe %>
36-
</div>
37-
<a href="<%= notif.link %>"><%= render_pings_text(notif.content) %></a>
38-
</div>
39-
</div>
32+
<%= render 'notifications/notification', notification: notif %>
4033
<% end %>
4134
<% end %>
4235

@@ -45,14 +38,7 @@
4538
<h2>Read</h2>
4639
<% end %>
4740
<% read_notifications.each do |notif| %>
48-
<div class="notification">
49-
<div class="notification-content">
50-
<div class="form-caption">
51-
<%= CGI.unescape_html(notif.created_at.strftime('%b&nbsp;%-d,&nbsp;%Y&nbsp;at&nbsp;%H:%M')).html_safe %>
52-
</div>
53-
<a href="<%= notif.link %>"><%= render_pings_text(notif.content) %></a>
54-
</div>
55-
</div>
41+
<%= render 'notifications/notification', notification: notif %>
5642
<% end %>
5743
<% end %>
5844

0 commit comments

Comments
 (0)