This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Instructions #2
Comments
I'm sorry, I didn't got the time to write a proper readme and release. I'm also not sure if this package runs properly on current releases of ruby, rails and rails-admin. Please advice! I do use it in 2 production apps without any problems though :) Some notes to get you on the way:
field :components_json, :json_editor do
label 'Components'
help ''
schema do
model 'image' do |c|
c.label 'Image'
c.field :image, :picker do |f|
f.picker model: Image, preview_image_field: :cdn_url
end
c.field :caption, :string
c.field :size, :enum do |f|
f.enum ['large', 'small']
end
c.field :modal_enabled, :boolean do |f|
f.label 'Fullscreen'
end
end
model 'quote' do |c|
c.field :body, :text
c.field :cite, :string
end
model 'image-text-list' do |c|
c.label 'List of images and text'
c.field :items, :list do |f|
f.list ['image-text-list-item']
end
end
model 'inset' do |c|
c.label 'Inset'
c.field :body, :text
c.field :components, :list do |f|
f.list ['image-text-list'], max_length:1
end
end
model 'video' do |c|
c.label 'Video'
c.field :vimeo_url, :string
end
# and so on...
end
end I think those are the options and types you have. I'll be happy to assist further on (and hopefully make a proper release of this any time soon..) |
You could also take a look at lib/rails_admin_json_editor.rb and app/views/rails_admin_json_editor/main/component_fields for further options. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I’ve got a model attribute whose type is ‘json’ that I’d like to edit within RailsAdmin’s interface. Based on the name of your gem it seems like a good fit - but I don’t know how to use it ? I did try installing it hoping that through the ‘magic of rails’ (perhaps via introspection) it would just work - but it did not.
How does one use this gem ?
Thanks
Dave
The text was updated successfully, but these errors were encountered: