Module: Engine2::ActionAPISupport
- Included in:
- ActionFormSupport, ActionListSupport, Engine2::ActionOnChangeSupport::OnChangeAction, ActionViewSupport, DecodeAction, InfraAction
- Defined in:
- lib/engine2/action.rb
Instance Method Summary collapse
- #config ⇒ Object
- #decorate(list) ⇒ Object
- #field_filter(*flds, filter) ⇒ Object
- #fields(field) ⇒ Object
- #fields!(*fields, options) ⇒ Object
- #hide_fields(*flds) ⇒ Object
- #loc!(hash) ⇒ Object
- #render(field, options) ⇒ Object
- #show_fields(*flds) ⇒ Object
Instance Method Details
#config ⇒ Object
248 249 250 |
# File 'lib/engine2/action.rb', line 248 def config @meta[:config] ||= {} end |
#decorate(list) ⇒ Object
263 264 265 266 267 |
# File 'lib/engine2/action.rb', line 263 def decorate list list.each do |f| fields(f)[:loc] ||= LOCS[f.to_sym] end end |
#field_filter(*flds, filter) ⇒ Object
281 282 283 |
# File 'lib/engine2/action.rb', line 281 def field_filter *flds, filter fields! *flds, filter: filter end |
#fields(field) ⇒ Object
244 245 246 |
# File 'lib/engine2/action.rb', line 244 def fields field (@meta[:fields] ||= {})[field.to_sym] ||= {} end |
#fields!(*fields, options) ⇒ Object
252 253 254 255 256 257 |
# File 'lib/engine2/action.rb', line 252 def fields! *fields, raise E2Error.new("No fields given to info") if fields.empty? fields.each do |field| fields(field).merge! # rmerge ? end end |
#hide_fields(*flds) ⇒ Object
273 274 275 |
# File 'lib/engine2/action.rb', line 273 def hide_fields *flds fields! *flds, hidden: true end |
#loc!(hash) ⇒ Object
259 260 261 |
# File 'lib/engine2/action.rb', line 259 def loc! hash (@meta[:loc] ||= {}).merge! hash end |
#render(field, options) ⇒ Object
269 270 271 |
# File 'lib/engine2/action.rb', line 269 def render field, fields! field, render: end |
#show_fields(*flds) ⇒ Object
277 278 279 |
# File 'lib/engine2/action.rb', line 277 def show_fields *flds fields! *flds, hidden: false end |