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 an ability to display original images #139

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

shouichi
Copy link
Contributor

The current implementation always displays a variant if an image is variable regardless of setting show_preview_variant to nil.

Field::ActiveStorage.with_options(show_preview_variant: nil)

This change allows us to show the original image by passing false.

Field::ActiveStorage.with_options(show_preview_variant: false)

Though the behavioral difference between nil and false is subtle, it somewhat aligns with the Action View's layout method.

https://api.rubyonrails.org/classes/ActionView/Layouts/ClassMethods.html#method-i-layout

  • false: There is no layout
  • nil: Force default layout behavior with inheritance

@Dreamersoul
Copy link
Owner

Appreciate the change can you update the read me file and add yourself to the contributors?

The current implementation always displays a variant if an image is
variable regardless of setting `show_preview_variant` to `nil`.

```
Field::ActiveStorage.with_options(show_preview_variant: nil)
```

This change allows us to show the original image by passing `false`.

```
Field::ActiveStorage.with_options(show_preview_variant: false)
```

Though the behavioral difference between `nil` and `false` is subtle, it
somewhat aligns with the Action View's `layout` method.

> https://api.rubyonrails.org/classes/ActionView/Layouts/ClassMethods.html#method-i-layout
> - false: There is no layout
> - nil: Force default layout behavior with inheritance
@shouichi
Copy link
Contributor Author

Thank you. Updated the README. Could you take a look?

@Dreamersoul
Copy link
Owner

LGTM I'll merge and publish tomorrow 👍🏻

@shouichi
Copy link
Contributor Author

Thank you! No rush :)

@Dreamersoul Dreamersoul merged commit b72b6f7 into Dreamersoul:master Dec 29, 2023
1 check passed
@shouichi shouichi deleted the original-images branch December 29, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants