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

Pattern search forms #2337

Draft
wants to merge 106 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
0052ab8
Pattern Search controllers for every searchable model
nimmolo Aug 26, 2024
57a4aca
names search routes and form
nimmolo Aug 26, 2024
6517d2f
Update pattern_search_controller.rb
nimmolo Aug 26, 2024
7520344
Add some pattern search field helpers
nimmolo Aug 26, 2024
3d3d15d
Merge branch 'main' into pattern-search-controllers
nimmolo Aug 30, 2024
c8cb865
more helpers
nimmolo Aug 30, 2024
efe8ae3
simplify range fields
nimmolo Aug 31, 2024
16a2156
pattern_search form builder
nimmolo Aug 31, 2024
4556505
Pared down
nimmolo Aug 31, 2024
d869385
Panels for search groups
nimmolo Sep 1, 2024
ef5c74a
Start to fix inline text fields
nimmolo Sep 2, 2024
ca9c16f
Regroup and polish names form
nimmolo Sep 2, 2024
3c76fe6
Update _form.erb
nimmolo Sep 2, 2024
3546116
Start obs form
nimmolo Sep 2, 2024
a768223
organize obs search
nimmolo Sep 4, 2024
c5253fc
Refactor pattern search field helpers
nimmolo Sep 4, 2024
b2e7b98
Observation form field groupings
nimmolo Sep 4, 2024
bedbccd
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 5, 2024
54c4152
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 5, 2024
483ffec
Add concern and routes
nimmolo Sep 5, 2024
8a21c44
Smooth out observations
nimmolo Sep 6, 2024
66677ce
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 6, 2024
e43c5e8
permit hidden_id fields
nimmolo Sep 6, 2024
a2ae784
Autocompleters - change hidden field id to match field + "_id"
nimmolo Sep 7, 2024
ed6288a
Update check_box_with_label to accept checked_value
nimmolo Sep 7, 2024
4c1a4f0
Field concatenation!
nimmolo Sep 7, 2024
58c68cd
Update autocompleter_helper.rb
nimmolo Sep 7, 2024
7fc6ef7
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 7, 2024
c3bb665
Update pattern_search_controller.rb
nimmolo Sep 7, 2024
b16abda
Update pattern_search_helper.rb
nimmolo Sep 7, 2024
f005e65
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 12, 2024
56fdeaa
Add help text to pattern search fields
nimmolo Sep 12, 2024
b0ae588
Maybe switch to date selects
nimmolo Sep 13, 2024
54bbfe1
Change "yes field" to select
nimmolo Sep 13, 2024
8220934
Merge branch 'main' into pattern-search-date-selects
nimmolo Sep 14, 2024
1a6bebb
Merge branch 'date-select-option-refinement' into pattern-search-date…
nimmolo Sep 14, 2024
806c0c3
Okay, dates are working
nimmolo Sep 14, 2024
87505c7
Merge branch 'main' into pattern-search-date-selects
nimmolo Sep 14, 2024
bc3e0e0
Merge branch 'pattern-search-date-selects' into pattern-search-contro…
nimmolo Sep 14, 2024
ecdf1c3
Adjust the hidden name of the autocompleters on the form
nimmolo Sep 14, 2024
564bd6b
Use form `SearchFilter` models
nimmolo Sep 16, 2024
7c0061f
Allow blanks in selects
nimmolo Sep 16, 2024
cbf9a4b
Use parse_date_range
nimmolo Sep 16, 2024
3014098
Whoops map!
nimmolo Sep 16, 2024
2e89e5d
Merge branch 'date-select-option-refinement' into pattern-search-cont…
nimmolo Sep 16, 2024
c4e1deb
Merge branch 'date-select-option-refinement' into pattern-search-cont…
nimmolo Sep 16, 2024
df372ae
Update schema.rb
nimmolo Sep 16, 2024
354aeca
Merge branch 'date-select-option-refinement' into pattern-search-cont…
nimmolo Sep 16, 2024
24c855c
Add migration, fix numeric range values
nimmolo Sep 16, 2024
10f769d
Revert to text fields for dates
nimmolo Sep 16, 2024
eb4a51d
Fix ranges, clean
nimmolo Sep 17, 2024
43a1700
guard incoming_string nil
nimmolo Sep 17, 2024
d785c90
spacing for between
nimmolo Sep 17, 2024
0308676
truly improved spacing
nimmolo Sep 17, 2024
6d69750
Set default "" incoming string upstream
nimmolo Sep 17, 2024
10259c5
rank and confidence as ranges, reformat options
nimmolo Sep 17, 2024
db6da28
Handle params nested under filter object, add `fields` methods
nimmolo Sep 18, 2024
ef87b8a
Move fields_with id upstream, symbolize keys
nimmolo Sep 18, 2024
8d88421
Switch to FiltersController
nimmolo Sep 18, 2024
63cee8a
Continue renaming templates, add clear button
nimmolo Sep 18, 2024
ede270f
Collapsed/shown fields, refactor controllers
nimmolo Sep 18, 2024
ea00aa5
Separate type from model in filter args (type is for autocompleter)
nimmolo Sep 19, 2024
e9366f3
Clean up
nimmolo Sep 19, 2024
ebe72a5
More tweaks. Try to avoid margin-right
nimmolo Sep 19, 2024
9eb6651
forms in panels - less margin at bottom
nimmolo Sep 19, 2024
9f17c2e
Fix range fields, search_type
nimmolo Sep 19, 2024
8156917
Clean up and rubocop
nimmolo Sep 19, 2024
a105685
fields_with_requirements - search_type - search_subclass
nimmolo Sep 19, 2024
9d6280a
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 22, 2024
d3aa1b8
Filters controller tests
nimmolo Sep 22, 2024
1a72425
Create pattern_search_integration_test.rb
nimmolo Sep 22, 2024
ad53895
fields_with_requirements is hash
nimmolo Sep 22, 2024
f149a40
Add "more" to panel uncollapse
nimmolo Sep 22, 2024
0275935
Go back to storing strings. Ids needs more work
nimmolo Sep 22, 2024
1536c56
Check that session[:pattern].present?
nimmolo Sep 23, 2024
7a89e5b
Fix prefilling values on panels, and pre-opening if filled
nimmolo Sep 23, 2024
247167a
Re-add pattern fields
nimmolo Sep 23, 2024
92a704f
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 24, 2024
f9c05b9
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 25, 2024
f00564a
Containers for these pages
nimmolo Sep 25, 2024
fc31ac9
Pass obj to location helpers to prefill value
nimmolo Sep 25, 2024
8a2ad5b
Send obj to helpers
nimmolo Sep 25, 2024
e83b9ec
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 26, 2024
bafb9fb
add pattern param and filter attribute
nimmolo Sep 26, 2024
63e1615
region/compass sort of working
nimmolo Sep 26, 2024
d4e796f
fix accessor for value in compass/elevation inputs
nimmolo Sep 26, 2024
b35aba0
fix concat
nimmolo Sep 26, 2024
202ecad
fix capture/concat
nimmolo Sep 26, 2024
c09685b
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 26, 2024
66817c9
Add map ui
nimmolo Sep 26, 2024
4481316
Fix range values, plus string escaping for region
nimmolo Sep 27, 2024
5530063
Use existing page titles
nimmolo Sep 27, 2024
15a41e2
Merge branch 'main' into pattern-search-controllers
nimmolo Sep 28, 2024
f16aecb
Merge branch 'main' into pattern-search-controllers
nimmolo Oct 3, 2024
c3ff609
Merge branch 'main' into pattern-search-controllers
nimmolo Oct 15, 2024
21adbb1
Merge branch 'main' into pattern-search-controllers
nimmolo Jan 28, 2025
829e4ee
Merge branch 'main' into pattern-search-controllers
nimmolo Feb 1, 2025
d082882
Merge branch 'main' into pattern-search-controllers
nimmolo Feb 1, 2025
2b6e60e
Merge branch 'main' into pattern-search-controllers
nimmolo Feb 2, 2025
ab7a9bc
Get the forms in the controller tests
nimmolo Feb 2, 2025
51891eb
Fix and test "rehydration" of form from session[:pattern]
nimmolo Feb 2, 2025
4879fdc
Don't print the Filter attribute on the inputs!
nimmolo Feb 2, 2025
c09cb5a
Add notes about using Query params, and adjust controller tests
nimmolo Feb 2, 2025
5d78978
Update filters_helper.rb
nimmolo Feb 2, 2025
605b20d
Update en.txt
nimmolo Feb 2, 2025
441d330
Merge branch 'main' into pattern-search-controllers
nimmolo Feb 6, 2025
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
Prev Previous commit
Next Next commit
Add "more" to panel uncollapse
  • Loading branch information
nimmolo committed Sep 22, 2024
commit f149a405a3dcef8bdd943500201adbcaf2f08927
1 change: 0 additions & 1 deletion app/controllers/concerns/filterable.rb
Original file line number Diff line number Diff line change
@@ -54,7 +54,6 @@ def remove_invalid_field_combinations
return unless search_subclass.respond_to?(:fields_with_requirements)

search_subclass.fields_with_requirements.each do |req, fields|
debugger
next if @keywords[req].present?

fields.each { |field| @keywords.delete(field) }
3 changes: 2 additions & 1 deletion app/helpers/filters_helper.rb
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@ def filter_panel(form:, filter:, heading:, sections:, model:)
open = filter.attributes.keys.intersect?(sections[:collapsed])
end
panel_block(heading: :"search_term_group_#{heading}".l,
collapse:, open:, panel_bodies: [shown, collapsed])
collapse:, open:, collapse_message: :MORE.l,
panel_bodies: [shown, collapsed])
end

def filter_panel_shown(form:, sections:, model:)
32 changes: 20 additions & 12 deletions app/helpers/panel_helper.rb
Original file line number Diff line number Diff line change
@@ -16,21 +16,25 @@ def panel_block(**args, &block)
**args.except(*panel_inner_args)
) do
concat(heading)
if args[:panel_bodies].present?
concat(panel_bodies(args))
elsif args[:collapse].present?
concat(panel_collapse_body(args, content))
else
concat(panel_body(args, content))
end
concat(panel_body_or_bodies(args, content))
concat(footer)
end
end

def panel_body_or_bodies(args, content)
if args[:panel_bodies].present?
panel_bodies(args)
elsif args[:collapse].present?
panel_collapse_body(args, content)
else
panel_body(args, content)
end
end

# Args passed to panel components that are not applied to the outer div.
def panel_inner_args
[:class, :inner_class, :inner_id, :heading, :heading_links, :panel_bodies,
:collapse, :open, :footer].freeze
:collapse, :collapse_message, :open, :footer].freeze
end

def panel_heading(args)
@@ -67,15 +71,19 @@ def panel_heading_collapse_elements(args)
aria: { expanded: args[:open], controls: args[:collapse] }
) do
[args[:heading],
tag.span(panel_collapse_icons, class: "float-right")].safe_join
tag.span(panel_collapse_icons(args), class: "float-right")].safe_join
end
end
end

# The caret icon that indicates toggling the panel open/collapsed.
def panel_collapse_icons
[link_icon(:chevron_down, title: :OPEN.l, class: "active-icon"),
link_icon(:chevron_up, title: :CLOSE.l)].safe_join
def panel_collapse_icons(args)
if (message = args[:collapse_message]).present?
message = tag.span(message, class: "font-weight-normal mr-2")
end
[message,
link_icon(:chevron_down, title: :OPEN.l, class: "active-icon"),
link_icon(:chevron_up, title: :CLOSE.l)].compact_blank.safe_join
end

# Some panels need multiple panel bodies. Potentially collapse the last one.