Class: Tiler::Panel

Inherits:
ApplicationRecord show all
Defined in:
app/models/tiler/panel.rb

Instance Method Summary collapse

Instance Method Details

#col_spanObject

Backwards-compat alias for templates that still call col_span.



52
53
54
# File 'app/models/tiler/panel.rb', line 52

def col_span
  width
end

#dataObject



47
48
49
# File 'app/models/tiler/panel.rb', line 47

def data
  widget.data
end

#parsed_configObject



33
34
35
36
37
# File 'app/models/tiler/panel.rb', line 33

def parsed_config
  JSON.parse(config.presence || "{}")
rescue JSON::ParserError
  {}
end

#widgetObject



39
40
41
# File 'app/models/tiler/panel.rb', line 39

def widget
  Tiler.widgets.fetch(widget_type).new(self)
end

#widget_labelObject



43
44
45
# File 'app/models/tiler/panel.rb', line 43

def widget_label
  Tiler.widgets[widget_type]&.label || widget_type.to_s.humanize
end