Commit 77e933d93d342c7481e197fae9461cb8d0c8ecb1
- Diff rendering mode:
- inline
- side by side
swtr/static/js/swtmaker.js
(8 / 3)
  | |||
256 | 256 | }, this); | |
257 | 257 | ||
258 | 258 | // pluck uniq tags of sweets | |
259 | var tags = _.chain(this.collection.pluck('how')).pluck('tags').uniq(). | ||
260 | value(); | ||
259 | var tags = _.chain(this.collection.pluck('how')).pluck('tags').flatten(). | ||
260 | uniq().value(); | ||
261 | 261 | // render them as filter controls | |
262 | 262 | _.each(tags, function(tag) { | |
263 | 263 | if(tag) { | |
… | … | ||
308 | 308 | return; | |
309 | 309 | } | |
310 | 310 | var filtered_swts = this.collection.filter(function(model) { | |
311 | //TODO: find a better way of doing this.. | ||
312 | var flag = false; | ||
311 | 313 | _.each(model.get('how').tags, function(tag) { | |
312 | 314 | if(_.indexOf(tags, tag) > -1) { | |
313 | return model; | ||
315 | flag = true; | ||
314 | 316 | } | |
315 | 317 | }); | |
318 | if(flag === true) { | ||
319 | return model; | ||
320 | } | ||
316 | 321 | }); | |
317 | 322 | if(filtered_swts.length) { | |
318 | 323 | anno.removeAll(); |