Skip to content

Commit

Permalink
Merge pull request #6960 from samvera/6353-file-details---user-activi…
Browse files Browse the repository at this point in the history
…ty-table-has-accessibility-issue-when-empty

Updated user activity log table
  • Loading branch information
randalldfloyd authored Nov 5, 2024
2 parents bb28056 + d1a39f7 commit c56c4a8
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions app/views/hyrax/users/_activity_log.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@
</tr>
</thead>
<tbody>
<% events.each do |event| %>
<% next if event[:action].blank? or event[:timestamp].blank? %>
<% valid_events = events.reject { |event| event[:action].blank? || event[:timestamp].blank? } %>
<% if valid_events.empty? %>
<tr>
<td class="ensure-wrapped"><%= sanitize event[:action] %></td>
<% time = Time.zone.at(event[:timestamp].to_i) %>
<td data-sort="<%= time.getutc.iso8601(5) %>">
<relative-time datetime="<%= time.getutc.iso8601 %>" title="<%= time.to_formatted_s(:standard) %>">
<%= time.to_formatted_s(:long_ordinal) %>
</relative-time>
</td>
<td colspan="2">No user activity</td>
</tr>
<% else %>
<% valid_events.each do |event| %>
<tr>
<td class="ensure-wrapped"><%= sanitize event[:action] %></td>
<% time = Time.zone.at(event[:timestamp].to_i) %>
<td data-sort="<%= time.getutc.iso8601(5) %>">
<relative-time datetime="<%= time.getutc.iso8601 %>" title="<%= time.to_formatted_s(:standard) %>">
<%= time.to_formatted_s(:long_ordinal) %>
</relative-time>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
Expand Down

0 comments on commit c56c4a8

Please sign in to comment.