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

Bug/1954 form search #230

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
62 changes: 20 additions & 42 deletions pool/web/view/component/component_search.ml
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,27 @@ let create
@ exclude_roles_of)
;;

let search_item ~id ~title =
div
~a:[ a_user_data "id" id; a_class [ "has-icon"; "inset-xs" ] ]
[ Component_icon.(to_html ~classnames:[ "toggle-item" ] CloseCircle)
; span [ txt title ]
; input
~a:
[ a_input_type `Checkbox
; a_class [ "hidden" ]
; a_name Field.(array_key Value)
; a_value id
; a_checked ()
]
()
]
;;

module Experiment = struct
let item (id, title) =
let open Experiment in
div
~a:[ a_user_data "id" (Id.value id); a_class [ "has-icon"; "inset-xs" ] ]
[ Component_icon.(to_html ~classnames:[ "toggle-item" ] CloseCircle)
; span [ txt (Title.value title) ]
; input
~a:
[ a_input_type `Checkbox
; a_class [ "hidden" ]
; a_name Field.(array_key Value)
; a_value (Id.value id)
; a_checked ()
]
()
]
search_item ~id:(Id.value id) ~title:(Title.value title)
;;

let placeholder = "Search by experiment title"
Expand All @@ -130,20 +134,7 @@ end
module Location = struct
let item (id, name) =
let open Pool_location in
div
~a:[ a_user_data "id" (Id.value id); a_class [ "has-icon"; "inset-xs" ] ]
[ Component_icon.(to_html ~classnames:[ "toggle-item" ] CloseCircle)
; span [ txt (Name.value name) ]
; input
~a:
[ a_input_type `Checkbox
; a_class [ "hidden" ]
; a_name Field.(array_key Value)
; a_value (Id.value id)
; a_checked ()
]
()
]
search_item ~id:(Id.value id) ~title:(Name.value name)
;;

let placeholder = "Search by location name"
Expand All @@ -154,20 +145,7 @@ end
module Tag = struct
let item (id, title) =
let open Tags in
div
~a:[ a_user_data "id" (Id.value id); a_class [ "has-icon"; "inset-xs" ] ]
[ Component_icon.(to_html ~classnames:[ "toggle-item" ] CloseCircle)
; span [ txt (Title.value title) ]
; input
~a:
[ a_input_type `Checkbox
; a_class [ "hidden" ]
; a_name Field.(array_key Value)
; a_value (Id.value id)
; a_checked ()
]
()
]
search_item ~id:(Id.value id) ~title:(Title.value title)
;;

let placeholder = "Search by tag title"
Expand Down
2 changes: 1 addition & 1 deletion resources/admin/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const isListOperator = (operator) => {
const disableValueInput = (o) => ["empty", "not_empty"].includes(o)

const isQueryKey = (key) => {
return ["participation"].includes(key)
return ["participation", "tag"].includes(key)
}

const findChildPredicates = (wrapper) => {
Expand Down