o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1373285456.911069:@value"ê{I"
class:EFI"ProcessedAsset; FI"logical_path; F"/iugu-ux/components/usecode/iugu-ui-view.jsI"
pathname; F"|/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-view.js.coffeeI"content_type; FI"application/javascript; FI"
mtime; FI"2013-07-05T20:29:53-03:00; FI"length; FiVI"digest; F"%48b5a5c53e9889bef636e7b7c068854fI"source; FI"V(function() {
var _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; };
IuguUI.View = (function(_super) {
__extends(View, _super);
function View() {
_ref = View.__super__.constructor.apply(this, arguments);
return _ref;
}
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);
this.defaultLayout = this.layout;
if (this.options.secondaryView) {
this.secondaryView = this.options.secondaryView;
}
if (this.model) {
Backbone.Validation.bind(this, {
forceUpdate: true,
valid: function(view, attr, selector, cid) {
return view.valid(view, attr, selector, cid);
},
invalid: function(view, attr, error, selector, cid) {
return view.invalid(view, attr, error, selector, cid);
}
});
this.model.on('error', this.addErrors, this);
}
return this;
};
View.prototype.redirectBack = function() {
return history.back();
};
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, cid) {
var control, group, list, new_attr, sel;
sel = '[' + selector + '~="' + attr + '"]';
if (cid) {
sel = sel + '[cid="' + cid + '"]';
}
control = view.$(sel);
group = view.$(".form-group");
list = group.find(".error-list");
if (view.model.preValidate(attr, control.val())) {
return;
}
new_attr = attr.replace('.', '-');
this.$(".error-" + new_attr).remove();
control.parents('.iugu-ui-form-wrapper').removeClass("input-with-errors");
if (list.find(".error").length === 0) {
return list.parent().remove();
}
};
View.prototype.invalid = function(view, attr, error, selector, cid) {
var control, group, list, model_name, new_attr, parent_model, right_attr, sel;
sel = '[' + selector + '~="' + attr + '"]';
if (cid) {
sel = sel + '[cid="' + cid + '"]';
}
control = view.$(sel);
group = view.$(".form-group");
list = group.find(".error-list");
control.parents('.iugu-ui-form-wrapper').addClass("input-with-errors");
if (list.length === 0) {
group.prepend('');
list = group.find(".error-list");
}
new_attr = attr.replace('.', '-');
list.find(".error-" + new_attr).remove();
parent_model = "";
if (cid != null) {
parent_model = "error-" + attr.split('.')[0];
}
model_name = this.model.identifier;
right_attr = attr.split('.');
right_attr = right_attr[right_attr.length - 1];
if (model_name == null) {
right_attr = attr;
}
if (_.isArray(error)) {
return _.each(error, function(err) {
return list.append("" + (_t(model_name + '_fields.' + right_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.doEmptyCollectionLogic = function() {
if ((this.collection != null) && this.collection.length === 0) {
this.layout = this.emptyCollection.layout || 'iugu-ui-view-empty';
return this.extendContextWithEmptyCollection();
} else {
if (this.defaultLayout != null) {
return this.layout = this.defaultLayout;
}
}
};
View.prototype.extendContextWithEmptyCollection = function() {
var ctx;
ctx = this.context();
return this.context = function() {
return _.extend(ctx, {
emptyCollection: this.emptyCollection
});
};
};
View.prototype.render = function() {
if (this.emptyCollection != null) {
this.doEmptyCollectionLogic();
}
View.__super__.render.apply(this, arguments);
if (app.activeView !== this && this.secondaryView === false) {
if (app.activeView) {
app.activeView.close();
}
app.activeView = this;
}
if ((window.app.rootWindow != null) && window.app.rootWindow.setTitle) {
window.app.rootWindow.setTitle(this.title);
}
if (this.model) {
rivets.bind(this.$el, {
model: this.model
});
}
IuguUI.Combobox.load(this.$el);
IuguUI.Button.load(this.$el);
IuguUI.Checkbox.load(this.$el);
IuguUI.Radio.load(this.$el);
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);
; TI"dependency_digest; F"%66bfeefcec865f517684822519209927I"required_paths; F["|/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-view.js.coffeeI"dependency_paths; F[{I" path; F"|/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-view.js.coffeeI"
mtime; FI"2013-07-05T20:29:53-03:00; FI"digest; F"%c32d18074664da3937d32a627111565bI"
_version; F"%6776f581a4329e299531e1d52aa59832