Configed costum filter datelteq in ransack to include the hole day, added costum arrows

This commit is contained in:
2024-09-19 13:49:34 +02:00
parent 84b92f54bf
commit 5b6ff5ae90

View File

@@ -0,0 +1,22 @@
# search date from to including both dates
Ransack.configure do |config|
config.add_predicate "dategteq",
arel_predicate: "gteq",
formatter: proc { |v| v.beginning_of_day },
type: :date
config.add_predicate "datelteq",
arel_predicate: "lteq",
formatter: proc { |v| v.end_of_day },
type: :date
config.custom_arrows = {
up_arrow: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true" role="img" aria-labelledby="ajg9won5sfrpesugbew2i5rtummy29a1" class="icon size-4 inline"><title id="ajg9won5sfrpesugbew2i5rtummy29a1">Bars arrow up</title>
<path stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12"></path>
</svg>',
down_arrow: '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true" role="img" aria-labelledby="ar7s290igtz4ebl4u28nvo83f8i49xn3" class="icon size-4"><title id="ar7s290igtz4ebl4u28nvo83f8i49xn3">Bars arrow down</title>
<path stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25"></path>
</svg>',
default_arrow: ""
}
end