Skip to content

Commit 1b00343

Browse files
committed
Add a note outline to the sidebar
Previously there was no easy way to find notes attachet to specific messages without Ctrl+F. Now these are easily visible and linked in the sidebar.
1 parent 484ddd4 commit 1b00343

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

app/views/topics/show.html.slim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@
3636
- @commitfest_committers.each do |committer|
3737
li = committer
3838

39+
- if user_signed_in?
40+
- note_map = @notes_by_message || {}
41+
- message_note_entries = note_map.keys.filter_map do |key|
42+
- next unless key.is_a?(Integer)
43+
- notes = note_map[key]
44+
- next if notes.blank?
45+
- number = @message_numbers[key]
46+
- next unless number
47+
- [key, number, notes]
48+
- message_note_entries = message_note_entries.sort_by { |entry| entry[1] }
49+
- if message_note_entries.any?
50+
details.sidebar-section open=true
51+
summary.sidebar-heading Notes
52+
.sidebar-section
53+
ul.note-overview
54+
- message_note_entries.each do |message_id, number, notes|
55+
li
56+
= link_to "#message-#{message_id}", class: "note-overview-link" do
57+
span.note-overview-target = "##{number}"
58+
span.note-overview-count = "(#{notes.size})"
59+
3960
details.sidebar-section open=true
4061
summary.sidebar-heading Participants
4162
.sidebar-section

0 commit comments

Comments
 (0)