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

feat(Url.js): add getFieldURL helper function to get the url value of a field based on its structure #4731

Merged
merged 6 commits into from
Jul 19, 2023

Conversation

razvanMiu
Copy link
Contributor

@razvanMiu razvanMiu commented Apr 26, 2023

#2252

This pr adds a simple helper function that can be used to get the url of a field.
The field can have the following structures:

I.

buttonLink: {
   url: '/some/path'
}

II.

buttonLink: {
  "@id": '/some/path'
}

III.

buttonLink: {
   "@type": "URL",
   value: '/some/path'
}

It is meant to be used alongside a new deserialization method of URL type fields, like this one from here plone/plone.restapi#1595.

Usage:

getFieldURL(buttonLink)  // '/some/path'

@netlify
Copy link

netlify bot commented Apr 26, 2023

Deploy Preview for volto ready!

Name Link
🔨 Latest commit aa8f249
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/648c56ec8d09cc0008b7c822
😎 Deploy Preview https://deploy-preview-4731--volto.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@cypress
Copy link

cypress bot commented Apr 26, 2023

Passing run #5708 ↗︎

0 503 20 0 Flakiness 0

Details:

Merge branch 'master' into url-field-helper
Project: Volto Commit: aa8f249669
Status: Passed Duration: 14:22 💡
Started: Jun 16, 2023 12:38 PM Ended: Jun 16, 2023 12:52 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

Copy link
Member

@sneridagh sneridagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please add some unit tests for the new helper. Thanks!

@razvanMiu
Copy link
Contributor Author

@sneridagh I added unit tests, can you take a look now?

@avoinea avoinea requested a review from sneridagh June 16, 2023 12:34
@sneridagh sneridagh added this to the Plone 6.1 milestone Jul 18, 2023
@sneridagh sneridagh merged commit 48baf29 into master Jul 19, 2023
@sneridagh sneridagh deleted the url-field-helper branch July 19, 2023 09:39
sneridagh added a commit that referenced this pull request Jul 21, 2023
* master:
  feat(Url.js): add getFieldURL helper function to get the url value of a field based on its structure (#4731)
  Handle @linkintegrity response with items but no breaches (#4832)
sneridagh pushed a commit that referenced this pull request Jul 23, 2023
… a field based on its structure (#4731)

Co-authored-by: Alin Voinea <contact@avoinea.com>
sneridagh added a commit that referenced this pull request Jul 23, 2023
… a field based on its structure (#4731) (#5014)

Co-authored-by: Miu Razvan <miu.razvan28@gmail.com>
Co-authored-by: Alin Voinea <contact@avoinea.com>
sneridagh added a commit that referenced this pull request Jul 24, 2023
* master: (42 commits)
  make selectedView and className props available for Search block (#4997)
  Release @plone/volto-testing 4.0.0-alpha.0
  Release 17.0.0-alpha.21
  Upgrade to Cypress 12.17.1 (latest) (#4981)
  Image rendering (#3337)
  feat(Url.js): add getFieldURL helper function to get the url value of a field based on its structure (#4731)
  Handle @linkintegrity response with items but no breaches (#4832)
  Release 17.0.0-alpha.20
  Use all the apiExpanders in use, so we perform a single request for getting all the required data. (#4946)
  Fix the condition deciding on listing pagination format so it takes into account container blocks as well (#4978)
  Release 17.0.0-alpha.19
  Fix search block input clear button doesn't reset the search (#4837)
  Add /ok route as an express middleware (#4432)
  handles condition for yearly frequency in recurrence (#4604)
  Remove dangling out of place Guillotina Cypress tests (#4980)
  Update to latest plone.restapi and Plone 6.0.6 (#4979)
  Update browserlist (#4977)
  `Links and references` view via content menu [Add `Links to item` view] (#4787)
  Release 17.0.0-alpha.18
  Toc responsive (#4912)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants