Class: Glib::JsonUi::PageHelper::Page
- Inherits:
-
Object
- Object
- Glib::JsonUi::PageHelper::Page
- Defined in:
- app/helpers/glib/json_ui/page_helper.rb
Instance Attribute Summary collapse
-
#action_builder ⇒ Object
readonly
Returns the value of attribute action_builder.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#current_form ⇒ Object
See Panels::Form.
-
#drawer_content_builder ⇒ Object
readonly
Returns the value of attribute drawer_content_builder.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#list_section_builder ⇒ Object
readonly
Returns the value of attribute list_section_builder.
-
#menu_builder ⇒ Object
readonly
Returns the value of attribute menu_builder.
-
#split_content_builder ⇒ Object
readonly
Returns the value of attribute split_content_builder.
-
#table_section_builder ⇒ Object
readonly
Returns the value of attribute table_section_builder.
-
#view_builder ⇒ Object
readonly
Returns the value of attribute view_builder.
Instance Method Summary collapse
- #body(options = {}) ⇒ Object
- #data(options = {}) ⇒ Object
- #footer(options = {}) ⇒ Object
- #form(options = {}) ⇒ Object
- #header(options = {}) ⇒ Object
-
#initialize(json, context) ⇒ Page
constructor
A new instance of Page.
- #leftDrawer(options = {}) ⇒ Object
- #list(options = {}) ⇒ Object
- #navBar(options = {}) ⇒ Object
- #rightNavButtons ⇒ Object
- #scroll(options = {}) ⇒ Object
- #table(options = {}) ⇒ Object
- #template(template) ⇒ Object
- #vertical_content(options) ⇒ Object
Constructor Details
#initialize(json, context) ⇒ Page
Returns a new instance of Page.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 27 def initialize(json, context) @json = json @context = context @view_builder = ViewBuilder.new(json, self, true) @action_builder = ActionBuilder.new(json, self) @menu_builder = MenuBuilder.new(json, self) @list_section_builder = ListBuilders::Section.new(json, self, ListBuilders::Template.new(json, self)) @drawer_content_builder = ListBuilders::Section.new(json, self, @menu_builder) @table_section_builder = TableBuilders::Section.new(json, self, TableBuilders::Template.new(json, self)) @split_content_builder = SplitBuilders::Content.new(json, self, @view_builder) end |
Instance Attribute Details
#action_builder ⇒ Object (readonly)
Returns the value of attribute action_builder.
21 22 23 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 21 def action_builder @action_builder end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
21 22 23 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 21 def context @context end |
#current_form ⇒ Object
See Panels::Form
25 26 27 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 25 def current_form @current_form end |
#drawer_content_builder ⇒ Object (readonly)
Returns the value of attribute drawer_content_builder.
22 23 24 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 22 def drawer_content_builder @drawer_content_builder end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
21 22 23 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 21 def json @json end |
#list_section_builder ⇒ Object (readonly)
Returns the value of attribute list_section_builder.
22 23 24 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 22 def list_section_builder @list_section_builder end |
#menu_builder ⇒ Object (readonly)
Returns the value of attribute menu_builder.
21 22 23 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 21 def @menu_builder end |
#split_content_builder ⇒ Object (readonly)
Returns the value of attribute split_content_builder.
22 23 24 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 22 def split_content_builder @split_content_builder end |
#table_section_builder ⇒ Object (readonly)
Returns the value of attribute table_section_builder.
22 23 24 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 22 def table_section_builder @table_section_builder end |
#view_builder ⇒ Object (readonly)
Returns the value of attribute view_builder.
21 22 23 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 21 def view_builder @view_builder end |
Instance Method Details
#body(options = {}) ⇒ Object
82 83 84 85 86 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 82 def body( = {}) json.body do vertical_content() end end |
#data(options = {}) ⇒ Object
118 119 120 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 118 def data( = {}) [:content].call(ViewBuilder.new(json, self, false)) end |
#footer(options = {}) ⇒ Object
76 77 78 79 80 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 76 def ( = {}) json. do vertical_content() end end |
#form(options = {}) ⇒ Object
112 113 114 115 116 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 112 def form( = {}) scroll childViews: ->(scroll) do @view_builder.add_view('panels_form', .reverse_merge(width: 'matchParent')) end end |
#header(options = {}) ⇒ Object
70 71 72 73 74 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 70 def header( = {}) json.header do vertical_content() end end |
#leftDrawer(options = {}) ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 51 def leftDrawer( = {}) json.leftDrawer do [:styleClasses].each do |name| if (value = .delete(name)) json.set! name, value end end [:content]&.call drawer_content_builder end end |
#list(options = {}) ⇒ Object
88 89 90 91 92 93 94 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 88 def list( = {}) json.body do json.childViews do @view_builder.add_view('panels_list', .reverse_merge(width: 'matchParent')) end end end |
#navBar(options = {}) ⇒ Object
62 63 64 65 66 67 68 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 62 def navBar( = {}) json.navBar do json.rightItems do [:rightItems]&.call @menu_builder end end end |
#rightNavButtons ⇒ Object
41 42 43 44 45 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 41 def rightNavButtons json.rightNavButtons do yield @menu_builder end end |
#scroll(options = {}) ⇒ Object
104 105 106 107 108 109 110 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 104 def scroll( = {}) json.body do json.childViews do @view_builder.add_view('panels_scroll', .reverse_merge(width: 'matchParent')) end end end |
#table(options = {}) ⇒ Object
96 97 98 99 100 101 102 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 96 def table( = {}) json.body do json.childViews do @view_builder.add_view('panels_table', .reverse_merge(width: 'matchParent')) end end end |
#template(template) ⇒ Object
47 48 49 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 47 def template(template) json.template template end |
#vertical_content(options) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'app/helpers/glib/json_ui/page_helper.rb', line 122 def vertical_content() = .reverse_merge(width: 'matchParent') [:padding, :backgroundColor, :width, :height, :align].each do |name| if (value = .delete(name)) json.set! name, value end end json.childViews do if (childViews = .delete(:childViews)) childViews.call @view_builder end end raise "Invalid properties: #{.keys}" if .size > 0 end |