Class: Alchemy::Admin::Resource::Header

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/alchemy/admin/resource/header.rb

Overview

Renders a table header tag the component is an internal component of the Table component

Instance Method Summary collapse

Constructor Details

#initialize(name, query, css_classes: "", text: nil, type: :string, sortable: false) ⇒ Header

Returns a new instance of Header.



35
36
37
38
39
40
41
42
# File 'app/components/alchemy/admin/resource/header.rb', line 35

def initialize(name, query, css_classes: "", text: nil, type: :string, sortable: false)
  @name = name
  @query = query
  @text = text || name
  @css_classes = css_classes
  @default_order = /date|time/.match?(type.to_s) ? "desc" : "asc"
  @sortable = sortable
end