json-editor.js.coffee.erb 542 B

1234567891011121314
  1. window.setupJsonEditor = ($editors = $(".live-json-editor")) ->
  2. JSONEditor.prototype.ADD_IMG = '<%= image_path 'json-editor/add.png' %>'
  3. JSONEditor.prototype.DELETE_IMG = '<%= image_path 'json-editor/delete.png' %>'
  4. editors = []
  5. $editors.each ->
  6. $editor = $(this)
  7. jsonEditor = new JSONEditor($editor, $editor.data('width') || 400, $editor.data('height') || 500)
  8. jsonEditor.doTruncation true
  9. jsonEditor.showFunctionButtons()
  10. editors.push jsonEditor
  11. return editors
  12. $ ->
  13. window.jsonEditor = setupJsonEditor()[0]