o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1365017540.603314: @value"³{I" class:EFI"ProcessedAsset;FI"logical_path;FI">locomotive/views/content_types/custom_field_entry_view.js;TI" pathname;FI"€/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-04-03T21:31:15+02:00;FI" length;FiÞI" digest;F"%b814221b0f1bce3e40dbbcadc01956f6I" 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).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 'has_many': case 'many_to_many': 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"%c3cfac8224574464e00d82da7e7da529I"required_paths;F[I"€/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;TI"dependency_paths;F[{I" path;FI"€/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;TI" mtime;FI"2013-04-03T21:31:15+02:00;FI" digest;F"%ce287765ca19b298d02243c2c6549b17I" _version;F"%6776f581a4329e299531e1d52aa59832