{I" class:EFI"ProcessedAsset;FI"logical_path;FI"&rails_embed_editor/application.js;FI" pathname;FI"}C:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/rails_embed_editor-1.0.0/app/assets/javascripts/rails_embed_editor/application.coffee;FI"content_type;FI"application/javascript;FI" mtime;Fl+¾GSI" length;Fi?I" digest;F"%a407091b898f26a54706070a033c7e2bI" source;FI"?(function() { var Range, compute_range, setup_editor; if (window.rails_embed_editor_default_theme == null) { window.rails_embed_editor_default_theme = 'github'; } Range = require('ace/range').Range; $(document).ready(function() { return window.load_rails_embed_code_editor(); }); window.load_rails_embed_code_editor = function() { return $('.rails_embed_code_editor').each(function() { var container, options; container = $(this); options = { theme: container.data('theme'), mode: container.data('mode'), filename: container.data('filename'), first_line: container.data('first-line'), last_line: container.data('last-line'), editormode: container.data('editormode'), highlight: compute_range(container.data('highlight'), container.data('first-line')) }; return setup_editor(container[0], options); }); }; setup_editor = function(element, options) { var button, defaults, editor; defaults = { theme: window.rails_embed_editor_default_theme, mode: 'ruby', firstLineNumber: 1, editormode: 'readonly' }; options = $.extend({}, defaults, options); editor = ace.edit(element); editor.commands.removeCommand('replace'); editor.setTheme("ace/theme/" + options['theme']); editor.getSession().setMode("ace/mode/" + options['mode']); editor.setOption("firstLineNumber", options['first_line']); editor.setReadOnly(options['editormode'] !== 'write'); editor.setAutoScrollEditorIntoView(); editor.setOption("maxLines", 40); editor.setOption("minLines", 5); if (options['highlight'] !== null) { editor.getSession().addMarker(options['highlight'], "editor_highlight", "text"); } if (options['editormode'] !== 'readonly') { if (options['last_line'] == null) { options['last_line'] = options['firstLineNumber'] + editor.session.getLength(); } button = $('
').appendTo(element).children(); if (options['editormode'] === 'readwrite') { button.text('Enable edit'); } return button.click(function() { if (options['editormode'] !== 'readonly') { if (options['editormode'] === 'readwrite' && editor.getReadOnly()) { button.text('Save'); return editor.setReadOnly(false); } else { return $.post('/rails_embed_editor/edit', { content: editor.getValue(), first_line: options['first_line'], last_line: options['last_line'], filename: options['filename'] }).success(function(data) { if (data['success'] === true) { button.text('Saved!'); } else { button.text('Error'); console.log('Error saving:' + data['message']); } return setTimeout(function() { return button.text("Save"); }, 2000); }); } } }); } }; compute_range = function(str, line) { var i, offset, _array, _i, _ref; if (line == null) { line = 1; } offset = parseInt(line); if (str === void 0) { return null; } _array = str.toString().split(','); for (i = _i = 0, _ref = _array.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { _array[i] = parseInt(_array[i]); } switch (_array.length) { case 1: return new Range(_array[0] - offset, 0, _array[0] - offset, Infinity); case 2: return new Range(_array[0] - offset, 0, _array[1] - offset, Infinity); case 4: return new Range(_array[0] - offset, _array[1], _array[2] - offset, _array[3]); default: return null; } }; }).call(this); ;TI"dependency_digest;F"%597498851f0900beef4cad0f01439564I"required_paths;F[ I"dC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/ace.js;FI"jC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/mode-ruby.js;FI"nC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/theme-monokai.js;FI"mC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/theme-github.js;FI"}C:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/rails_embed_editor-1.0.0/app/assets/javascripts/rails_embed_editor/application.coffee;FI"dependency_paths;F[ {I" path;FI"oC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/rails_embed_editor-1.0.0/app/assets/javascripts/rails_embed_editor;FI" mtime;FI"2014-04-10T18:14:22-04:00;FI" digest;F"%072bf051b842d07734b9bea00ef8c07b{I" path;FI"}C:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/rails_embed_editor-1.0.0/app/assets/javascripts/rails_embed_editor/application.coffee;FI" mtime;FI"2014-04-10T18:14:22-04:00;FI" digest;F"%a2df2aa1ada5cf6caf6e048c272d0d4b{I" path;FI"dC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/ace.js;FI" mtime;FI"2014-02-21T18:52:23-05:00;FI" digest;F"%aa50ef7ea3e2e0ae092568e625ce607f{I" path;FI"jC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/mode-ruby.js;FI" mtime;FI"2014-02-21T18:52:24-05:00;FI" digest;F"%a688b1de76d791cc0ba88d66e8548029{I" path;FI"nC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/theme-monokai.js;FI" mtime;FI"2014-02-21T18:52:24-05:00;FI" digest;F"%f7bc1bae7c576bd6ee753f15a4ca7b17{I" path;FI"mC:/lib/Ruby193/lib/ruby/gems/1.9.1/gems/ace-rails-ap-2.0.1/vendor/assets/javascripts/ace/theme-github.js;FI" mtime;FI"2014-02-21T18:52:24-05:00;FI" digest;F"%f5ab2e2673ee830e87e54a1fedefbe99I" _version;F"%2b66aa67c90052d553e0328c249bc9b0