o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381142259.3857331: @value"={I" class:EFI"ProcessedAsset;FI"logical_path;FI"0locomotive/views/theme_assets/_form_view.js;TI" pathname;FI"‹/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.1.0/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-10-07T10:55:40+02:00;FI" length;FiÕI" digest;F"%dfb7167ed0781f867da8be0529a5d59eI" source;FI"Õ(function() { var _base, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; (_base = Locomotive.Views).ThemeAssets || (_base.ThemeAssets = {}); Locomotive.Views.ThemeAssets.FormView = (function(_super) { __extends(FormView, _super); function FormView() { _ref = FormView.__super__.constructor.apply(this, arguments); return _ref; } FormView.prototype.el = '#content'; FormView.prototype.events = { 'click a#image-picker-link': 'open_image_picker', 'submit': 'save' }; FormView.prototype.initialize = function() { _.bindAll(this, 'insert_image'); this.model = new Locomotive.Models.ThemeAsset(this.options.theme_asset); this.image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView({ on_select: this.insert_image }); this.image_picker_view.render(); return Backbone.ModelBinding.bind(this); }; FormView.prototype.render = function() { FormView.__super__.render.call(this); this.enable_toggle_between_file_and_text(); this.enable_source_editing(); this.bind_source_mode(); this.enable_source_file(); return this; }; FormView.prototype.enable_toggle_between_file_and_text = function() { var _this = this; this.$('div.hidden').hide(); this.model.set({ performing_plain_text: this.$('#theme_asset_performing_plain_text').val() }); return this.$('.selector > a.alt').click(function(event) { event.stopPropagation() & event.preventDefault(); if (_this.$('#file-selector').is(':hidden')) { return _this.$('#text-selector').slideUp('normal', function() { _this.$('#file-selector').slideDown(); _this.model.set({ performing_plain_text: false }); return _this.$('input#theme_asset_performing_plain_text').val(false); }); } else { return _this.$('#file-selector').slideUp('normal', function() { _this.$('#text-selector').slideDown('normal', function() { return _this.editor.refresh(); }); _this.model.set({ performing_plain_text: true }); return _this.$('#theme_asset_performing_plain_text').val(true); }); } }); }; FormView.prototype.enable_source_file = function() { var _this = this; return this.$('.formtastic #theme_asset_source').bind('change', function(event) { var input; input = $(event.target)[0]; if (input.files != null) { return _this.model.set({ source: input.files[0] }); } }); }; FormView.prototype.show_error = function(attribute, message, html) { switch (attribute) { case 'source': return this.$(this.model.get('performing_plain_text') ? '#theme_asset_plain_text_input .CodeMirror' : '#theme_asset_source').after(html); default: return FormView.__super__.show_error.apply(this, arguments); } }; FormView.prototype.open_image_picker = function(event) { event.stopPropagation() & event.preventDefault(); this.image_picker_view.editor = this.editor; return this.image_picker_view.fetch_assets(); }; FormView.prototype.insert_image = function(path) { var text; text = "'" + path + "'"; this.editor.replaceSelection(text); return this.image_picker_view.close(); }; FormView.prototype.source_mode = function() { if (this.model.get('plain_text_type') === 'javascript') { return 'javascript'; } else { return 'css'; } }; FormView.prototype.enable_source_editing = function() { var input, _this = this; input = this.$('#theme_asset_plain_text'); if (input.size() === 0) { return; } return this.editor = CodeMirror.fromTextArea(input.get()[0], { mode: this.source_mode(), autoMatchParens: false, lineNumbers: false, passDelay: 50, tabMode: 'shift', theme: 'default', onChange: function(editor) { return _this.model.set({ plain_text: editor.getValue() }); } }); }; FormView.prototype.bind_source_mode = function() { var _this = this; return this.$('#theme_asset_plain_text_type').bind('change', function(event) { return _this.editor.setOption('mode', _this.source_mode()); }); }; FormView.prototype.after_inputs_fold = function() { if (this.editor != null) { return this.editor.refresh(); } }; return FormView; })(Locomotive.Views.Shared.FormView); }).call(this); ;TI"dependency_digest;F"%599a40712cf177c59b925b92088e2df7I"required_paths;F[I"„/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.1.0/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;TI"‹/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.1.0/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;TI"dependency_paths;F[{I" path;FI"‹/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.1.0/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;TI" mtime;FI"2013-10-07T10:55:40+02:00;FI" digest;F"%ddf0862a85c1082f04d2495bd9074d1d{I" path;FI"„/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.1.0/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;TI" mtime;FI"2013-10-07T10:55:40+02:00;FI" digest;F"%e4f8acd406d0d29f928f278bc23eee51I" _version;F"%ffd318ca8b794f42f5029101c2cf5d91