Skip to content

Commit

Permalink
Fix picture archive select-all feature
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Dec 14, 2023
1 parent 474c72b commit d422fc5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
14 changes: 11 additions & 3 deletions app/assets/stylesheets/alchemy/archive.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
border-bottom: 1px solid $default-border-color;
margin-bottom: 4 * $default-padding;
padding: 4 * $default-padding;
display: none;

.button {
vertical-align: middle;
Expand Down Expand Up @@ -89,14 +88,23 @@

&:hover,
&:focus-within {
box-shadow: 0 0 4px 2px $default-border-color;

.picture_tool,
.picture_tags {
visibility: visible;
opacity: 1;
}
}

&:hover,
&:focus-within,
&.active {
box-shadow: 0 0 4px 2px $default-border-color;

.picture_tool.select {
visibility: visible;
opacity: 1;
}
}
}

#pictures,
Expand Down
2 changes: 1 addition & 1 deletion app/views/alchemy/admin/pictures/_archive.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<%= form_tag delete_multiple_admin_pictures_path, method: :delete do %>
<div class="selected_item_tools">
<div class="selected_item_tools hidden">
<h3><%= Alchemy.t(:edit_selected_pictures) %></h3>
<%= link_to(
render_icon(:edit, size: '1x') + Alchemy.t("Edit"),
Expand Down
7 changes: 6 additions & 1 deletion app/views/alchemy/admin/pictures/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,13 @@
$(function() {
Alchemy.pictureSelector();
$('#select_all_pictures').on('click', function(e) {
$('.picture_tool.select :checkbox').prop('checked', true).change();
$(this).toggleClass("active")
$('.picture_tool.select :checkbox')
.prop('checked', function(_i, val) { return !val })
.closest(".picture_thumbnail")
.toggleClass("active");
e.preventDefault;
$(".selected_item_tools").toggleClass("hidden")
return false;
});
$('.thumbnail_background').click(function(event) {
Expand Down

0 comments on commit d422fc5

Please sign in to comment.