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

Teaser Block Image Overide #6147

Merged
merged 16 commits into from
Aug 1, 2024
Merged

Teaser Block Image Overide #6147

merged 16 commits into from
Aug 1, 2024

Conversation

Tishasoumya-02
Copy link
Contributor

@Tishasoumya-02 Tishasoumya-02 commented Jul 3, 2024

Copy link

netlify bot commented Jul 3, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 9ede06f
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/66ab8dfebd87d800085b39f3

)}
{
// eslint-disable-next-line
url != undefined && !isInternalURL(url) ? (
Copy link
Member

Choose a reason for hiding this comment

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

@Tishasoumya-02 why not simply url && !isInternalURL? Then you don't need to disable the eslint warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I tried doing this, but blocks-teaser.js cypress tests keeps failing , not sure why this behavior. I also tried using isUndefined() provided by lodash but same results

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I tried doing this, but blocks-teaser.js cypress tests keeps failing , not sure why this behavior. I also tried using isUndefined() provided by lodash but same results

Works for me locally
acceptance-tests-teaser

We also need as part of this fix a cypress test within blocks-teaser that makes use of this preview_image with an external image, maybe it could be an image from demo.plone.org or plone.org @sneridagh what do you suggest for testing this feature of the external image to link to for the teaser block?
An alternative would be an unittest which allows to enter whatever values in the url without actually visiting anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, not sure why it was not passing on my machine, but made the changes and disabled eslint warning

Copy link
Member

Choose a reason for hiding this comment

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

@ichim-david @Tishasoumya-02 We are already using images from the Github CDN in tests, we can use them too:

`https://github.com/plone/volto/raw/main/logos/volto-colorful.png{enter}`,

@Tishasoumya-02 Tishasoumya-02 force-pushed the teaser-image-overide branch from 083cbfc to 605e6ba Compare July 3, 2024 12:23
@ichim-david
Copy link
Member

ichim-david commented Jul 4, 2024

@Tishasoumya-02 I confirm it works when adding an external image.
@sneridagh I find it a bit strange that if you try to link to a scale there is nothing shown, you have to
use the picker or use the url of the image content type.
What if an editor right clicks and copies the image path it sees in the website and wants to use it for the
override source?

See this video for what I mean

teaser-image-source-2.mp4

@@ -50,16 +51,22 @@ const TeaserDefaultTemplate = (props) => {
}
>
<div className="teaser-item default">
{(href.hasPreviewImage || href.image_field || image) && (
{url && !isInternalURL(url) ? (
Copy link
Member

@ichim-david ichim-david Jul 9, 2024

Choose a reason for hiding this comment

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

Suggested change
{url && !isInternalURL(url) ? (
{url && !image?.image_field ? (

@Tishasoumya-02 try it like this, it will solve the situation where you link directly to a scale from within the site because you simply copied the link from an internal image.

Here is a screenshot showing this in action on my devel
teaser-url

We also have no test for this interaction where you add as an image override the link to an image scale.

I would be in favor of adding in that test the link to internal images at a minimum and external image if possible but we still didn't get any feedback from @sneridagh regarding my comment here #6147 (comment)

@Tishasoumya-02 Tishasoumya-02 self-assigned this Jul 18, 2024
@ichim-david ichim-david self-requested a review July 18, 2024 16:18
Copy link
Member

@ichim-david ichim-david left a comment

Choose a reason for hiding this comment

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

@sneridagh these changes fixes the display of external images and internal images from scales. Regarding the test writing it's your call.

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.

@Tishasoumya-02 could you write a quick test as @ichim-david suggested using an external image (see comment above, can be a GH CDN raw image). Then it will be complete.

@Tishasoumya-02
Copy link
Contributor Author

@ichim-david I have added a test for external image

@ichim-david
Copy link
Member

@Tishasoumya-02 I know it's not your fault but the pull request isn't green
https://github.com/plone/volto/actions/runs/10196668962/job/28207886197?pr=6147
Due to
https://github.com/twisted/towncrier/blob/trunk/src/towncrier/_builder.py#L117

try to rename package/volto/news/.gitkeep to .keep as they recognize that as something to ignore.

@Tishasoumya-02
Copy link
Contributor Author

All tests are passing now :)

- Correcting the orchid typo from all tests as well
@wesleybl
Copy link
Member

wesleybl commented Aug 1, 2024

@Tishasoumya-02 @ichim-david the towncrier issue will affect all PRs. Will this PR be merged soon? If not, it would be good to create a PR just with this fix. Thanks!

@ichim-david ichim-david merged commit 932962e into main Aug 1, 2024
70 checks passed
@ichim-david ichim-david deleted the teaser-image-overide branch August 1, 2024 14:47
@ichim-david
Copy link
Member

@wesleybl I've merged the pull request. take into consideration that the issue with .gitkeep will affect the other packages or apps as well, if you will edit any of them you will need to make the same change I've notified @Tishasoumya-02 to do in packages/volto.

@ichim-david
Copy link
Member

@Tishasoumya-02 thank you for your work, it took us some time to get here but open source work isn't easy and it takes a lot of work both for the creator and the reviewer to get something to the finish line.

@stevepiercy
Copy link
Collaborator

@Tishasoumya-02 @wesleybl @ichim-david new issue created for the towncrier issue at #6225.

@Tishasoumya-02
Copy link
Contributor Author

@Tishasoumya-02 thank you for your work, it took us some time to get here but open source work isn't easy and it takes a lot of work both for the creator and the reviewer to get something to the finish line.

Thank You !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants