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 preferences to configure product and taxon images style #4062

Merged
merged 1 commit into from
Jun 10, 2021

Conversation

cpfergus1
Copy link
Contributor

@cpfergus1 cpfergus1 commented May 13, 2021

This commit adds Spree configuration options for styles, which will make
it easier to customize product and taxon image styles. Currently, the
user would have to create an override file or supersede the current
modules ActiveStorageAttachment for either class. This will make editing
styles clean and a single step process by allowing users to edit their
spree.rb configuration to modify these settings.

Description

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)

Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

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

@cpfergus1 thanks for this PR, I like the new configurations for image styles 🖼️
I added a comment for a small optimization, let me know what you think!

@cpfergus1 cpfergus1 force-pushed the image-size-config branch 3 times, most recently from b01c925 to 162d433 Compare May 17, 2021 12:02
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Looks good. Can we just remove formatting changes like indentations? I know the style is not consistent but I think a clean git history is more important here.

This commit adds Spree configuration options for styles which will make
it easier to customize product and taxon image styles. Currently, the
user would have to create and override file or supercede the current
modules ActiveStorageAttachment for either class. This will make editing
styles clean and a single step process by allowing users to edit their
spree.rb configuration to modify these settings.

Included allowed mime types configuration for taxons
url: '/spree/taxons/:id/:style/:basename.:extension',
path: ':rails_root/public/spree/taxons/:id/:style/:basename.:extension',
default_url: '/assets/default_taxon.png'

validates_attachment :icon,
content_type: { content_type: %w[image/jpg image/jpeg image/png image/gif] }
content_type: { content_type: Spree::Config.allowed_image_mime_types }

Choose a reason for hiding this comment

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

Layout/AlignArguments: Align the arguments of a method call if they span more than one line.

@@ -5,14 +5,14 @@ module Spree::Taxon::PaperclipAttachment

included do
has_attached_file :icon,
styles: { mini: '32x32>', normal: '128x128>' },
default_style: :mini,
styles: Spree::Config.taxon_image_styles,

Choose a reason for hiding this comment

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

Layout/AlignArguments: Align the arguments of a method call if they span more than one line.

@cpfergus1
Copy link
Contributor Author

cpfergus1 commented May 19, 2021

Looks good. Can we just remove formatting changes like indentations? I know the style is not consistent but I think a clean git history is more important here.

Done!

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks, Connor!

@kennyadsl kennyadsl added the changelog:solidus_core Changes to the solidus_core gem label Jun 1, 2021
@kennyadsl kennyadsl changed the title Updated core to include product and taxon image style configuration Add preferences to configure product and taxon images style Jun 1, 2021
@kennyadsl kennyadsl merged commit cc56661 into solidusio:master Jun 10, 2021
forkata added a commit to forkata/edgeguides that referenced this pull request Feb 16, 2023
This change to the docs applies to all versions of Solidus since version 3.1 when the preferences for customizing image
sizes were added solidusio/solidus#4062.
forkata added a commit to forkata/edgeguides that referenced this pull request Feb 16, 2023
This change to the docs applies to all versions of Solidus since version 3.1 when the preferences for customizing image
sizes were added solidusio/solidus#4062.

Co-authored-by: Cameron Day <[email protected]>
forkata added a commit to forkata/edgeguides that referenced this pull request Feb 16, 2023
This change to the docs applies to all versions of Solidus since version 3.1 when the preferences for customizing image
sizes were added solidusio/solidus#4062.

Co-authored-by: Cameron Day <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants