mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Select bug fixes
This commit is contained in:
@@ -4,13 +4,13 @@ angular.module('app').directive('componentSelect', function() {
|
|||||||
|
|
||||||
function appendGroup(list, opts, cid, mass) {
|
function appendGroup(list, opts, cid, mass) {
|
||||||
var prevClass = null, prevRating = null;
|
var prevClass = null, prevRating = null;
|
||||||
var count = Object.keys(opts).length;
|
|
||||||
for (var i = 0; i < opts.length; i++) {
|
for (var i = 0; i < opts.length; i++) {
|
||||||
var o = opts[i];
|
var o = opts[i];
|
||||||
|
var id = o.id || (o.class + o.rating); // Common components' ID is their class and rating
|
||||||
list.push('<li class="', o.name? 'lc' : 'c');
|
list.push('<li class="', o.name? 'lc' : 'c');
|
||||||
if(o.class != prevClass && count > 6) list.push(' cl');
|
if(o.class != prevClass && o.rating != prevRating) list.push(' cl');
|
||||||
if (cid == o.id) list.push(' active');
|
if (cid == o.id) list.push(' active');
|
||||||
list.push((o.maxmass && mass > o.maxmass)? ' disabled"' : '" cpid="', o.id, '">', o.class, o.rating);
|
list.push((o.maxmass && mass > o.maxmass)? ' disabled"' : '" cpid="', id, '">', o.class, o.rating);
|
||||||
if(o.mode) {
|
if(o.mode) {
|
||||||
list.push('/' + o.mode);
|
list.push('/' + o.mode);
|
||||||
if(o.missile) {
|
if(o.missile) {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ angular.module('app').service('Serializer', ['lodash', function (_) {
|
|||||||
_.map(ship.hardpoints, idToStr),
|
_.map(ship.hardpoints, idToStr),
|
||||||
_.map(ship.internal, idToStr),
|
_.map(ship.internal, idToStr),
|
||||||
];
|
];
|
||||||
console.log('code',_.flatten(data).join(''));
|
|
||||||
return _.flatten(data).join('');
|
return _.flatten(data).join('');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function (_) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function filter (data, maxClass, minClass, mass) {
|
function filter (data, maxClass, minClass, mass) {
|
||||||
return _.filter(data, function (c) {
|
return _.filter(data, function (c, index, collection) {
|
||||||
return c.class <= maxClass && c.class >= minClass && (c.maxmass === undefined || mass <= c.maxmass)
|
return c.class <= maxClass && c.class >= minClass && (c.maxmass === undefined || mass <= c.maxmass)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user