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



92
93
94
95
96
# File 'app/helpers/glib/json_ui/view_builder.rb', line 92

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



110
111
112
# File 'app/helpers/glib/json_ui/view_builder.rb', line 110

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

Instance Method Details

#add_singleton_view(name, *args) ⇒ Object



106
107
108
# File 'app/helpers/glib/json_ui/view_builder.rb', line 106

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

#add_view(name, *args) ⇒ Object



98
99
100
101
102
103
104
# File 'app/helpers/glib/json_ui/view_builder.rb', line 98

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



114
115
116
117
118
119
120
# File 'app/helpers/glib/json_ui/view_builder.rb', line 114

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