o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1396088394.249218: @value"M,{I" class:ETI"ProcessedAsset;FI"logical_path;TI"3locomotive/views/content_entries/_form_view.js;FI" pathname;TI"ª/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/engine-c0bddd719ddf/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2014-03-29T11:18:01+01:00;TI" length;Ti4&I" digest;TI"%2ef96b49f0ce41cbc9dee8db094f8799;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).ContentEntries || (_base.ContentEntries = {}); Locomotive.Views.ContentEntries.FormView = (function(_super) { __extends(FormView, _super); function FormView() { return FormView.__super__.constructor.apply(this, arguments); } FormView.prototype.el = '#content'; FormView.prototype._select_field_view = null; FormView.prototype._file_field_views = []; FormView.prototype._belongs_to_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_datetimepickers(); this.enable_richtexteditor(); this.enable_select_fields(); this.enable_belongs_to_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_datetimepickers = function() { return this.$('li.input.date-time input[type=text]').datetimepicker({ controlType: 'select', showTime: false }); }; FormView.prototype.enable_richtexteditor = function() { return _.each(this.$('li.input.rte textarea.html'), (function(_this) { return 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); }; })(this)); }; FormView.prototype.enable_select_fields = function() { this._select_field_view = new Locomotive.Views.Shared.Fields.SelectView({ model: this.content_type }); return _.each(this.model.get('select_custom_fields'), (function(_this) { return 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"))); } }); }); }); }; })(this)); }; FormView.prototype.enable_belongs_to_fields = function() { var prefix; prefix = this.namespace != null ? "" + this.namespace + "_" : ''; return _.each(this.model.get('belongs_to_custom_fields'), (function(_this) { return function(name) { var $el, view; $el = _this.$("#" + prefix + _this.model.paramRoot + "_" + name + "_id"); if ($el.length > 0) { view = new Locomotive.Views.Shared.Fields.BelongsToView({ model: _this.model, name: name, el: $el }); _this._belongs_to_field_views.push(view); return view.render(); } }; })(this)); }; FormView.prototype.enable_file_fields = function() { var prefix; prefix = this.namespace != null ? "" + this.namespace + "_" : ''; return _.each(this.model.get('file_custom_fields'), (function(_this) { return function(name) { var view; view = new Locomotive.Views.Shared.Fields.FileView({ model: _this.model, name: name, namespace: _this.namespace }); _this._file_field_views.push(view); return _this.$("#" + prefix + _this.model.paramRoot + "_" + name + "_input label").after(view.render().el); }; })(this)); }; FormView.prototype.enable_has_many_fields = function() { if (!this.model.isNew()) { return _.each(this.model.get('has_many_custom_fields'), (function(_this) { return 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); } }; })(this)); } }; FormView.prototype.enable_many_to_many_fields = function() { return _.each(this.model.get('many_to_many_custom_fields'), (function(_this) { return 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); } }; })(this)); }; 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() { return _.each(this._file_field_views, (function(_this) { return function(view) { return view.refresh(); }; })(this)); }; FormView.prototype.refresh = function() { this.$('li.input.toggle input[type=checkbox]').checkToggle('sync'); return this.refresh_file_fields(); }; FormView.prototype.reset = function() { 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(_this) { return function(textarea) { $(textarea).tinymce().setContent(''); return $(textarea).trigger('change'); }; })(this)); _.each(this._file_field_views, (function(_this) { return function(view) { return view.reset(); }; })(this)); return this.$('li.input.toggle input[type=checkbox]').checkToggle('sync'); }; FormView.prototype.remove = function() { this.$('li.input.date input[type=text]').datepicker('destroy'); this.$('li.input.date_time input[type=text]').datetimepicker('destroy'); this._select_field_view.remove(); _.each(this._file_field_views, (function(_this) { return function(view) { return view.remove(); }; })(this)); _.each(this._has_many_field_views, (function(_this) { return function(view) { return view.remove(); }; })(this)); _.each(this._many_to_many_field_views, (function(_this) { return function(view) { return view.remove(); }; })(this)); 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;TI"%f51897ebd58cb8dedbb735fe08216645;FI"required_paths;T[I" /Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/engine-c0bddd719ddf/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-c0bddd719ddf/app/assets/javascripts/locomotive/views/content_entries/_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-c0bddd719ddf/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee;FI" mtime;TI"2014-03-29T11:18:01+01:00;TI" digest;TI"%ae6dc52279d190f120fc9fe5847ee2ce;F{I" path;TI" /Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/engine-c0bddd719ddf/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee;FI" mtime;TI"2014-03-29T11:18:01+01:00;TI" digest;TI"%530d8faa1e59d267e84e809bd2f80524;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F