o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1357654410.562717Ž: @value"“{I" class:EFI"BundledAsset;FI"logical_path;FI"/iugu-ux/components/usecode/iugu-ui-view.js;FI" pathname;FI"|/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-view.js.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-01-08T11:08:08-02:00;FI" length;Fi| I" digest;F"%a7f6cdb156a89ff3b6bce1139508ac1cI" source;FI"| (function() { var __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; }; IuguUI.View = (function(_super) { __extends(View, _super); function View() { return View.__super__.constructor.apply(this, arguments); } View.prototype.layout = "iugu-ui-view"; View.prototype.initialize = function() { if (this.model) { Backbone.Validation.bind(this, { forceUpdate: true, valid: function(view, attr, selector) { return view.valid(view, attr, selector); }, invalid: function(view, attr, error, selector) { return view.invalid(view, attr, error, selector); } }); return this.model.on('error', this.addErrors, this); } }; View.prototype.valid = function(view, attr, selector) { var control, ctrlGroup, group, list; control = view.$('[' + selector + '=\"' + attr + '\"]'); group = control.parents(".form-group"); ctrlGroup = control.parents(".control-group"); list = group.find(".error-list"); if (view.model.preValidate(attr, control.val())) { return; } list.find(".error-" + attr).remove(); ctrlGroup.removeClass("error"); if (list.find(".error").length === 0) { return list.parent().remove(); } }; View.prototype.invalid = function(view, attr, error, selector) { var control, ctrlGroup, group, list; control = view.$('[' + selector + '=\"' + attr + '\"]'); group = control.parents(".form-group"); ctrlGroup = control.parents(".control-group"); list = group.find(".error-list"); ctrlGroup.addClass("error"); if (list.length === 0) { group.prepend('
'); list = group.find(".error-list"); } list.find(".error-" + attr).remove(); if (_.isArray(error)) { return _.each(error, function(err) { return list.append('
  • ' + attr + ' ' + err + '
  • '); }); } else { return list.append('
  • ' + error + '
  • '); } }; View.prototype.addErrors = function(model, errors) { var errors_json, invalid, view; invalid = this.invalid; view = this; errors_json = JSON.parse(errors.responseText); return _.each(errors_json.errors, function(val, key) { return invalid(view, key, val, "name"); }); }; View.prototype.render = function() { View.__super__.render.apply(this, arguments); if (this.model) { rivets.bind(this.$el, { model: this.model }); } return this; }; View.prototype.unload = function() { View.__super__.unload.apply(this, arguments); debug('Called IuguUI.View:close'); if (this.model) { Backbone.Validation.unbind(this); this.model.off(null, null, this); } if (this.collection) { return this.collection.off(null, null, this); } }; return View; })(IuguUI.Base); this.IuguUI.View = IuguUI.View; }).call(this); ;FI"required_assets_digest;F"%286c3ea7f5e49ddf657df0bcca750d9dI" _version;F"%9f3b95dd7ea3030dc35985c0a8020862