o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1362483043.9076879: @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-03-05T08:30:28-03:00;FI" length;FiI" digest;F"%0ef22410734e10a02735b7134c51db3dI" 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.secondaryView = false; View.prototype.initialize = function() { View.__super__.initialize.apply(this, arguments); window.Events.on("fillSlots", this.fillSlots); window.Events.on("resetSlots", this.resetSlots); if (this.options.secondaryView) { this.secondaryView = this.options.secondaryView; } 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.fillSlots = function(context) { return _.each(_.keys(context), function(key) { var renderContext; renderContext = context[key]; if (renderContext.el) { context[key].$el.detach(); return this.$(key).empty().append(context[key].el); } else { return this.$(key).empty().append(context[key]); } }); }; View.prototype.resetSlots = function(slots) { return _.each(slots, function(slot) { return this.$(slot).empty(); }); }; View.prototype.enableLoader = function() { debug("ENABLED LOADER"); this.viewLoader = $('
'); return $(this.el).append(this.viewLoader); }; View.prototype.disableLoader = function() { debug("DISABLED LOADER"); if (this.viewLoader) { return this.viewLoader.remove(); } }; View.prototype.load = function() { debug("ON LOAD"); this.disableLoader(); return this.render(); }; 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() { if (this.model) { rivets.bind(this.$el, { model: this.model }); } if (app.activeView !== this && this.secondaryView === false) { if (app.activeView) { app.activeView.close(); } app.activeView = this; } if (window.app.rootWindow.setTitle) { window.app.rootWindow.setTitle(this.title); } View.__super__.render.apply(this, arguments); return this; }; View.prototype.unload = function() { debug('Called IuguUI.View:unload'); if (this.model) { Backbone.Validation.unbind(this); this.model.off(null, null, this); } if (this.collection) { this.collection.off(null, null, this); } return View.__super__.unload.apply(this, arguments); }; return View; })(IuguUI.Base); this.IuguUI.View = IuguUI.View; }).call(this); ;FI"required_assets_digest;F"%c8510030daa0b3a0c962c93a4499ea80I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862