Class: Glib::JsonUi::ViewBuilder::Panels::Table2
- Inherits:
-
View
- Object
- JsonUiElement
- View
- Glib::JsonUi::ViewBuilder::Panels::Table2
- Defined in:
- app/helpers/glib/json_ui/view_builder/panels.rb
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Attributes inherited from JsonUiElement
Instance Method Summary collapse
- #header(options = {}) ⇒ Object
-
#initialize(json, page) ⇒ Table2
constructor
A new instance of Table2.
- #rows(options = {}) ⇒ Object
Methods inherited from View
Methods inherited from JsonUiElement
Constructor Details
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
342 343 344 |
# File 'app/helpers/glib/json_ui/view_builder/panels.rb', line 342 def template @template end |
Instance Method Details
#header(options = {}) ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'app/helpers/glib/json_ui/view_builder/panels.rb', line 353 def header( = {}) json.header do json.backgroundColor .delete(:backgroundColor) json.cellViews do .delete(:cellViews)&.call page.view_builder end json.colSpans .delete(:colSpans) end raise "Invalid properties: #{.keys}" if .size > 0 end |
#rows(options = {}) ⇒ Object
366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'app/helpers/glib/json_ui/view_builder/panels.rb', line 366 def rows( = {}) block = .delete(:builder) json.rows do if (objects = .delete(:objects)) objects.each_with_index do |object, index| block&.call template, object, index end else block&.call template end end raise "Invalid properties: #{.keys}" if .size > 0 end |