From 2a2f02482b6b82e8ac0cb24245fb0c300c6393c9 Mon Sep 17 00:00:00 2001 From: Rob Gaston Date: Mon, 8 Jul 2019 17:30:32 -0700 Subject: [PATCH] refactoring, cleanup and fixes, re: #4670 --- arches/app/media/js/views/components/map.js | 26 +++++++++---------- .../templates/views/components/map-editor.htm | 18 ++++++------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/arches/app/media/js/views/components/map.js b/arches/app/media/js/views/components/map.js index aa5ec25c599..6e6ce9a893c 100644 --- a/arches/app/media/js/views/components/map.js +++ b/arches/app/media/js/views/components/map.js @@ -186,25 +186,23 @@ define([ if (resourceLookup[resourceId]) { return resourceLookup[resourceId]; } - resourceData.loading = true; - resourceData.displaydescription = ''; - resourceData['map_popup'] = ''; - resourceData.displayname = ''; - resourceData.graphid = ''; - resourceData['graph_name'] = ''; - resourceData.featureCollections = []; + resourceData = _.defaults(resourceData, { + 'loading': true, + 'displaydescription': '', + 'map_popup': '', + 'displayname': '', + 'graphid': '', + 'graph_name': '', + 'geometries': [] + }); resourceData = ko.mapping.fromJS(resourceData); resourceData.reportURL = arches.urls.resource_report; resourceData.editURL = arches.urls.resource_editor; + resourceLookup[resourceId] = resourceData; $.get(arches.urls.resource_descriptors + resourceId, function(data) { - resourceLookup[resourceId].displaydescription(data.displaydescription); - resourceLookup[resourceId].map_popup(data.map_popup); - resourceLookup[resourceId].displayname(data.displayname); - resourceLookup[resourceId].graphid(data.graphid); - resourceLookup[resourceId].graph_name(data.graph_name); - resourceLookup[resourceId].featureCollections(data.geometries); - resourceLookup[resourceId].loading(false); + data.loading = false; + ko.mapping.fromJS(data, resourceLookup[resourceId]); }); return resourceLookup[resourceId]; }; diff --git a/arches/app/templates/views/components/map-editor.htm b/arches/app/templates/views/components/map-editor.htm index 1ca8746d577..f5507123452 100644 --- a/arches/app/templates/views/components/map-editor.htm +++ b/arches/app/templates/views/components/map-editor.htm @@ -113,9 +113,9 @@
} "> - - - + + + @@ -128,13 +128,13 @@
@@ -192,9 +192,9 @@
}">{% trans 'Delete this record' %} - - - + + +
- Edit + {% trans "Edit" %} - - Delete + + {% trans "Delete" %}