o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1364984317.3709598: @value"»{I" class:EFI"ProcessedAsset;FI"logical_path;FI"0locomotive/views/theme_assets/_form_view.js;TI" pathname;FI"w/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-01-18T09:21:50+01:00;FI" length;FiÕI" digest;F"%f55954211c66f9806f8bab2a123cdc83I" 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"%981da99ce75d2efe4743eb902ce44d3fI"required_paths;F[I"p/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;TI"w/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;TI"dependency_paths;F[{I" path;FI"w/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;TI" mtime;FI"2013-01-18T09:21:50+01:00;FI" digest;F"%a6ea2ff2402467bd92a34bbc20d37b99{I" path;FI"p/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;TI" mtime;FI"2013-04-03T11:01:13+02:00;FI" digest;F"%a6e3a1e43e6f34490cc614f779383a34I" _version;F"%6776f581a4329e299531e1d52aa59832