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(image widget): media library gallery tools (#6087) #6236

Merged
merged 4 commits into from
Mar 25, 2022

Conversation

demshy
Copy link
Member

@demshy demshy commented Feb 23, 2022

Summary

When using a media library with multiple images option, the user had to replace all images in case they wanted to change the selection in any way (except reorder). The idea was, to give them the ability to remove only certain images, add extra to the selection or replace certain images.
The button wording also needed an update to match the use case.

Closes #6087

Test plan

Screenshot 2022-02-23 at 11 40 18

Usage video
https://user-images.githubusercontent.com/19568230/155301973-bf757da2-7d51-405c-b620-c45003c27057.mov)

I tested with both cloudinary and uploadcare.

config.yml used for testing (single image widget added to see that nothing changed there):

local_backend: true

backend:
  name: git-gateway
  branch: main
  squash_merges: true

display_url: #your-display-url
logo_url: /media/brand/logo.svg
media_folder: static/media/uploads
public_folder: /media/uploads

media_library:
  name: cloudinary
  config:
    cloud_name: #cloudinary-name
    api_key: #cloudinary-key

slug:
  encoding: ascii
  clean_accents: true

collections:
  - name: posts
    label: Posts
    label_singular: post
    folder: content/posts
    create: true
    slug: "{{slug}}"
    editor:
      preview: false
    fields: [
      {name: title, widget: string},
      {name: gallery, widget: image, i18n: duplicate, hint: Select at leat 3 images, required: false, media_library: {config: {multiple: true}}},
      {name: single, widget: image, i18n: duplicate, hint: Only one image, required: false, media_library: {config: {}}}
    ]

Checklist

Please add a x inside each checkbox:

  • I have read the contribution guidelines.
  • Code is formatted via running yarn format.
  • Tests are passing via running yarn test.
  • The status checks are successful (continuous integration). Those can be seen below.

A picture of a cute animal (not mandatory but encouraged)
IMG_20220204_114521

@demshy demshy changed the title feat: media library gallery tools (#6087) feat(image widget): media library gallery tools (#6087) Feb 23, 2022
@erezrokah erezrokah added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Feb 23, 2022
@demshy demshy marked this pull request as ready for review February 23, 2022 12:24
@demshy demshy requested a review from a team February 23, 2022 12:24
@erezrokah erezrokah self-assigned this Mar 2, 2022
@erezrokah erezrokah self-requested a review March 2, 2022 17:51
@erezrokah erezrokah force-pushed the 6087-media-library-gallery-tools branch from 998fef7 to 8e3e16c Compare March 14, 2022 12:27
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

Hi @demshy and sorry for the very late review, this is PERFECT 🚀

Only thing, that it would be good to add tests for this behavior, however since we don't have existing tests for it 😅 I don't think it's a blocker.

I'll wait for the GitHub actions maintenance to be over to make sure CI passes, so probably this will get released on Monday.

@erezrokah erezrokah merged commit 80c577a into decaporg:master Mar 25, 2022
@demshy
Copy link
Member Author

demshy commented Mar 25, 2022

This is great new @erezrokah, thanks.
I will try to add tests the next time we get some new ideas for the widget and contact you guys on slack if I find myself struggling :)
Looking forward to future contributions.

@erezrokah
Copy link
Contributor

erezrokah commented Mar 28, 2022

This is shipped in netlify-cms@2.10.190 and netlify-cms-app@2.15.70.

Thank you for the contribution @demshy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image widget: suggestions for allow_multiple == true (Cloudinary)
2 participants