forked from hackorum-dev/hackorum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_topic_row_user.html.slim
More file actions
35 lines (34 loc) · 2.61 KB
/
_topic_row_user.html.slim
File metadata and controls
35 lines (34 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
- state = state || {}
- note_count = note_count.to_i
- participation = participation || {}
- team_readers = team_readers || []
- star_data = star_data || {}
- status = state[:status] || "new"
- row_class = ["topic-row", "topic-#{status}"]
- row_class << "has-new-replies" if status.to_s == "reading"
- topic_participants_map ||= @topic_participants_map || {}
- tp_data = topic_participants_map[topic.id] || {}
- top_participants = tp_data[:top] || []
- contributor_participants = tp_data[:contributors] || []
tr id=dom_id(topic) class=row_class.join(" ") data-topic-id=topic.id data-last-message-id=topic.last_message_id
= render partial: "topics/status_cell", locals: { topic: topic, state: state, note_count: note_count, team_readers: team_readers, star_data: star_data }
td.topic-activity data-label="Activity"
- replies_count = [topic.message_count - 1, 0].max
.activity-info.compact
.activity-replies = pluralize(replies_count, "reply")
.activity-time title=absolute_time_display(topic.last_message_at) = smart_time_display(topic.last_message_at)
td.topic-participants data-label="Participants"
- participants = top_participants.map { |tp| { alias: tp.person.default_alias, person: tp.person, message_count: tp.message_count, last_at: tp.last_message_at } }
- participants = topic.participant_alias_stats(limit: 5) if participants.empty? && top_participants.empty?
= render partial: "avatar_list", locals: { participants: participants, total_participants: topic.participant_count }
- if topic.contributor_participant_count.positive?
- contributor_data = contributor_participants.map { |tp| { alias: tp.person.default_alias, person: tp.person, message_count: tp.message_count, last_at: tp.last_message_at } }
- contributor_data = topic.contributor_participants if contributor_data.empty? && contributor_participants.empty?
div class="topic-icon activity-#{topic.highest_contributor_type || 'contributor'}" data-controller="hover-popover" data-hover-popover-delay-value="200" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide"
i.fa-solid.fa-users-rays
span.topic-icon-badge = topic.contributor_participant_count
- if contributor_data.any?
.topic-icon-hover data-hover-popover-target="popover" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide"
- contributor_data.each do |participant|
= render partial: "participant_row", locals: { participant: participant, avatar_size: 32 }
= render partial: "topics/participation_icon", locals: { topic: topic, participation: participation }