Class: Cmdk::Empty
Overview
Shown automatically when there are no results. Port of ‘<Command.Empty>`. Rendered hidden (inline display:none, so theme CSS cannot override it); the runtime toggles it based on the filtered result count.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ Empty
constructor
A new instance of Empty.
- #view_template(&block) ⇒ Object
Constructor Details
#initialize(**attributes) ⇒ Empty
Returns a new instance of Empty.
6 7 8 |
# File 'lib/cmdk/empty.rb', line 6 def initialize(**attributes) @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
10 11 12 13 |
# File 'lib/cmdk/empty.rb', line 10 def view_template(&block) defaults = { 'cmdk-empty' => '', role: 'presentation', style: 'display:none' } div(**merged(defaults, @attributes)) { block ? block.call : nil } end |