Commit 9ceee362 by cahrens

Simplify how we determine if asset is already showing.

parent 01d7d48f
...@@ -31,12 +31,7 @@ CMS.Views.Assets = Backbone.View.extend({ ...@@ -31,12 +31,7 @@ CMS.Views.Assets = Backbone.View.extend({
addAsset: function (model) { addAsset: function (model) {
// If asset is not already being shown, add it. // If asset is not already being shown, add it.
if (_.all( if (this.collection.findWhere({'url': model.get('url')}) === undefined) {
this.collection.models,
function (asset) {
return asset.get('url') !== model.get('url');
})) {
this.collection.add(model, {at: 0}); this.collection.add(model, {at: 0});
var view = new CMS.Views.Asset({model: model}); var view = new CMS.Views.Asset({model: model});
this.$el.prepend(view.render().el); this.$el.prepend(view.render().el);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment