Skip to content

Commit 66ed6d8

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 66ed6d8

2 files changed

Lines changed: 12 additions & 11 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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,14 @@
194194
= render "notes/note_stack", topic: @topic, message: nil, notes: thread_notes
195195

196196
.messages-container.flat.asc
197-
- if user_signed_in?
198-
.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
197+
- last_message = @messages.last
198+
- if user_signed_in? || last_message.present?
199+
- thread_actions_attrs = user_signed_in? ? { controller: "thread-actions", "thread-actions-topic-id-value": @topic.id, "thread-actions-read-all-url-value": read_all_topic_path(@topic, format: :json) } : {}
200+
.thread-actions data=thread_actions_attrs
201+
- if user_signed_in?
202+
button.button.button-secondary.button-small data-action="click->thread-actions#markAllRead" Mark all messages read
203+
- if last_message.present?
204+
= 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"
200205

201206
- first_unread_found = false
202207
- @messages.each do |message|

0 commit comments

Comments
 (0)