-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use contents settings for size in EssencePicture#picture_url
Without we would need to pass the settings into the method as options although the essence always knows its content and therefore can read the size value from it.
- Loading branch information
Showing
5 changed files
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
lib/alchemy/test_support/factories/essence_picture_factory.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'factory_bot' | ||
require 'alchemy/test_support/factories/content_factory' | ||
require 'alchemy/test_support/factories/picture_factory' | ||
|
||
FactoryBot.define do | ||
factory :alchemy_essence_picture, class: 'Alchemy::EssencePicture' do | ||
picture factory: :alchemy_picture | ||
|
||
trait :with_content do | ||
association :content, factory: :alchemy_content | ||
end | ||
end | ||
end |
2 changes: 1 addition & 1 deletion
2
spec/dummy/app/views/alchemy/elements/_gallery_picture.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<%- cache(gallery_picture) do -%> | ||
<%= element_view_for(gallery_picture) do |el| -%> | ||
<%= el.render :picture, size: '160x120' %> | ||
<%= el.render :picture %> | ||
<%- end -%> | ||
<%- end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters