o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381142253.516722: @value"Ÿ%{I" class:EFI"ProcessedAsset;FI"logical_path;FI"3locomotive/views/content_entries/_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/content_entries/_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"%20371c1428bbfd363c8771c4093e26adI" 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).ContentEntries || (_base.ContentEntries = {}); Locomotive.Views.ContentEntries.FormView = (function(_super) { __extends(FormView, _super); function FormView() { _ref = FormView.__super__.constructor.apply(this, arguments); return _ref; } FormView.prototype.el = '#content'; FormView.prototype._select_field_view = null; FormView.prototype._file_field_views = []; FormView.prototype._has_many_field_views = []; FormView.prototype._many_to_many_field_views = []; FormView.prototype.events = { 'submit': 'save' }; FormView.prototype.initialize = function() { this.content_type || (this.content_type = new Locomotive.Models.ContentType(this.options.content_type)); this.model || (this.model = new Locomotive.Models.ContentEntry(this.options.content_entry)); this.namespace = this.options.namespace; return Backbone.ModelBinding.bind(this); }; FormView.prototype.render = function() { FormView.__super__.render.call(this); this.enable_checkboxes(); this.enable_tags(); this.enable_datepickers(); this.enable_richtexteditor(); this.enable_select_fields(); this.enable_file_fields(); this.enable_has_many_fields(); this.enable_many_to_many_fields(); this.slugify_label_field(); return this; }; FormView.prototype.enable_checkboxes = function() { return this.$('li.input.toggle input[type=checkbox]').checkToggle(); }; FormView.prototype.enable_tags = function() { return this.$('li.input.tags input[type=text]').tagit({ allowSpaces: true }); }; FormView.prototype.enable_datepickers = function() { return this.$('li.input.date input[type=text]').datepicker(); }; FormView.prototype.enable_richtexteditor = function() { var _this = this; return _.each(this.$('li.input.rte textarea.html'), function(textarea) { var settings; settings = _.extend({}, _this.tinyMCE_settings(), { oninit: (function(editor) { return $.cmd('S', (function() { editor.save(); $(textarea).trigger('changeSilently'); return _this.$('form').trigger('submit'); }), [], { ignoreCase: true, document: editor.dom.doc }); }), onchange_callback: function(editor) { editor.save(); return $(textarea).trigger('changeSilently'); } }); return $(textarea).tinymce(settings); }); }; FormView.prototype.enable_select_fields = function() { var _this = this; this._select_field_view = new Locomotive.Views.Shared.Fields.SelectView({ model: this.content_type }); return _.each(this.model.get('select_custom_fields'), function(name) { var $input_wrapper; $input_wrapper = _this.$("#" + _this.model.paramRoot + "_" + name + "_id_input"); $input_wrapper.append(ich.edit_select_options_button()); return $input_wrapper.find('a.edit-options-button').bind('click', function(event) { event.stopPropagation() & event.preventDefault(); return _this._select_field_view.render_for(name, function(options) { var $select; $select = $input_wrapper.find('select'); $select.find('option[value!=""]').remove(); return _.each(options, function(option) { if (!option.destroyed()) { return $select.append(new Option(option.get('name'), option.get('id'), false, option.get('id') === _this.model.get("" + name + "_id"))); } }); }); }); }); }; FormView.prototype.enable_file_fields = function() { var _this = this; return _.each(this.model.get('file_custom_fields'), function(name) { var prefix, view; view = new Locomotive.Views.Shared.Fields.FileView({ model: _this.model, name: name, namespace: _this.namespace }); _this._file_field_views.push(view); prefix = _this.namespace != null ? "" + _this.namespace + "_" : ''; return _this.$("#" + prefix + _this.model.paramRoot + "_" + name + "_input label").after(view.render().el); }); }; FormView.prototype.enable_has_many_fields = function() { var _this = this; if (!this.model.isNew()) { return _.each(this.model.get('has_many_custom_fields'), function(field) { var inverse_of, name, new_entry, view; name = field[0]; inverse_of = field[1]; new_entry = new Locomotive.Models.ContentEntry(_this.options["" + name + "_new_entry"]); view = new Locomotive.Views.Shared.Fields.HasManyView({ model: _this.model, name: name, new_entry: new_entry, inverse_of: inverse_of }); if (view.ui_enabled()) { _this._has_many_field_views.push(view); return _this.$("#" + _this.model.paramRoot + "_" + name + "_input label").after(view.render().el); } }); } }; FormView.prototype.enable_many_to_many_fields = function() { var _this = this; return _.each(this.model.get('many_to_many_custom_fields'), function(field) { var name, view; name = field[0]; view = new Locomotive.Views.Shared.Fields.ManyToManyView({ model: _this.model, name: name, all_entries: _this.options["all_" + name + "_entries"] }); if (view.ui_enabled()) { _this._many_to_many_field_views.push(view); return _this.$("#" + _this.model.paramRoot + "_" + name + "_input label").after(view.render().el); } }); }; FormView.prototype.slugify_label_field = function() { return this.$('li.input.highlighted > input[type=text]').slugify({ target: this.$('#content_entry__slug'), url: window.permalink_service_url }); }; FormView.prototype.refresh_file_fields = function() { var _this = this; return _.each(this._file_field_views, function(view) { return view.refresh(); }); }; FormView.prototype.refresh = function() { var _this = this; this.$('li.input.toggle input[type=checkbox]').checkToggle('sync'); return _.each(this._file_field_views, function(view) { return view.refresh(); }); }; FormView.prototype.reset = function() { var _this = this; this.$('li.input.string input[type=text], li.input.text textarea, li.input.date input[type=text]').val('').trigger('change'); _.each(this.$('li.input.rte textarea.html'), function(textarea) { $(textarea).tinymce().setContent(''); return $(textarea).trigger('change'); }); _.each(this._file_field_views, function(view) { return view.reset(); }); return this.$('li.input.toggle input[type=checkbox]').checkToggle('sync'); }; FormView.prototype.remove = function() { var _this = this; this.$('li.input.date input[type=text]').datepicker('destroy'); this._select_field_view.remove(); _.each(this._file_field_views, function(view) { return view.remove(); }); _.each(this._has_many_field_views, function(view) { return view.remove(); }); _.each(this._many_to_many_field_views, function(view) { return view.remove(); }); return FormView.__super__.remove.apply(this, arguments); }; FormView.prototype.tinyMCE_settings = function() { return window.Locomotive.tinyMCE.defaultSettings; }; return FormView; })(Locomotive.Views.Shared.FormView); }).call(this); ;TI"dependency_digest;F"%5a038f7ccd958aece2523ba315245176I"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/content_entries/_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/content_entries/_form_view.js.coffee;TI" mtime;FI"2013-10-07T10:55:40+02:00;FI" digest;F"%ea0bbc6a320883d337b60340bc507855{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