fix: Add multi-select toggle also in activities page. Make JS controller compatible also in this view.

This commit is contained in:
Alessio Cappa
2025-12-13 13:43:21 +01:00
parent 4a39f65987
commit 2cfd431554
6 changed files with 31 additions and 13 deletions

View File

@@ -4,9 +4,12 @@
<div class="py-2 px-4 flex items-center justify-between font-medium text-xs text-secondary">
<div class="flex pl-0.5 items-center gap-4">
<%= check_box_tag "#{date}_entries_selection",
class: ["checkbox checkbox--light", "hidden": entries.size == 0],
class: ["checkbox checkbox--light hidden lg:block", "lg:hidden": entries.size == 0],
id: "selection_entry_#{date}",
data: { action: "bulk-select#toggleGroupSelection" } %>
data: {
action: "bulk-select#toggleGroupSelection",
checkbox_toggle_target: "selectionEntry"
} %>
<p class="uppercase space-x-1.5">
<%= tag.span I18n.l(date, format: :long) %>

View File

@@ -1,5 +1,5 @@
<%= turbo_frame_tag dom_id(account, "entries") do %>
<div class="bg-container p-5 shadow-border-xs rounded-xl">
<div class="bg-container p-5 shadow-border-xs rounded-xl" data-controller="checkbox-toggle">
<div class="flex items-center justify-between mb-4" data-testid="activity-menu">
<%= tag.h2 t("accounts.show.activity.title"), class: "font-medium text-lg" %>
@@ -46,8 +46,17 @@
"data-auto-submit-form-target": "auto" %>
</div>
</div>
</div>
<% end %>
<%= button_tag type: "button",
id: "toggle-checkboxes-button",
class: "lg:hidden font-medium whitespace-nowrap inline-flex items-center gap-1 rounded-lg px-3 py-2 text-sm text-primary border border-secondary hover:bg-surface-hover",
data: {
action: "click->checkbox-toggle#toggle",
checkbox_toggle_target: "toggleButton"
} do %>
<%= helpers.icon("list-todo") %>
<% end %>
</div>
</div>
<% if activity_dates.empty? %>
@@ -66,8 +75,11 @@
<div class="grid bg-container-inset rounded-xl grid-cols-12 items-center uppercase text-xs font-medium text-secondary px-5 py-3 mb-4">
<div class="pl-0.5 col-span-8 flex items-center gap-4">
<%= check_box_tag "selection_entry",
class: "checkbox checkbox--light",
data: { action: "bulk-select#togglePageSelection" } %>
class: "checkbox checkbox--light hidden lg:block",
data: {
action: "bulk-select#togglePageSelection",
checkbox_toggle_target: "selectionEntry"
} %>
<%= tag.p t("accounts.show.activity.date") %>
</div>