o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1397482266.312612: @value"‡{I" class:ETI"ProcessedAsset;FI"logical_path;TI"0locomotive/views/theme_assets/_form_view.js;FI" pathname;TI"{/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2014-04-01T16:04:07+02:00;TI" length;TitI" digest;TI"%78eee566e1499a742a55da36f231f572;FI" source;TI"t(function() { var _base, __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() { return FormView.__super__.constructor.apply(this, arguments); } 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() { this.$('div.hidden').hide(); this.model.set({ performing_plain_text: this.$('#theme_asset_performing_plain_text').val() }); return this.$('.selector > a.alt').click((function(_this) { return 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); }); } }; })(this)); }; FormView.prototype.enable_source_file = function() { return this.$('.formtastic #theme_asset_source').bind('change', (function(_this) { return function(event) { var input; input = $(event.target)[0]; if (input.files != null) { return _this.model.set({ source: input.files[0] }); } }; })(this)); }; 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; input = this.$('#theme_asset_plain_text'); if (input.size() === 0) { return; } this.editor = CodeMirror.fromTextArea(input.get()[0], { mode: this.source_mode(), autoMatchParens: false, lineNumbers: false, passDelay: 50, tabMode: 'shift', theme: 'default' }); return this.editor.on('change', (function(_this) { return function(editor, change) { return _this.model.set({ plain_text: editor.getValue() }); }; })(this)); }; FormView.prototype.bind_source_mode = function() { return this.$('#theme_asset_plain_text_type').bind('change', (function(_this) { return function(event) { return _this.editor.setOption('mode', _this.source_mode()); }; })(this)); }; 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;TI"%4154067472d8c3cde2751100191e7738;FI"required_paths;T[I"t/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;FI"{/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;FI"dependency_paths;T[{I" path;TI"{/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee;FI" mtime;TI"2014-04-01T16:04:07+02:00;TI" digest;TI"%c48ea4cae1e30dd8ecebb4408453a421;F{I" path;TI"t/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;FI" mtime;TI"2014-04-09T15:03:07+02:00;TI" digest;TI"%6b625a8f368e04b11585748da811b133;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F