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, 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.



4
5
6
7
8
# File 'app/helpers/glib/json_ui/view_builder.rb', line 4

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



22
23
24
# File 'app/helpers/glib/json_ui/view_builder.rb', line 22

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

Instance Method Details

#add_singleton_view(name, *args) ⇒ Object



18
19
20
# File 'app/helpers/glib/json_ui/view_builder.rb', line 18

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

#add_view(name, *args) ⇒ Object



10
11
12
13
14
15
16
# File 'app/helpers/glib/json_ui/view_builder.rb', line 10

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



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

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