diff --git a/CHANGELOG.md b/CHANGELOG.md index 797daaba83..37ee47b1cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project does not yet adheres to [Semantic Versioning](https://semv ### Added +- Simplemappr (https://www.simplemappr.net) export support from filter collection objects - Print key task [#4071] - `/api/v1/leads/key/:id` endpoint serving `pinpoint` key app - Filter loans: Identifiers, created by and updated by columns [#4098] diff --git a/app/controllers/tasks/gis/simplemappr_controller.rb b/app/controllers/tasks/gis/simplemappr_controller.rb new file mode 100644 index 0000000000..82b4276683 --- /dev/null +++ b/app/controllers/tasks/gis/simplemappr_controller.rb @@ -0,0 +1,8 @@ +class Tasks::Gis::SimplemapprController < ApplicationController + include TaskControllerConfiguration + + # POST + def index + end + +end diff --git a/app/helpers/workbench/table_helper.rb b/app/helpers/workbench/table_helper.rb index 1cddeb1551..89aab5b307 100644 --- a/app/helpers/workbench/table_helper.rb +++ b/app/helpers/workbench/table_helper.rb @@ -25,19 +25,19 @@ def fancy_metadata_cells_tag(object) def fancy_options_cells_tag(object) m = metamorphosize_if(object) fancy_show_tag(m) + - fancy_edit_tag(m) + + fancy_edit_tag(m) + fancy_pin_tag(m) + content_tag(:td, (link_to 'Destroy', m, method: :delete, data: {confirm: 'Are you sure?'}), class: 'table-options', data: {delete: true}) - end + end def fancy_show_tag(object) - defined?(object.annotated_object) ? + defined?(object.annotated_object) ? content_tag(:td, (link_to 'Show', metamorphosize_if(object.annotated_object)), class: 'table-options', data: {show: true}) : content_tag(:td, (link_to 'Show', object), class: 'table-options', data: {show: true}) end def fancy_edit_tag(object) - content_tag(:td, edit_object_link(object), class: 'table-options', data: {edit: true}) + content_tag(:td, edit_object_link(object), class: 'table-options', data: {edit: true}) end def fancy_pin_tag(object) @@ -61,4 +61,14 @@ def table_from_hash_tag(hash) end end + # Almost certainly not DRY within TW + def table_from_csv(csv, id: nil) + s = "" + csv.by_row.each do |r| + s << tag.tr( r.fields.collect{|a| tag.td(a)}.join.html_safe) + end + s << '
' + s.html_safe + end + end diff --git a/app/javascript/vue/components/radials/linker/constants/links.js b/app/javascript/vue/components/radials/linker/constants/links.js index 340e93eb82..3e7aba89db 100644 --- a/app/javascript/vue/components/radials/linker/constants/links.js +++ b/app/javascript/vue/components/radials/linker/constants/links.js @@ -110,3 +110,11 @@ export const TASK_NEW_CONTAINER = { queryParam: true, saveQuery: true } + +export const TASK_SIMPLEMAPPR = { + label: 'SimpleMappr', + link: '/tasks/gis/simplemappr', + post: true, + queryParam: true +} + diff --git a/app/javascript/vue/components/radials/linker/links/CollectionObject.js b/app/javascript/vue/components/radials/linker/links/CollectionObject.js index e0dcca038c..e77f99299f 100644 --- a/app/javascript/vue/components/radials/linker/links/CollectionObject.js +++ b/app/javascript/vue/components/radials/linker/links/CollectionObject.js @@ -4,25 +4,28 @@ import { TASK_COLLECTION_OBJECT_SUMMARY, TASK_COLLECTION_OBJECT_OUTDATED_NAMES, TASK_FIELD_SYNCHRONIZE, - TASK_NEW_CONTAINER + TASK_NEW_CONTAINER, + TASK_SIMPLEMAPPR } from '../constants/links' export const CollectionObject = { all: [ TASK_COLLECTION_OBJECT_MATCH, - TASK_COLLECTION_OBJECT_TABLE, - TASK_COLLECTION_OBJECT_SUMMARY, TASK_COLLECTION_OBJECT_OUTDATED_NAMES, + TASK_COLLECTION_OBJECT_SUMMARY, + TASK_COLLECTION_OBJECT_TABLE, TASK_FIELD_SYNCHRONIZE, - TASK_NEW_CONTAINER + TASK_NEW_CONTAINER, + TASK_SIMPLEMAPPR ], ids: [ TASK_COLLECTION_OBJECT_MATCH, - TASK_COLLECTION_OBJECT_TABLE, - TASK_COLLECTION_OBJECT_SUMMARY, TASK_COLLECTION_OBJECT_OUTDATED_NAMES, + TASK_COLLECTION_OBJECT_SUMMARY, + TASK_COLLECTION_OBJECT_TABLE, TASK_FIELD_SYNCHRONIZE, - TASK_NEW_CONTAINER + TASK_NEW_CONTAINER, + TASK_SIMPLEMAPPR ] } diff --git a/app/views/tasks/gis/simplemappr/index.html.erb b/app/views/tasks/gis/simplemappr/index.html.erb new file mode 100644 index 0000000000..6f3ad76e79 --- /dev/null +++ b/app/views/tasks/gis/simplemappr/index.html.erb @@ -0,0 +1,8 @@ +

Simplemappr table

+ Paste the copied table into a text file, name it your_data.txt. The file should load at simplemappr. +
+
+<%= copy_table_to_clipboard('div#simplemappr') %> +
+ <%= table_from_csv( simple_mappr_data(params) ) %> +
diff --git a/config/routes/tasks.rb b/config/routes/tasks.rb index 32c8b52339..2ffe4eaa17 100644 --- a/config/routes/tasks.rb +++ b/config/routes/tasks.rb @@ -530,6 +530,10 @@ end scope :gis do + scope :simplemappr, controller: 'tasks/gis/simplemappr' do + match '/', action: :index, via: [:get, :post] + end + scope :geographic_area_lookup, controller: 'tasks/gis/geographic_area_lookup' do get 'index', as: 'geographic_area_lookup_task' get 'resolve', as: 'geographic_area_lookup_resolve_task', format: :js