Skip to content

Commit 343da20

Browse files
matsestCopilot
andauthored
fix: still set initial checked state in html based on @book.default_view
Review suggestion by copilot Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 1d2b9c1 commit 343da20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/views/books/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@
8383
<div class="book__toolbar fill-white flex gap-half pad-block margin-block-end-half justify-center <%= "position-sticky" if @book.editable? %>" data-controller="toc-view" data-toc-view-id-value="<%= dom_id(@book) %>" data-toc-view-default-value="<%= @book.default_view %>">
8484
<% if @book.allow_view_selector? %>
8585
<label class="btn txt-medium disable-when-empty">
86-
<input type="radio" name="view" id="toc-list" value="list" data-toc-view-target="switch" data-toc-view-type-value="list" data-action="toc-view#saveViewPref">
86+
<input type="radio" name="view" id="toc-list" value="list" data-toc-view-target="switch" data-toc-view-type-value="list" data-action="toc-view#saveViewPref"<%= ' checked="checked"' if @book.default_view == 'list' %>>
8787
<%= image_tag "view-list.svg", aria: { hidden: true }, size: 24 %>
8888
<span class="for-screen-reader">List view</span>
8989
</label>
9090

9191
<label class="btn txt-medium flex-item-justify-start disable-when-empty">
92-
<input type="radio" name="view" id="toc-grid" value="grid" data-toc-view-target="switch" data-toc-view-type-value="grid" data-action="toc-view#saveViewPref">
92+
<input type="radio" name="view" id="toc-grid" value="grid" data-toc-view-target="switch" data-toc-view-type-value="grid" data-action="toc-view#saveViewPref"<%= ' checked="checked"' if @book.default_view == 'grid' %>>
9393
<%= image_tag "view-grid.svg", aria: { hidden: true }, size: 24 %>
9494
<span class="for-screen-reader">Page view</span>
9595
</label>

0 commit comments

Comments
 (0)