Skip to content

Commit

Permalink
Add some pattern search field helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
nimmolo committed Aug 26, 2024
1 parent 6517d2f commit 7520344
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions app/helpers/pattern_search_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

# helpers for pattern search forms. These call field helpers in forms_helper.
# args should provide form, field, label at a minimum.
module PatternSearchHelper
def pattern_search_boolean_field(**args)
options = [
["", null],
["yes", "yes"],
["no", "no"]
]
select_with_label(options:, **args)
end

def pattern_search_yes_field(**args)
check_box_with_label(value: "yes", **args)
end

def pattern_search_yes_no_both_field(**args)
options = [
["", null],
["yes", "yes"],
["no", "no"],
["both", "either"]
]
select_with_label(options:, **args)
end
end

0 comments on commit 7520344

Please sign in to comment.