earthworks icon indicating copy to clipboard operation
earthworks copied to clipboard

Code snippet functionality for EarthWorks

Open hudajkhan opened this issue 6 months ago • 1 comments

Closes https://github.com/sul-dlss/earthworks/issues/1049 .

What this pull request does:

  • Add an "other options" component to the sidebar which also includes a link to open the code snippet manual
  • Adds the ability to see code samples
  • Adds code snippet link to show tools. (Note: the UI designs show this in a different place, so we will need to move the link to the right place once we start working on UI changes).
  • Reads code snippets from static files. (Not all the files are complete, and some are placeholders).
  • Uses the following logic to determine which file needs to be displayed: if resource type is "Raster data", show raster code samples. If resource type is "Vector data","Polygon data", "Point data", "Line data", or "Index Maps", show vector samples.
  • Show tabs for three languages: Python, R, Leaflet.
  • I've added some specific tokens for wxs identifier, geoserver wms, and geoserver wfs within some code samples, to allow these values to be replaced. This will allow the static template to say <<WXS_ID>>, for example, while the code sample page will be able to get that field from the Solr document and insert the value into the page.
  • Clicking the "Copy" button will show "Copied" with a check mark to the left. Clicking on any of the tab links, including the current one, will change the button text back to "Copy" and hide the check mark.

hudajkhan avatar Aug 07 '24 16:08 hudajkhan