From 68e6835da173fd6c2424c34ef97260f81c396edf Mon Sep 17 00:00:00 2001 From: Colin McLeod Date: Wed, 27 May 2015 03:21:22 -0700 Subject: [PATCH] Handle component select wrapping edge cases --- app/js/directives/directive-component-select.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/js/directives/directive-component-select.js b/app/js/directives/directive-component-select.js index c729d6d9..2f0b851b 100755 --- a/app/js/directives/directive-component-select.js +++ b/app/js/directives/directive-component-select.js @@ -3,12 +3,12 @@ angular.module('app').directive('componentSelect', function () { // Generting the HTML in this manner is MUCH faster than using an angular template. function appendGroup(list, opts, cid, mass) { - var prevClass = null; + var prevClass = null, prevRating = null; for (var i = 0; i < opts.length; i++) { var o = opts[i]; var id = o.id || (o.class + o.rating); // Common components' ID is their class and rating - if(i > 0 && opts.length > 3 && o.class != prevClass && o.grp != 'cr') { + if(i > 0 && opts.length > 3 && o.class != prevClass && (!o.grp || o.rating != prevRating || o.mode)) { list.push('
'); } @@ -37,6 +37,7 @@ angular.module('app').directive('componentSelect', function () { list.push(''); prevClass = o.class; + prevRating= o.rating; } }