Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jsAttributesHandler #1622

Merged
merged 3 commits into from Aug 26, 2019

Conversation

@jezen
Copy link
Member

commented Aug 23, 2019

This adds jsAttributesHandler to run arbitrary Handler code before building the attributes map for the script tag generated by widgetFile. This is useful if you need to add a randomised nonce value to that tag.

Closes #1621

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

@jezen jezen requested a review from snoyberg Aug 23, 2019

Add jsAttributesHandler
This adds `jsAttributesHandler` to run arbitrary Handler code before
building the attributes map for the script tag generated by `widgetFile`.
This is useful if you need to add a randomised nonce value to that tag.

Closes #1621
--
-- @since 1.6.16
jsAttributesHandler :: HandlerFor site [(Text, Text)]
jsAttributesHandler = getYesod >>= return . jsAttributes

This comment has been minimized.

Copy link
@snoyberg

snoyberg Aug 26, 2019

Member

This can also be written as jsAttributes <$> getYesod, but there difference isn't that improtant.

This comment has been minimized.

Copy link
@jezen

jezen Aug 26, 2019

Author Member

I'm happy to make that change, and also some more hlint-driven cleanup along the way.

@snoyberg snoyberg merged commit 50a3242 into yesodweb:master Aug 26, 2019

23 checks passed

yesodweb.yesod Build #20190826.2 succeeded
Details
yesodweb.yesod (Linux cabal-8.0.2) Linux cabal-8.0.2 succeeded
Details
yesodweb.yesod (Linux cabal-8.2.2) Linux cabal-8.2.2 succeeded
Details
yesodweb.yesod (Linux cabal-8.4.4) Linux cabal-8.4.4 succeeded
Details
yesodweb.yesod (Linux cabal-8.6.5) Linux cabal-8.6.5 succeeded
Details
yesodweb.yesod (Linux nightly) Linux nightly succeeded
Details
yesodweb.yesod (Linux pedantic) Linux pedantic succeeded
Details
yesodweb.yesod (Linux stack-def) Linux stack-def succeeded
Details
yesodweb.yesod (Linux stack-lts-11) Linux stack-lts-11 succeeded
Details
yesodweb.yesod (Linux stack-lts-12) Linux stack-lts-12 succeeded
Details
yesodweb.yesod (Linux stack-lts-13) Linux stack-lts-13 succeeded
Details
yesodweb.yesod (Linux stack-lts-9) Linux stack-lts-9 succeeded
Details
yesodweb.yesod (Linux stack-persistent-2-10) Linux stack-persistent-2-10 succeeded
Details
yesodweb.yesod (Linux stack-persistent-2-9) Linux stack-persistent-2-9 succeeded
Details
yesodweb.yesod (Windows stack-lts-11) Windows stack-lts-11 succeeded
Details
yesodweb.yesod (Windows stack-lts-12) Windows stack-lts-12 succeeded
Details
yesodweb.yesod (Windows stack-lts-13) Windows stack-lts-13 succeeded
Details
yesodweb.yesod (macOS stack-lts-11) macOS stack-lts-11 succeeded
Details
yesodweb.yesod (macOS stack-lts-12) macOS stack-lts-12 succeeded
Details
yesodweb.yesod (macOS stack-lts-13) macOS stack-lts-13 succeeded
Details
yesodweb.yesod (macOS stack-lts-9) macOS stack-lts-9 succeeded
Details
yesodweb.yesod (macOS stack-persistent-2-10) macOS stack-persistent-2-10 succeeded
Details
yesodweb.yesod (macOS stack-persistent-2-9) macOS stack-persistent-2-9 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.