replaced ajax for compatibility with jQuery slim #781
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Edited: I prefer merging #782
Goal
To resolve #766
Background
Brief evolution history of the part of code concerned for Staticman integration over the past year:
beautiful-jekyll/_includes/staticman-script.html
Lines 4 to 6 in 3a45190
Description
The
ajax
method used by jQuery can be replaced by thefetch
method, which belongs to standard JS. In this way, the problem would be gone.Testing
To properly test this PR, you need a working Staticman API instance. I've inactivated mine @staticmanlab due to Staticman's maintainer's advice to move away from any public API instances in the comments in eduardoboucas/staticman#337. For a Staticman API instance setup guide, you may see, for example, what I've written in #775, or https://github.com/pacollins/hugo-future-imperfect-slim/wiki/staticman.yml, which are inspired by Jan Hajek's article about Staticman v3.
I've merged the
sm3slim
branch into thegh-pages
branch for my fork of this theme:VincentTam/beautiful-jekyll@e37a4fd...VincentTam:bccdcafb.
P.S. I had made a careless mistake in the
endpoint
site config variable while merging the recent development into mygh-pages
branch. I corrected that at bccdcaf.Make sure that you've correctly filled in the theme-specific site config. Here's the one used in this test.
I sent a sample message through my online form on my testing site : https://git.io/bjsm18.
fields[message]
new post method
fields[name
Vincent Tam
fields[email]
xxxx@live.hk
fields[url]
https://vincentkltam.gitlab.io
options[origin]
https://vincenttam.github.io/beautiful-jekyll/2020-02-28-test-markdown/
options[slug]
test-markdown
I observed a success message. My Staticman API's (
secretman3 d0τ herokuapp d0t com
) response:Successful PR: New comment by Vincent Tam VincentTam/beautiful-jekyll#35
P.S. I made error in the
endpoint
variable at VincentTam@f90ee57#diff-ecec67b0e1d7e17a83587c6d27b6baaaa133f42482b07bd3685c77f34b62d883R183. That enabled me to view the displayed error message after merging thesm3slim
branch at 36e8bca before correct that variable at the following commit.