kdevo / osprey-delight

Osprey Delight is the free-minded artist's choice for a clutter-free and blazingly fast single-page portfolio.
https://hugo-mods.github.io/
Apache License 2.0
99 stars 44 forks source link

Basin contact requires Params.Contact.select #9

Closed blutack closed 3 years ago

blutack commented 3 years ago

Sorry for yet another one.

The exampleSite config.yaml says the following:

## Configure contact form:
[Params.Contact]
  # [str[]] i18n keys used to display in an additional select box.
  #   Comment out if you want to disable it.
  select = ["generic", "coop", "business", "project"]

However, if you comment it out comments won't work because the template correctly doesn't render the dropdown but the javascript assumes $('select[name=matter]') always exists on line 21.

I've "fixed it" on my site with the following change to check if there's a matter selection and if not, fall back to an empty string:

matter = $('select[name=matter]') ? $('select[name=matter]').value : "",

kdevo commented 3 years ago

Thanks for reporting this, definitely a bug! For prioritizing: Does it affect the contact form's functionality, i.e. did you still receive an e-mail or did the whole contact JS simply fail?

blutack commented 3 years ago

It does indeed prevent the form from submitting silently, as the event handler for the submit button breaks before it makes the request to Basin. From the user perspective, it looks like you push the submit button and nothing happens.

blutack commented 3 years ago

You could actually cherry pick in https://github.com/Fluxense/osprey-delight/commit/91977b6eae11c0866d0569601a05418d1ab173c1 if you want a quick and dirty fix.

kdevo commented 3 years ago

Thanks for clarifying this @blutack! I fixed it by introducing an additional template check within the contact.js. In case you want to test this, please checkout the dev branch.

kdevo commented 3 years ago

Hi @blutack

just a short info: I merged the fixes for the issues you reported to the main branch (among dozens of other improvements). Would be great if you let me know if everything works for you.