o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1397508829.58334: @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/bundler/gems/engine-5337f0929131/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2014-04-10T01:06:58+02:00;TI" length;Ti4I" digest;TI"%191e1091403e215a1c1b1406e7b0e3f0;FI" source;TI"4(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).Pages || (_base.Pages = {}); Locomotive.Views.Pages.FormView = (function(_super) { __extends(FormView, _super); function FormView() { return FormView.__super__.constructor.apply(this, arguments); } 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; event.stopPropagation() & event.preventDefault(); link = $(event.target).closest('a'); return $.rails.ajax({ url: link.attr('href'), type: 'get', dataType: 'json', success: (function(_this) { return function(data) { return _this.editor.setValue(data.raw_template); }; })(this) }); }; FormView.prototype.enable_liquid_editing = function() { var input; 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(_this) { return function(editor, change) { return _this.model.set({ raw_template: editor.getValue() }); }; })(this)); } }; 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() { this.$('#page_title').slugify({ target: this.$('#page_slug'), url: window.permalink_service_url }); return this.$('#page_slug').bind('change', ((function(_this) { return function(event) { return _this.touched_url = true; }; })(this))); }; FormView.prototype.listen_for_url_changes = function() { return setInterval(((function(_this) { return function() { if (_this.touched_url) { return _this.change_page_url() & (_this.touched_url = false); } }; })(this)), 1200); }; FormView.prototype.change_page_url = function() { 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(_this) { return 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(); } } }; })(this) }); }; FormView.prototype.enable_response_type_select = function() { return this.$('li#page_response_type_input').change((function(_this) { return 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(); } }; })(this)); }; FormView.prototype.enable_templatized_checkbox = function() { this._enable_checkbox('templatized', { features: ['slug', 'redirect', 'listed'], on_callback: (function(_this) { return function() { return _this.$('li#page_target_klass_name_input').show(); }; })(this), off_callback: (function(_this) { return function() { return _this.$('li#page_target_klass_name_input').hide(); }; })(this) }); if (this.model.get('templatized_from_parent') === true) { return this.$('li#page_templatized_input').hide(); } }; FormView.prototype.enable_redirect_checkbox = function() { return this._enable_checkbox('redirect', { features: ['templatized', 'cache_strategy'], on_callback: (function(_this) { return function() { return _this.$('li#page_redirect_url_input, li#page_redirect_type_input').show(); }; })(this), off_callback: (function(_this) { return function() { return _this.$('li#page_redirect_url_input, li#page_redirect_type_input').hide(); }; })(this) }); }; FormView.prototype.enable_other_checkboxes = function() { this.$('li.toggle input[type=checkbox].simple-toggle').checkToggle(); return this.$('li.toggle.simple-toggle input[type=checkbox]').checkToggle(); }; return FormView; })(Locomotive.Views.Shared.FormView); }).call(this); ;TI"dependency_digest;TI"%1c9a059cc82095c5f744fac2a60432c7;FI"required_paths;T[I" /Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/engine-5337f0929131/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/bundler/gems/engine-5337f0929131/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/bundler/gems/engine-5337f0929131/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee;FI" mtime;TI"2014-04-10T01:06:58+02:00;TI" digest;TI"%1ff1eb7d73ab5977f4270595b50a4a8a;F{I" path;TI" /Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/engine-5337f0929131/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;FI" mtime;TI"2014-04-10T01:06:58+02:00;TI" digest;TI"%6b625a8f368e04b11585748da811b133;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F