o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1364984311.0083652: @value"|{I" class:EFI"ProcessedAsset;FI"logical_path;FI"+locomotive/views/sites/domains_view.js;TI" pathname;FI"r/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/sites/domains_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-01-18T09:21:50+01:00;FI" length;FiöI" digest;F"%2e26d88f23a3cfc7320bf7c18ed866d7I" 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).Sites || (_base.Sites = {}); Locomotive.Views.Sites.DomainsView = (function(_super) { var _entry_views; __extends(DomainsView, _super); function DomainsView() { _ref = DomainsView.__super__.constructor.apply(this, arguments); return _ref; } DomainsView.prototype.tagName = 'div'; DomainsView.prototype.className = 'list'; _entry_views = []; DomainsView.prototype.events = { 'click .new-entry a.add': 'add_entry', 'keypress .new-entry input[type=text]': 'add_on_entry_from_enter' }; DomainsView.prototype.render = function() { $(this.el).html(ich.domains_list(this.model.toJSON())); this.render_entries(); this.enable_ui_effects(); return this; }; DomainsView.prototype.add_entry = function(event) { var domain, input; event.stopPropagation() & event.preventDefault(); input = this.$('.new-entry input[name=domain]'); if (input.val() !== '') { domain = new Locomotive.Models.Domain({ name: input.val() }); this.model.get('domains').push(domain); this._insert_entry(domain); this.$('ul li.domain:last input[type=text]').editableField(); this.$('.empty').hide(); return input.val(''); } }; DomainsView.prototype.add_on_entry_from_enter = function(event) { if (event.keyCode !== 13) { return; } return this.add_entry(event); }; DomainsView.prototype.change_entry = function(domain, value) { return domain.set({ name: value }); }; DomainsView.prototype.remove_entry = function(domain) { var list, _this = this; list = _.reject(this.model.get('domains'), function(_domain) { return _domain === domain; }); this.model.set({ domains: list }); if (this.model.get('domains').length === 0) { return this.$('.empty').show(); } }; DomainsView.prototype.render_entries = function() { var _this = this; if (this.model.get('domains').length === 0) { return this.$('.empty').show(); } else { _.each(this.model.get('domains'), function(domain) { return _this._insert_entry(domain); }); return this.show_errors(); } }; DomainsView.prototype.show_errors = function() { var _this = this; return _.each(this.options.errors.domain || [], function(message) { return _this.show_error(message); }); }; DomainsView.prototype.show_error = function(message) { return _.each(this._entry_views || [], function(view) { var html; if (new RegExp("^" + (view.model.get('name'))).test(message)) { html = $('').addClass('inline-errors').html(message); return view.$('input[type=text].path').after(html); } }); }; DomainsView.prototype.enable_ui_effects = function() { return this.$('.domain input[type=text]').editableField(); }; DomainsView.prototype._insert_entry = function(domain) { var view; view = new Locomotive.Views.Sites.DomainEntryView({ model: domain, parent_view: this }); (this._entry_views || (this._entry_views = [])).push(view); return this.$('ul').append(view.render().el); }; return DomainsView; })(Backbone.View); }).call(this); ;TI"dependency_digest;F"%28880d81379f3b94f9e97a1f80262799I"required_paths;F[I"r/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/sites/domains_view.js.coffee;TI"dependency_paths;F[{I" path;FI"r/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/sites/domains_view.js.coffee;TI" mtime;FI"2013-01-18T09:21:50+01:00;FI" digest;F"%cb39d45f7d22031cf828d2fdb7b34613I" _version;F"%6776f581a4329e299531e1d52aa59832