o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1396340895.78129: @value" {I" class:ETI"ProcessedAsset;FI"logical_path;TI">locomotive/views/content_types/custom_field_entry_view.js;FI" pathname;TI"µ/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/engine-89566d497862/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2014-04-01T10:04:05+02:00;TI" length;Ti„I" digest;TI"%dcdeb445975b92613bd01cd4f33b123c;FI" source;TI"„(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).ContentTypes || (_base.ContentTypes = {}); Locomotive.Views.ContentTypes.CustomFieldEntryView = (function(_super) { __extends(CustomFieldEntryView, _super); function CustomFieldEntryView() { return CustomFieldEntryView.__super__.constructor.apply(this, arguments); } CustomFieldEntryView.prototype.tagName = 'li'; CustomFieldEntryView.prototype.className = 'custom-field'; CustomFieldEntryView.prototype.events = { 'click a.toggle': 'toggle', 'click a.remove': 'remove' }; CustomFieldEntryView.prototype.initialize = function() { this.inverse_of_list = this.options.parent_view.options.inverse_of_list; return this.model.bind('change', (function(_this) { return 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(); } }; })(this)); }; 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.$('li.input.inverse-of select option').remove(); list = this.inverse_of_list[this.model.get('type')] || []; _.each(list, (function(_this) { return 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); } }; })(this)); 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;TI"%4b2da561c8a94171186d18a8c80d7404;FI"required_paths;T[I"µ/Users/didier/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/engine-89566d497862/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_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-89566d497862/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee;FI" mtime;TI"2014-04-01T10:04:05+02:00;TI" digest;TI"%9f87523f60c1aae33f80d99d13bce9be;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F