Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring, cleanup and fixes #4987

Merged
merged 2 commits into from
Jul 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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