Add conditional shows for different aspects of user_mention

This commit is contained in:
Max Wofford
2025-03-19 12:39:52 -04:00
parent acfe93d8d1
commit 06baa1dfef
4 changed files with 5 additions and 5 deletions

View File

@@ -40,7 +40,7 @@
<span class="rank"><%= (entries.index(entry) + 1).ordinalize %></span>
<% end %>
<span class="user" style="display: inline-block;">
<%= render "shared/user_mention", user: entry.user %>
<%= render "shared/user_mention", user: entry.user, show: [:neighborhood] %>
</span>
<span class="time"><%= short_time_detailed entry.total_seconds %></span>
</div>

View File

@@ -37,7 +37,7 @@
<% @entries.each_with_index do |entry, index| %>
<tr>
<td><%= (index + 1).ordinalize %></td>
<td><%= render "shared/user_mention", user: entry.user %></td>
<td><%= render "shared/user_mention", user: entry.user, show: [:neighborhood, :slack] %></td>
<td><%= short_time_detailed entry.total_seconds %></td>
</tr>
<% end %>

View File

@@ -3,12 +3,12 @@
size: "32x32",
class: "avatar",
alt: "#{user.username}'s avatar" if user.avatar_url %>
<% if user.slack_uid.present? %>
<% if local_assigns.fetch(:show, []).include?(:slack) && user.slack_uid.present? %>
<%= link_to "@#{user.display_name}", "https://slack.com/app_redirect?channel=#{user.slack_uid}", target: "_blank" %>
<% else %>
<%= user.display_name %>
<% end %>
<% if user.slack_uid.present? && neighborhood = SlackNeighborhood.find_by_id(user.slack_uid) %>
<% if local_assigns.fetch(:show, []).include?(:neighborhood) && user.slack_uid.present? && neighborhood = SlackNeighborhood.find_by_id(user.slack_uid) %>
<%= link_to "🏘️", "https://slack.com/app_redirect?channel=#{neighborhood.dig("id")}", target: "_blank" %>
<% end %>
<% unless current_user == user %>

View File

@@ -12,7 +12,7 @@
<hr>
<ul>
<% users.each do |user| %>
<%= render "shared/user_mention", user: user %>
<%= render "shared/user_mention", user: user, show: [:slack] %>
<% end %>
</ul>
</div>