Class: Uchi::Ui::SearchInput
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Uchi::Ui::SearchInput
- Defined in:
- app/components/uchi/ui/search_input.rb
Overview
Renders a labelled search input with a submit button, for use inside a
form_tag. This is the shared building block behind both the global
search form and each repository's index page search form.
Based on Flowbite's Simple search input (https://flowbite.com/docs/forms/search-input/#simple-search-input)
Instance Attribute Summary collapse
-
#autofocus ⇒ Object
readonly
Returns the value of attribute autofocus.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(autofocus: false, label: nil, query: nil) ⇒ SearchInput
constructor
A new instance of SearchInput.
Constructor Details
#initialize(autofocus: false, label: nil, query: nil) ⇒ SearchInput
Returns a new instance of SearchInput.
14 15 16 17 18 19 |
# File 'app/components/uchi/ui/search_input.rb', line 14 def initialize(autofocus: false, label: nil, query: nil) super() @autofocus = autofocus @label = label || Uchi::I18n.translate("search.label", default: "Search") @query = query end |
Instance Attribute Details
#autofocus ⇒ Object (readonly)
Returns the value of attribute autofocus.
12 13 14 |
# File 'app/components/uchi/ui/search_input.rb', line 12 def autofocus @autofocus end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
12 13 14 |
# File 'app/components/uchi/ui/search_input.rb', line 12 def label @label end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
12 13 14 |
# File 'app/components/uchi/ui/search_input.rb', line 12 def query @query end |