[openbiblio-dev] JS editor component for BibJSON?

Tom Oinn tom.oinn at okfn.org
Mon Aug 6 09:31:24 UTC 2012


On 6 August 2012 10:23, Mark MacGillivray <mark at cottagelabs.com> wrote:
> On Mon, Aug 6, 2012 at 10:14 AM, Tom Oinn <tom.oinn at okfn.org> wrote:
>>
>> On 6 August 2012 10:06, Mark MacGillivray <mark at cottagelabs.com> wrote:
>> > check out jtedit and see if it helps you :
>> >
>> > https://github.com/CottageLabs/jtedit
>> >
>> >
>> > You may not want to use it as it stands, but the method it employs for
>> > presenting data on the page may be informative. I found that trying to
>> > present JSON in an editor was too restrictive when the JSON can have
>> > multiple levels of complexity, so instead it displays a simple text box
>> > with
>> > the JSON plus scans for input fields tagged with class .jtedit_blah, and
>> > when they change it updates the JSON. That way, when you know your
>> > complex
>> > JSON layout, you can design a page e.g. with lists, tables or whatever,
>> > and
>> > drop jtedit in to handle the updates.
>>
>> Oh, I've no intention of displaying anything that looks like JSON,
>> that would be a usability nightmare :)
>
>
> Absolutely.
>
>
>>
>> Is there a demo of jtedit
>> anywhere? The github page with 'docs are on the way' doesn't encourage
>> much further exploration!
>
>
> Indeed - it is just something I have been working on recently, but have not
> done much with it. What may help you is that it tracks text boxes with a
> given class, and inserts their values into a JSON object when they get
> changed. So if you pull that out, you could watch changes to fields on a
> page and trigger updates to a hidden JSON object. Then save that on change
> or on request.
>
> When users create a new part of a record, then as long as you can tag that
> with the right class and bind the functionality to it, you could make an
> editor that allows people to extend a JSON object by clicking around on a
> web page.
>
> As mentioned, it may not be of any use to you, but thought I would point it
> out.

Pretty similar to what I was planning to do, I suspect writing from
scratch will give me a cleaner end result but worth knowing about. I
was using backbone-forms, which was handy and worked well but I need
something custom to get it really compact for real use.

> Facetview now allows you to tell it in the settings how the results should
> be displayed. You can tell it how to wrap the entire result set - e.g. put
> it in a table, then tell it how to wrap each result object - e.g. wrap it in
> a row, and you can provide the result display layout as used in bibserver -
> e.g. you specify which fields of the record you want displayed, and what
> html you want pre and post each of those fields. Check out how this is done
> in bibserver as an example.

Yup, I'd seen that. What I'd really like is the ability to pass in a
function which accepts an element and a result object and is then left
to get on with populating the element with contents based on the
result, that would let me use e.g. a backbone view which I already and
mean I don't have to write a load of HTML in my code.

-- 
Tom Oinn
+44 (0) 20 8123 5142 or Skype ID 'tomoinn'
http://www.crypticsquid.com




More information about the openbiblio-dev mailing list