Class: LesliView::Elements::Table
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- LesliView::Elements::Table
- Defined in:
- lib/lesli_view/elements/table.rb
Defined Under Namespace
Classes: TableRow
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#headless ⇒ Object
readonly
Returns the value of attribute headless.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#loading ⇒ Object
readonly
Returns the value of attribute loading.
-
#pagination ⇒ Object
readonly
Returns the value of attribute pagination.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
-
#initialize(columns: nil, records: nil, id: nil, class_name: "is-striped", pagination: nil, loading: false, headless: false, link: nil) ⇒ Table
constructor
A new instance of Table.
- #table_body_class(column) ⇒ Object
- #table_header_class(column) ⇒ Object
Constructor Details
#initialize(columns: nil, records: nil, id: nil, class_name: "is-striped", pagination: nil, loading: false, headless: false, link: nil) ⇒ Table
Returns a new instance of Table.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/lesli_view/elements/table.rb', line 40 def initialize(columns: nil, records: nil, id: nil, class_name: "is-striped", pagination: nil, loading: false, headless: false, link: nil) @id = id @class_name = class_name @pagination = pagination @loading = loading @headless = headless @columns = columns @records = records @link = link end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def class_name @class_name end |
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def columns @columns end |
#headless ⇒ Object (readonly)
Returns the value of attribute headless.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def headless @headless end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def id @id end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def link @link end |
#loading ⇒ Object (readonly)
Returns the value of attribute loading.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def loading @loading end |
#pagination ⇒ Object (readonly)
Returns the value of attribute pagination.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def pagination @pagination end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
36 37 38 |
# File 'lib/lesli_view/elements/table.rb', line 36 def records @records end |
Instance Method Details
#table_body_class(column) ⇒ Object
55 56 57 |
# File 'lib/lesli_view/elements/table.rb', line 55 def table_body_class(column) column[:field] == "id" || column[:align] == "center" ? "has-text-centered" : "" end |
#table_header_class(column) ⇒ Object
51 52 53 |
# File 'lib/lesli_view/elements/table.rb', line 51 def table_header_class(column) column[:field] == "id" || column[:align] == "center" ? "has-text-centered" : "" end |