o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381401968.880608: @value"m{I" class:EFI"ProcessedAsset;FI"logical_path;FI">locomotive/views/content_types/custom_field_entry_view.js;TI" pathname;FI"™/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.2.3/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-10-10T12:39:17+02:00;FI" length;FiMI" digest;F"%2a6d7faeec622ad3273b403d4ef2dc08I" source;FI"M(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).ContentTypes || (_base.ContentTypes = {}); Locomotive.Views.ContentTypes.CustomFieldEntryView = (function(_super) { __extends(CustomFieldEntryView, _super); function CustomFieldEntryView() { _ref = CustomFieldEntryView.__super__.constructor.apply(this, arguments); return _ref; } CustomFieldEntryView.prototype.tagName = 'li'; CustomFieldEntryView.prototype.className = 'custom-field'; CustomFieldEntryView.prototype.events = { 'click a.toggle': 'toggle', 'click a.remove': 'remove' }; CustomFieldEntryView.prototype.initialize = function() { var _this = this; this.inverse_of_list = this.options.parent_view.options.inverse_of_list; return this.model.bind('change', function(custom_field) { if (_this.model.hasChanged('type')) { _this.switch_to_type(); } if (_this.model.hasChanged('class_name') && (_this.model.get('class_name') != null)) { return _this.fetch_inverse_of_list(); } }); }; CustomFieldEntryView.prototype.render = function() { $(this.el).html(ich.custom_field_entry(this.model.toJSON())); if (!this.model.isNew()) { this.fetch_inverse_of_list(); } Backbone.ModelBinding.bind(this, { all: 'class' }); this.make_fields_editable(); this.enable_behaviours(); this.switch_to_type(); return this; }; CustomFieldEntryView.prototype.enable_behaviours = function() { var required_input; required_input = this.$('.required-input input[type=checkbox]'); required_input.checkToggle({ on_label: required_input.data('on-label'), off_label: required_input.data('off-label') }); this.$('li.input.toggle input[type=checkbox]').checkToggle(); return this.render_select_options_view(); }; CustomFieldEntryView.prototype.switch_to_type = function() { this.$('li.input.extra').hide(); switch (this.model.get('type')) { case 'select': return this.$('li.input.select-options').show(); case 'text': return this.$('li.input.text-formatting').show(); case 'belongs_to': this.$('li.input.localized').hide(); return this.$('li.input.class-name').show(); case 'image': return this.$('li.input.unique').hide(); case 'has_many': case 'many_to_many': this.$('li.input.unique').hide(); this.$('li.input.localized').hide(); this.$('li.input.class-name').show(); this.$('li.input.inverse-of').show(); return this.$('li.input.ui-enabled').show(); } }; CustomFieldEntryView.prototype.fetch_inverse_of_list = function() { var list, _this = this; this.$('li.input.inverse-of select option').remove(); list = this.inverse_of_list[this.model.get('type')] || []; _.each(list, function(data) { var option; if (data.class_name === _this.model.get('class_name')) { option = new Option(data.label, data.name, data.name === _this.model.get('inverse_of') || list.length === 1); return _this.$('li.input.inverse-of select').append(option); } }); if ((this.model.get('inverse_of') == null) && list.length > 0) { return this.model.set({ inverse_of: list[0].name }); } }; CustomFieldEntryView.prototype.render_select_options_view = function() { this.select_options_view = new Locomotive.Views.ContentTypes.SelectOptionsView({ model: this.model, collection: this.model.get('select_options') }); return this.$('#content_type_contents_custom_field_select_options_input').append(this.select_options_view.render().el); }; CustomFieldEntryView.prototype.make_fields_editable = function() { return this.$('.label-input input[type=text], .type-input select').editableField(); }; CustomFieldEntryView.prototype.toggle = function(event) { var form; event.stopPropagation() & event.preventDefault(); form = this.$('ol'); if (form.is(':hidden')) { this.$('a.toggle').addClass('open'); return form.slideDown(); } else { this.$('a.toggle').removeClass('open'); return form.slideUp(); } }; CustomFieldEntryView.prototype.show_error = function(message) { var html; html = $("" + message + ""); return this.$('.required-input').after(html); }; CustomFieldEntryView.prototype.remove = function(event) { event.stopPropagation() & event.preventDefault(); if (confirm($(event.target).data('confirm'))) { this.$('.label-input input[type=text], .type-input select').editableField('destroy'); CustomFieldEntryView.__super__.remove.call(this); return this.options.parent_view.remove_entry(this.model, this); } }; return CustomFieldEntryView; })(Backbone.View); }).call(this); ;TI"dependency_digest;F"%337b3c0f64df18fb4ab02719be749339I"required_paths;F[I"™/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.2.3/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;TI"dependency_paths;F[{I" path;FI"™/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.2.3/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;TI" mtime;FI"2013-10-10T12:39:17+02:00;FI" digest;F"%9f87523f60c1aae33f80d99d13bce9beI" _version;F"%ffd318ca8b794f42f5029101c2cf5d91