Class: AtomicAdmin::Interaction::JsonForm

Inherits:
Base
  • Object
show all
Defined in:
lib/atomic_admin/interaction/json_form.rb

Instance Attribute Summary

Attributes inherited from Base

#data, #icon, #key, #order, #title, #type

Instance Method Summary collapse

Constructor Details

#initialize(schema:, **kwargs) ⇒ JsonForm

Returns a new instance of JsonForm.



4
5
6
7
# File 'lib/atomic_admin/interaction/json_form.rb', line 4

def initialize(schema:, **kwargs)
  super(**kwargs)
  @schema_factory = schema
end

Instance Method Details

#resolve(**kwargs) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/atomic_admin/interaction/json_form.rb', line 9

def resolve(**kwargs)
  hash = super(**kwargs)

  schema = @schema_factory.new(**kwargs)
  hash[:schema] = schema.schema
  hash[:uischema] = schema.uischema

  hash
end