Skip to content

Commit 502ed1d

Browse files
committed
Add a 'Jump to latest' button in mobile and desktop view and also adjust the style of merge topic and this new button to match the existing style, so it's clear these are actual buttons
Signed-off-by: Kai Wagner <kai.wagner@percona.com>
1 parent 0707793 commit 502ed1d

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

app/assets/stylesheets/components/messages.css

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,10 @@
142142

143143
.thread-actions {
144144
margin-bottom: var(--spacing-4);
145-
146-
& .button-secondary {
147-
padding: var(--spacing-2) var(--spacing-4);
148-
border: var(--border-width) solid var(--color-border);
149-
background: var(--color-bg-card);
150-
border-radius: var(--border-radius-sm);
151-
cursor: pointer;
152-
}
145+
display: flex;
146+
flex-wrap: wrap;
147+
align-items: center;
148+
gap: var(--spacing-2);
153149
}
154150

155151
.message-subject {

app/views/topics/show.html.slim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,12 @@
194194
= render "notes/note_stack", topic: @topic, message: nil, notes: thread_notes
195195

196196
.messages-container.flat.asc
197-
- if user_signed_in?
197+
- last_message = @messages.last
198+
- if last_message.present?
198199
.thread-actions data-controller="thread-actions" data-thread-actions-topic-id-value=@topic.id data-thread-actions-read-all-url-value=read_all_topic_path(@topic, format: :json)
199-
button.button-secondary data-action="click->thread-actions#markAllRead" Mark all messages read
200+
- if user_signed_in?
201+
button.button.button-secondary.button-small data-action="click->thread-actions#markAllRead" Mark all messages read
202+
= link_to "Jump to latest", "#message-#{last_message.id}", class: "button button-secondary button-small", title: "Jump to latest message", "aria-label": "Jump to latest message"
200203

201204
- first_unread_found = false
202205
- @messages.each do |message|

0 commit comments

Comments
 (0)