Simplify how we determine if asset is already showing.

This commit is contained in:
cahrens
2013-09-19 16:05:08 -04:00
parent 01d7d48f8f
commit 9ceee3627f

View File

@@ -31,12 +31,7 @@ CMS.Views.Assets = Backbone.View.extend({
addAsset: function (model) {
// If asset is not already being shown, add it.
if (_.all(
this.collection.models,
function (asset) {
return asset.get('url') !== model.get('url');
})) {
if (this.collection.findWhere({'url': model.get('url')}) === undefined) {
this.collection.add(model, {at: 0});
var view = new CMS.Views.Asset({model: model});
this.$el.prepend(view.render().el);