Class: Mxrb::Dsl::PageBuilder
- Inherits:
-
Object
- Object
- Mxrb::Dsl::PageBuilder
show all
- Includes:
- WidgetDsl
- Defined in:
- lib/mxrb/dsl/builder.rb
Instance Method Summary
collapse
Methods included from WidgetDsl
#button, #check_box, #container, #data_grid, #date_picker, #drop_down, #native_widget, #number_input, #pluggable_widget, #reference_selector, #snippet, #tab_control, #text, #text_area, #text_box
Constructor Details
Returns a new instance of PageBuilder.
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
|
# File 'lib/mxrb/dsl/builder.rb', line 1113
def initialize(name)
@name = name.to_s
@layout = "Atlas_Default"
@title = name.to_s
@popup = false
@data_source = nil
@events = []
@widgets = []
@allowed_roles = nil
@deep_structure = nil
end
|
Instance Method Details
#allowed_roles(*roles) ⇒ Object
1141
1142
1143
|
# File 'lib/mxrb/dsl/builder.rb', line 1141
def allowed_roles(*roles)
@allowed_roles = roles.map(&:to_s)
end
|
#bson_binary(base64, subtype: :generic) ⇒ Object
1137
1138
1139
|
# File 'lib/mxrb/dsl/builder.rb', line 1137
def bson_binary(base64, subtype: :generic)
BSON::Binary.new(Base64.strict_decode64(base64), subtype.to_sym)
end
|
#data_source(query: nil, microflow: nil, nanoflow: nil) ⇒ Object
1145
1146
1147
1148
1149
|
# File 'lib/mxrb/dsl/builder.rb', line 1145
def data_source(query: nil, microflow: nil, nanoflow: nil)
choices = { microflow: microflow || query, nanoflow: nanoflow }.compact
raise ArgumentError, "data_source requires exactly one target" unless choices.size == 1
@data_source = { kind: choices.keys.first, name: choices.values.first.to_s }
end
|
#deep_structure(value) ⇒ Object
Full, editable Mendix page payload for structures without a concise
typed DSL yet (layout grids, custom widgets, list views, etc.).
1131
1132
1133
1134
1135
|
# File 'lib/mxrb/dsl/builder.rb', line 1131
def deep_structure(value)
raise ArgumentError, "deep_structure requires a Hash" unless value.is_a?(Hash)
@deep_structure = value
end
|
#layout(l) ⇒ Object
1125
|
# File 'lib/mxrb/dsl/builder.rb', line 1125
def layout(l) = (@layout = l)
|
1127
|
# File 'lib/mxrb/dsl/builder.rb', line 1127
def = (@popup = true)
|
#title(t) ⇒ Object
1126
|
# File 'lib/mxrb/dsl/builder.rb', line 1126
def title(t) = (@title = t)
|
#to_h ⇒ Object
1162
1163
1164
1165
1166
1167
1168
|
# File 'lib/mxrb/dsl/builder.rb', line 1162
def to_h
{
name: @name, layout: @layout, title: @title, popup: @popup,
data_source: @data_source, events: @events, widgets: @widgets,
allowed_roles: @allowed_roles, deep_structure: @deep_structure
}
end
|