Class: Glib::JsonUi::ViewBuilder

Inherits:
AbstractBuilder show all
Defined in:
app/helpers/glib/json_ui/view_builder.rb,
app/helpers/glib/json_ui/view_builder/iap.rb,
app/helpers/glib/json_ui/view_builder/charts.rb,
app/helpers/glib/json_ui/view_builder/fields.rb,
app/helpers/glib/json_ui/view_builder/panels.rb,
app/helpers/glib/json_ui/view_builder/banners.rb,
app/helpers/glib/json_ui/view_builder/multimedia.rb

Defined Under Namespace

Modules: Banners, Charts, Fields, Iap, Multimedia, Panels Classes: AbstractText, AppBar, Avatar, Button, Calendar, Chip, Datetime, Fab, H1, H2, H3, H4, H5, H6, Hr, Html, Icon, Image, Label, Map, Markdown, P, ProgressBar, ProgressCircle, ShareButton, Spacer, Switch, TabBar, TreeView, View

Instance Attribute Summary

Attributes inherited from AbstractBuilder

#json, #page

Instance Method Summary collapse

Constructor Details

#initialize(json, page, multiple) ⇒ ViewBuilder

Returns a new instance of ViewBuilder.



19
20
21
22
23
# File 'app/helpers/glib/json_ui/view_builder.rb', line 19

def initialize(json, page, multiple)
  super(json, page)

  @multiple = multiple
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



37
38
39
# File 'app/helpers/glib/json_ui/view_builder.rb', line 37

def method_missing(m, *args)
  add_view m, *args
end

Instance Method Details

#add_singleton_view(name, *args) ⇒ Object



33
34
35
# File 'app/helpers/glib/json_ui/view_builder.rb', line 33

def add_singleton_view(name, *args)
  add_singleton_element 'view', name, *args
end

#add_view(name, *args) ⇒ Object



25
26
27
28
29
30
31
# File 'app/helpers/glib/json_ui/view_builder.rb', line 25

def add_view(name, *args)
  if @multiple
    add_element_to_array_v1 'view', name, *args
  else
    add_singleton_element_v1 'view', name, *args
  end
end

#form_if_not_exists(*args) ⇒ Object



41
42
43
44
45
46
47
# File 'app/helpers/glib/json_ui/view_builder.rb', line 41

def form_if_not_exists(*args)
  if page.current_form
    panels_responsive(*args)
  else
    panels_form(*args)
  end
end