Class: Katalyst::Tables::EmptyCaptionComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
HtmlAttributes
Defined in:
app/components/katalyst/tables/empty_caption_component.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(table, **html_attributes) ⇒ EmptyCaptionComponent

Returns a new instance of EmptyCaptionComponent.



8
9
10
11
12
# File 'app/components/katalyst/tables/empty_caption_component.rb', line 8

def initialize(table, **html_attributes)
  super(**html_attributes)

  @table = table
end

Instance Method Details

#clear_filters_pathObject



22
23
24
# File 'app/components/katalyst/tables/empty_caption_component.rb', line 22

def clear_filters_path
  url_for
end

#filtered?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/components/katalyst/tables/empty_caption_component.rb', line 18

def filtered?
  @table.collection.respond_to?(:filtered?) && @table.collection.filtered?
end

#inspectObject



31
32
33
# File 'app/components/katalyst/tables/empty_caption_component.rb', line 31

def inspect
  "#<#{self.class.name}>"
end

#plural_human_model_nameObject



26
27
28
29
# File 'app/components/katalyst/tables/empty_caption_component.rb', line 26

def plural_human_model_name
  human = @table.model_name&.human || @table.object_name&.to_s&.humanize || "record"
  human.pluralize.downcase
end

#render?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/components/katalyst/tables/empty_caption_component.rb', line 14

def render?
  @table.collection.empty?
end