Class: NitroKit::CommandPalette::Results
- Inherits:
-
NitroKit::Component
- Object
- Phlex::HTML
- NitroKit::Component
- NitroKit::CommandPalette::Results
- Defined in:
- app/components/nitro_kit/command_palette.rb
Constant Summary
Constants inherited from NitroKit::Component
NitroKit::Component::ADDITIVE_DATA_ATTRIBUTES, NitroKit::Component::COMPONENT_OWNED_DATA_ATTRIBUTES, NitroKit::Component::FORBIDDEN_ATTRIBUTES, NitroKit::Component::RESERVED_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(id:, html: {}, aria: {}, data: {}, desperately_need_a_class: nil) ⇒ Results
constructor
A new instance of Results.
- #view_template(&block) ⇒ Object
Constructor Details
#initialize(id:, html: {}, aria: {}, data: {}, desperately_need_a_class: nil) ⇒ Results
Returns a new instance of Results.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/components/nitro_kit/command_palette.rb', line 60 def initialize( id:, html: {}, aria: {}, data: {}, desperately_need_a_class: nil ) @identifier = validate_id!("CommandPalette id:", id) @destinations = [] super( component: :command_palette_results, attributes: { id: frame_id, target: "_top", data: { nk__command_palette_target: "frame", action: [ "turbo:before-fetch-request->nk--command-palette#loading", "turbo:frame-load->nk--command-palette#loaded" ].join(" ") } }, html:, aria:, data:, desperately_need_a_class: ) end |
Instance Method Details
#view_template(&block) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'app/components/nitro_kit/command_palette.rb', line 90 def view_template(&block) @collecting = true yield(self) if block tag(:"turbo-frame", **root_attributes) do nav( **slot_attributes( :results, attributes: { id: results_id, aria: { labelledby: title_id } } ) ) do @destinations.each_with_index { |destination, index| render_destination(destination, index) } end end ensure @collecting = false end |