o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1383239456.132407: @value"‘#{I" class:ETI"ProcessedAsset;FI"logical_path;TI")locomotive/views/pages/_form_view.js;FI" pathname;TI"™/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/locomotive_cms-2.3.0/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2013-10-31T17:26:43+01:00;TI" length;TiÃI" digest;TI"%80c066ded7844f685a24b425a7a10eab;FI" source;TI"Ã(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) { this.editor = CodeMirror.fromTextArea(input.get()[0], { mode: 'liquid', autoMatchParens: false, lineNumbers: true, passDelay: 50, tabMode: 'shift', theme: 'default' }); return this.editor.on('change', function(editor, change) { 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;TI"%d6d010357a3c42af7f4d5071eb9802c2;FI"required_paths;T[I"™/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/locomotive_cms-2.3.0/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;FI"™/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/locomotive_cms-2.3.0/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee;FI"dependency_paths;T[{I" path;TI"™/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/locomotive_cms-2.3.0/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee;FI" mtime;TI"2013-10-31T17:26:43+01:00;TI" digest;TI"%fab9ac0a35125bdcc220d99c0d1ae89f;F{I" path;TI"™/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/locomotive_cms-2.3.0/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;FI" mtime;TI"2013-10-31T17:26:43+01:00;TI" digest;TI"%530d8faa1e59d267e84e809bd2f80524;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F