window.setupJsonEditor = ($editors = $(".live-json-editor")) -> JSONEditor.prototype.ADD_IMG = '<%= image_path 'json-editor/add.png' %>' JSONEditor.prototype.DELETE_IMG = '<%= image_path 'json-editor/delete.png' %>' editors = [] $editors.each -> $editor = $(this) jsonEditor = new JSONEditor($editor, $editor.data('width') || 400, $editor.data('height') || 500) jsonEditor.doTruncation true jsonEditor.showFunctionButtons() editors.push jsonEditor return editors $ -> window.jsonEditor = setupJsonEditor()[0]