Class: Cmdk::Empty

Inherits:
Base
  • Object
show all
Defined in:
lib/cmdk/empty.rb

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

Base::SR_ONLY_STYLE

Instance Method Summary collapse

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)
end