GithubHelp home page GithubHelp logo

eddietejeda / administrate-field-json Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 29.0 715 KB

A plugin to show and edit JSON objects within Administrate.

License: MIT License

Ruby 44.22% JavaScript 24.92% CSS 6.94% HTML 23.92%

administrate-field-json's People

Contributors

bryanbraun avatar eddietejeda avatar jrnk avatar maurcarvalho avatar nickcharlton avatar thebenedict avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

administrate-field-json's Issues

administrate-field-json.js not loading

Thanks very much for making a json field, exactly what I'm looking for.

On install (Rails 4.2.0, Administrate 0.2.2) the javascript doesn't load for me. I notice that administrate-field-json.js is in an administrate-field-json subdirectory of assets, i.e. /app/assets/javascripts/administrate-field-json/administrate-field-json.js

So I have to change:

Administrate::Engine.add_javascript "administrate-field-json"

to

Administrate::Engine.add_javascript "administrate-field-json/administrate-field-json"

in /lib/administrate/field/json.rb in order to load the javascript.

Is there a reason for the subdirectory, or a different approach you prefer? Removing the subdirectory also fixes the issue for me. Happy to submit a PR with either.

Do you intend to release this under an open source license? Very interested in using and contributing.

jsoneditor-icons.svg not loading in production

image

Are they working for anyone else? The scripts in package.json move jsoneditor-icons.svg to vendor/assets/images, and then sed -i.bak 's/img/\\/assets/g'. Since Sprockets notoriously doesn't generate non-digested assets in Rails 4, this simple path substitution doesn't work because a fingerprint gets added to the jsoneditor-icons.svg filename.

Am I missing something, or other ideas? If not I'll submit a fix. My first thought is to move the .svg file to /public instead of /vendor/assets/images.

Using in show view

how do I get this to work in the show view? I was able to get it to render correctly, but the it is not disabled

_show.hml.erb

<div class="field-unit__field administrate-jsoneditor">
  <%= text_area field.attribute, nil, value: JSON.pretty_generate(field.data), disabled: true   %>
</div>

JSON::GeneratorError

JSON::GeneratorError - only generation of JSON objects or arrays allowed:
  .../ruby-2.3.3/lib/ruby/2.3.0/json/common.rb:286:in `pretty_generate'

screen shot 2017-03-28 at 9 54 41 am

A string is being passed to state.generate(obj) instead of a JSON object.

Administrate 0.3 Support

Thanks for producing this gem, I'm having some trouble regarding Administrate treating my JSON attributes as String.

I am unable to use this gem with the latest version of Administrate, however:

Bundler could not find compatible versions for gem "administrate":
  In snapshot (Gemfile.lock):
    administrate (= 0.3.0)

  In Gemfile:
    administrate (~> 0.3.0)

    administrate-field-json was resolved to 0.0.2, which depends on
      administrate (~> 0.2.2)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

Administrate 0.3 is required to support Rails 5, which I am using.

Any plans to update to the latest version of Administrate? Thanks!

REQUESTING NEW MAINTAINER

I notice this project gets a bit of traffic. I don't have time to manage this anymore and this tool is no longer related to my work.

Anyone interested in taking over this project?

Publish gem to rubygems.org ?

First of all: thanks for making this! We had a need for the same in administrate, so a github search turned up your gem, however would you be able to push this to rubygems.org? Thanks for considering!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.