btheado / jsoneditor

TiddlyWiki plugin for creating json forms using json schema
BSD 2-Clause "Simplified" License
9 stars 3 forks source link

Grid View? #1

Closed joshuafontany closed 5 years ago

joshuafontany commented 8 years ago

Just playing around with your example wiki, very cool. Does the tiddlywiki version of JSONEditor support the "format": "grid" schema-property? Reference: https://github.com/jdorn/json-editor#objects Example(change the 'Object Layout' dropdown from normal to grid): http://jeremydorn.com/json-editor/

I've added that line to various places in the Person json-schema, to no effect so far. Thanks!

btheado commented 8 years ago

Yes, the grid layout requires a compatible CSS framework as listed in the optional requirements section of https://github.com/jdorn/json-editor and I left out the CSS entirely when packaging the library as a plugin.

joshuafontany commented 8 years ago

Ah, makes sense. Would you know of any references for integrating Bootstrap 3 into Tiddlywiki? Or should it be relatively straightforward?

Thanks again for the plugin. :D

btheado commented 8 years ago

I'm glad you like it and thanks for letting me know. Stylesheets in general are pretty straightforward in Tiddlywiki as described at http://tiddlywiki.com/#Using%20Stylesheets. I just tried those instructions with https://btheado.github.io/jsoneditor.html and the result was not pretty.

  1. Open http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css in your browser and select all and copy to clipboard
  2. Open https://btheado.github.io/jsoneditor.html in your browser
  3. Create new tiddler titled "bootstrap" or whatever.
  4. Paste clipboard contents into the body of the tiddler
  5. Add the $:/tags/Stylesheet tag to the tiddler
  6. Save the tiddler

The stylesheet should now be applied and the json form becames misaligned and unreadable :-(. Not sure if it is due to some conflict the the tiddlywiki styles or if it is some other problem.

joshuafontany commented 8 years ago

Thanks for the quick check.

I have been reading up on Boostrap3 since finding your plugin, and it looks like there is a *.js component to it as well (that I'll have to install to Tiddlywiki somehow). Maybe the Tiddlywiki group guys have some tips along the lines of the FontAwesome stuff.

To explain my use-case, I'm building a Roleplaying Game Character Database in Tiddlywiki, and needed a good way to "edit" a character JSON. The grid view will be useful for those "blocks of stats" like: Strength X (+/- Y modifier) Dexterity X (+/- Y modifier) Constitution X (+/- Y modifier)

Intelligence X (+/- Y modifier) Wisdom X (+/- Y modifier) Charisma X (+/- Y modifier)

I'll try to post back here if I can get something cool working. :)

On Tue, Nov 3, 2015 at 5:46 PM, btheado notifications@github.com wrote:

I'm glad you like it and thanks for letting me know. Stylesheets in general are pretty straightforward in Tiddlywiki as described at http://tiddlywiki.com/#Using%20Stylesheets. I just tried those instructions with https://btheado.github.io/jsoneditor.html and the result was not pretty.

  1. Open http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css in your browser and select all and copy to clipboard
  2. Open https://btheado.github.io/jsoneditor.html in your browser
  3. Create new tiddler titled "bootstrap" or whatever.
  4. Paste clipboard contents into the body of the tiddler
  5. Add the $:/tags/Stylesheet tag to the tiddler
  6. Save the tiddler

The stylesheet should now be applied and the json form becames misaligned and unreadable :-(. Not sure if it is due to some conflict the the tiddlywiki styles or if it is some other problem.

— Reply to this email directly or view it on GitHub https://github.com/btheado/jsoneditor/issues/1#issuecomment-153544871.

tobibeer commented 8 years ago

@btheado, as answered here please reopen #1:

Looking at the code of the widget, I am thinking that this function is problematic / incomplete:

JSONEditorWidget.prototype.getOptionsFromAttributes = function() { ... }
btheado commented 8 years ago

As a first step, I checked in code which adds support for the the theme option. These instructions now work to get the bootstrap theme:

  1. Open http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css in your browser and select all and copy to clipboard
  2. Open https://btheado.github.io/jsoneditor.html in your browser
  3. Create new tiddler titled "bootstrap" or whatever.
  4. Paste clipboard contents into the body of the tiddler
  5. Add the $:/tags/Stylesheet tag to the tiddler
  6. Save the tiddler
  7. Edit the $:/plugins/btheado/jsoneditor/usage tiddler and add theme="bootstrap3" to all the widget examples.

You should now see the bootstrap theming applied to the forms.

Then add format="grid" to one of the example shema and you should see the fields aligned side-by-side.

joshuafontany commented 5 years ago

Swinging back through. Nice change. Closing.