o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381142256.613833: @value" #{I" class:EFI"ProcessedAsset;FI"logical_path;FI")locomotive/views/pages/_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/pages/_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"%f522d8cd10686367b49f6c172b056e39I" 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).Pages || (_base.Pages = {}); Locomotive.Views.Pages.FormView = (function(_super) { __extends(FormView, _super); function FormView() { _ref = FormView.__super__.constructor.apply(this, arguments); return _ref; } FormView.prototype.el = '#content'; FormView.prototype.events = { 'change #page_parent_id': 'change_page_url', 'click a#image-picker-link': 'open_image_picker', 'click a#copy-template-link': 'replace_template', 'submit': 'save' }; FormView.prototype.initialize = function() { _.bindAll(this, 'insert_image'); this.model = new Locomotive.Models.Page(this.options.page); this.touched_url = false; this.image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView({ collection: new Locomotive.Models.ThemeAssetsCollection(), on_select: this.insert_image }); this.image_picker_view.render(); Backbone.ModelBinding.bind(this); return this.editable_elements_view = new Locomotive.Views.EditableElements.EditAllView({ collection: this.model.get('editable_elements') }); }; FormView.prototype.render = function() { FormView.__super__.render.call(this); this.slugify_title(); this.listen_for_url_changes(); this.enable_response_type_select(); this.enable_templatized_checkbox(); this.enable_redirect_checkbox(); this.enable_other_checkboxes(); this.enable_liquid_editing(); this.render_editable_elements(); return this; }; 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 + "' | theme_image_url }}"; this.editor.replaceSelection(text); return this.image_picker_view.close(); }; FormView.prototype.replace_template = function(event) { var link, _this = this; event.stopPropagation() & event.preventDefault(); link = $(event.target).closest('a'); return $.rails.ajax({ url: link.attr('href'), type: 'get', dataType: 'json', success: function(data) { return _this.editor.setValue(data.raw_template); } }); }; FormView.prototype.enable_liquid_editing = function() { var input, _this = this; input = this.$('#page_raw_template'); if (input.size() > 0) { return this.editor = CodeMirror.fromTextArea(input.get()[0], { mode: 'liquid', autoMatchParens: false, lineNumbers: true, passDelay: 50, tabMode: 'shift', theme: 'default', onChange: function(editor) { return _this.model.set({ raw_template: editor.getValue() }); } }); } }; FormView.prototype.after_inputs_fold = function() { return this.editor.refresh(); }; FormView.prototype.render_editable_elements = function() { this.$('.formtastic fieldset.inputs:first').before(this.editable_elements_view.render().el); return this.editable_elements_view.after_render(); }; FormView.prototype.reset_editable_elements = function() { this.editable_elements_view.remove(); this.editable_elements_view.collection = this.model.get('editable_elements'); return this.render_editable_elements(); }; FormView.prototype.refresh_editable_elements = function() { this.editable_elements_view.unbind_model(); this.editable_elements_view.collection = this.model.get('editable_elements'); return this.editable_elements_view.refresh(); }; FormView.prototype.slugify_title = function() { var _this = this; this.$('#page_title').slugify({ target: this.$('#page_slug'), url: window.permalink_service_url }); return this.$('#page_slug').bind('change', (function(event) { return _this.touched_url = true; })); }; FormView.prototype.listen_for_url_changes = function() { var _this = this; return setInterval((function() { if (_this.touched_url) { return _this.change_page_url() & (_this.touched_url = false); } }), 1200); }; FormView.prototype.change_page_url = function() { var _this = this; return $.rails.ajax({ url: this.$('#page_slug').data('url'), type: 'get', dataType: 'json', data: { parent_id: this.$('#page_parent_id').val(), slug: this.$('#page_slug').val() }, success: function(data) { _this.$('#page_slug_input .inline-hints').html(data.url).effect('highlight'); if (data.templatized_parent) { _this.$('li#page_slug_input').show(); return _this.$('li#page_templatized_input, li#page_target_klass_name_input').hide(); } else { if (!_this.model.get('redirect')) { return _this.$('li#page_templatized_input').show(); } } } }); }; FormView.prototype.enable_response_type_select = function() { var _this = this; return this.$('li#page_response_type_input').change(function(event) { if ($(event.target).val() === 'text/html') { return _this.$('li#page_redirect_input, li#page_redirect_url_input, li#page_redirect_type_input').show(); } else { _this.model.set({ redirect: false }); return _this.$('li#page_redirect_input, li#page_redirect_url_input, li#page_redirect_type_input').hide(); } }); }; FormView.prototype.enable_templatized_checkbox = function() { var _this = this; this._enable_checkbox('templatized', { features: ['slug', 'redirect', 'listed'], on_callback: function() { return _this.$('li#page_target_klass_name_input').show(); }, off_callback: function() { return _this.$('li#page_target_klass_name_input').hide(); } }); if (this.model.get('templatized_from_parent') === true) { return this.$('li#page_templatized_input').hide(); } }; FormView.prototype.enable_redirect_checkbox = function() { var _this = this; return this._enable_checkbox('redirect', { features: ['templatized', 'cache_strategy'], on_callback: function() { return _this.$('li#page_redirect_url_input, li#page_redirect_type_input').show(); }, off_callback: function() { return _this.$('li#page_redirect_url_input, li#page_redirect_type_input').hide(); } }); }; FormView.prototype.enable_other_checkboxes = function() { var _this = this; return _.each(['published', 'listed'], function(exp) { return _this.$('li#page_' + exp + '_input input[type=checkbox]').checkToggle(); }); }; return FormView; })(Locomotive.Views.Shared.FormView); }).call(this); ;TI"dependency_digest;F"%49854dd4ea395cd77f071aec2d19b3cfI"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/pages/_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/pages/_form_view.js.coffee;TI" mtime;FI"2013-10-07T10:55:40+02:00;FI" digest;F"%862f76e327828fa315ddb0d5c53db957{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