R. S. Doiel, rsdoiel@caltech.edu
Caltech Library, Digital Library Development
TBD
Welcome everyone,
This presentation builds on what we built in the Part 2.
This workshop is focused on enhancing our application with Web Components from CL-web-components.
datasetd recipes_api.yaml
https://github.com/caltechlibrary/CL-Web-Components
<textarea-csv></textarea-csv>
do?
See https://caltechlibrary.github.io/CL-Web-compenents/textarea-csv.html
Next steps
utils.js
by adding a saveRecipe
functionOn macOS or Linux.
curl -L -o htdocs/modules/textarea-csv.js \
https://raw.githubusercontent.com/caltechlibrary/CL-web-components/refs/heads/main/textarea-csv.js
On Windows
irm `
https://raw.githubusercontent.com/caltechlibrary/CL-web-components/refs/heads/main/textarea-csv.js `
-Outfile ./htdocs/modules/textarea-csv.js
On macOS or Linux.
mv textarea-csv.js htdocs/modules
On Windows
move textarea-csv.js htdocs/modules
Wrap our ingredients textarea
in a
textarea-csv
.
<textarea-csv id="ingredients" name="ingredients"
title="ingredient,units (CSV data)" placeholder="flour,2 cups"
cols="60"rows="10"
column-headings="Ingredients,Units" debug="true">
<textarea id="ingredients" name="ingredients"
title="ingredient,units (CSV data)" placeholder="flour,2 cups"
cols="60"rows="10">
</textarea>
</textarea-csv>
What happens when I press “save” button in the web form?
We’re missing the script element that imports our component.
Include this in the head element of the page.
Try submitting the form again. What happens?
The utils.js needs
asaveRecipe
function.
macOS and Linux
curl -L -o htdocs/modules/utils.js \
https://raw.githubusercontent.com/caltechlibrary/t2t3_dataset_web_apps/refs/heads/main/htdocs2/modules/utils.js
Windows
irm `
https://raw.githubusercontent.com/caltechlibrary/t2t3_dataset_web_apps/refs/heads/main/htdocs2/modules/utils.js `
-Output htdocs/modules/utils.js
Add the following at the page before the to process the submission.
Do web components contradict the division of responsibilities?
Is it OK to require JavaScript in a web page?
Is progressive enhancement still relevant in 2025?