Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airhorns/trestle-jsoneditor
https://github.com/airhorns/trestle-jsoneditor
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/airhorns/trestle-jsoneditor
- Owner: airhorns
- License: lgpl-3.0
- Created: 2020-02-27T16:21:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-09T14:58:32.000Z (almost 3 years ago)
- Last Synced: 2024-06-11T17:22:10.632Z (5 months ago)
- Language: Ruby
- Homepage:
- Size: 383 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trestle jsoneditor Integration (trestle-jsoneditor)
> [JSONEditor](https://github.com/josdejong/jsoneditor) integration plugin for the Trestle admin framework
## Getting Started
These instructions assume you have a working Trestle application. To integrate trestle-jsoneditor, first add it to your application's Gemfile:
```ruby
gem 'trestle-jsoneditor'
```Run `bundle install`, and then restart your Rails server.
To add a JSONEditor editor to your form, use the `editor` (or `JSONEditor`) field type:
```ruby
Trestle.resource(:articles) do
form do |article|
json_editor :internal_json_blob
end
end
```JSONEditor can be configured by defining options within `config/initializers/trestle.rb`. See https://github.com/josdejong/jsoneditor/blob/master/docs/api.md#configuration-options for the full list of configuration options. Configuration keys will be camel-cased when passed to JSONEditor.
```ruby
Trestle.configure do |config|
config.jsoneditor.configure do |c|
c.mode = "tree"
end
end
```## License
The gem is available as open source under the terms of the [LGPLv3 License](https://opensource.org/licenses/LGPL-3.0).
## Thanks
This gem is a pretty close port of https://github.com/TrestleAdmin/trestle-simplemde by Sam Pohlenz, also the creator of Trestle. Thanks Sam!