The additional fields dropdown now mixes universal and moreFields and is sorted alphabetically

This commit is contained in:
Quincy Morgan
2019-01-17 11:37:05 -05:00
parent ecec397736
commit 9f7ef21e5c
2 changed files with 6 additions and 13 deletions
-4
View File
@@ -131,10 +131,6 @@ export function presetIndex() {
});
}
// move the wikidata field to directly follow the wikipedia field
_universal.splice(_universal.indexOf(_fields.wikidata), 1);
_universal.splice(_universal.indexOf(_fields.wikipedia)+1, 0, _fields.wikidata);
if (d.presets) {
var rawPresets = d.presets;
_forEach(d.presets, function(d, id) {
+6 -9
View File
@@ -1,5 +1,5 @@
import { dispatch as d3_dispatch } from 'd3-dispatch';
import _union from 'lodash-es/union';
import {
event as d3_event,
select as d3_select
@@ -53,16 +53,13 @@ export function uiPresetEditor(context) {
);
}
_preset.moreFields.forEach(function(field) {
if (_preset.fields.indexOf(field) === -1) {
_fieldsArr.push(
uiField(context, field, entity, { show: false })
);
}
var additionalFields = _union(_preset.moreFields, presets.universal());
additionalFields.sort(function(field1, field2) {
return field1.label() > field2.label();
});
presets.universal().forEach(function(field) {
if (_preset.fields.indexOf(field) === -1 && _preset.moreFields.indexOf(field) === -1) {
additionalFields.forEach(function(field) {
if (_preset.fields.indexOf(field) === -1) {
_fieldsArr.push(
uiField(context, field, entity, { show: false })
);