Skip to content

Commit

Permalink
Merge pull request #4987 from archesproject/4670_geojson_card_component
Browse files Browse the repository at this point in the history
 refactoring, cleanup and fixes
  • Loading branch information
robgaston committed Jul 9, 2019
2 parents 86dbacc + 6e650e2 commit def6e97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
26 changes: 12 additions & 14 deletions arches/app/media/js/views/components/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};
Expand Down
18 changes: 9 additions & 9 deletions arches/app/templates/views/components/map-editor.htm
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ <h5 data-bind="text: card.model.instructions"></h5>
}
">
<option value=""></option>
<option value="draw_point">Add point</option>
<option value="draw_line_string">Add line</option>
<option value="draw_polygon">Add polygon</option>
<option value="draw_point">{% trans "Add point" %}</option>
<option value="draw_line_string">{% trans "Add line" %}</option>
<option value="draw_polygon">{% trans "Add polygon" %}</option>
</select>
</div>
<table class="table">
Expand All @@ -128,13 +128,13 @@ <h5 data-bind="text: card.model.instructions"></h5>
<td class="map-card-feature-tool">
<a href="javascript:void(0);" data-bind="click: function() { self.editFeature(feature) }">
<i class="fa fa-pencil map-card-feature-edit"></i>
Edit
{% trans "Edit" %}
</a>
</td>
<td class="map-card-feature-tool">
<a href="javascript:void(0);" data-bind="click: function() { self.deleteFeature(feature) }">
<i class="fa fa-times-circle-o map-card-feature-delete"></i>
Delete
<i class="fa fa-trash map-card-feature-delete"></i>
{% trans "Delete" %}
</a>
</td>
</tr>
Expand Down Expand Up @@ -192,9 +192,9 @@ <h5 data-bind="text: card.model.instructions"></h5>
}">{% trans 'Delete this record' %}</button>
<!-- /ko -->
<!-- ko if: tile.dirty() -->
<!-- ko if: provisionalTileViewModel && !provisionalTileViewModel.tileIsFullyProvisional() && card.isWritable -->
<button class="btn btn-shim btn-danger btn-labeled btn-lg fa fa-times" data-bind="click: tile.reset">{% trans 'Cancel edit' %}</button>
<!-- /ko -->
<!-- ko if: provisionalTileViewModel && !provisionalTileViewModel.tileIsFullyProvisional() && card.isWritable -->
<button class="btn btn-shim btn-danger btn-labeled btn-lg fa fa-times" data-bind="click: tile.reset">{% trans 'Cancel edit' %}</button>
<!-- /ko -->
<!-- ko if: tile.tileid -->
<button class="btn btn-shim btn-labeled btn-lg fa fa-plus" data-bind="click: function () {
self.form.saveTile(tile);
Expand Down

0 comments on commit def6e97

Please sign in to comment.