Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disambiguate .toggle-bookmark #3306

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 43 additions & 42 deletions app/assets/stylesheets/blacklight/_bookmark.scss
Original file line number Diff line number Diff line change
@@ -1,50 +1,51 @@
label.toggle-bookmark {
font-weight: inherit;
min-width: 8.5em;
}

div.toggle-bookmark {
cursor: pointer;
}

/* override for line 3.
Creates weird spacing in toolbar when min-width is set to 8rem */
.header-tools label.toggle-bookmark {
min-width: 2rem;
}

.bookmark-toggle {
.no-js & {
input[type="submit"] {
display: inline
}

div.toggle-bookmark {
display: none
}
}

input[type="submit"] {
display: none;
}
}
.toggle-bookmark .blacklight-icons svg {
height: 1.25rem;
width: 1.25rem;
overflow: visible;
fill: var(--bs-primary);
.no-js & {
input[type="submit"] {
display: inline;
}

.toggle-bookmark {
display: none;
}
}

&.bookmark-checked {
input[type="submit"] {
display: none;
}
}

.toggle-bookmark[type="checkbox"]:checked+span svg {
&.bookmark-checked {
display: inherit;
.toggle-bookmark {
cursor: pointer;

.toggle-bookmark-label {
font-weight: inherit;
min-width: 8.5em;

.blacklight-icons svg {
height: 1.25rem;
width: 1.25rem;
overflow: visible;
fill: var(--bs-primary);

&.bookmark-checked {
display: none;
}
}
}

.toggle-bookmark-input:checked + span svg {
&.bookmark-checked {
display: inherit;
}

&.bookmark-unchecked {
display: none;
}
}
}

&.bookmark-unchecked {
display: none;
/* override for line 21.
Creates weird spacing in toolbar when min-width is set to 8rem */
.header-tools .toggle-bookmark-label {
min-width: 2rem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
absent: t('blacklight.search.bookmarks.absent'),
inprogress: t('blacklight.search.bookmarks.inprogress')
}) do %>
<div class="checkbox toggle-bookmark">
<label class="toggle-bookmark" data-checkboxsubmit-target="label">
<input type="checkbox" class="toggle-bookmark <%= bookmark_icon ? 'd-none' : '' %>" data-checkboxsubmit-target="checkbox" <%= 'checked="checked"' if bookmarked? %>>
<div class="toggle-bookmark">
<label class="toggle-bookmark-label" data-checkboxsubmit-target="label">
<input type="checkbox" class="toggle-bookmark-input <%= bookmark_icon ? 'd-none' : '' %>" data-checkboxsubmit-target="checkbox" <%= 'checked="checked"' if bookmarked? %>>
<%= bookmark_icon %>
<span data-checkboxsubmit-target="span"><%= bookmarked? ? t('blacklight.search.bookmarks.present') : t('blacklight.search.bookmarks.absent') %></span>
</label>
Expand Down
2 changes: 1 addition & 1 deletion spec/features/bookmarks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
expect(page).to have_css('.blacklight-icons-bookmark')
find('.blacklight-icons-bookmark').click

expect(find('.toggle-bookmark[type="checkbox"]', visible: false)).to be_checked
expect(find('.toggle-bookmark-input', visible: false)).to be_checked
find('.blacklight-icons-bookmark').click
end
end
Expand Down