Skip to content

Commit dde947e

Browse files
authored
Merge pull request #3844 from AlchemyCMS/fix-thumbnail-size-in-overlay
Fix thumbnail size in picture overlay
2 parents e8ffeb5 + 7da978a commit dde947e

5 files changed

Lines changed: 16 additions & 7 deletions

File tree

app/assets/builds/alchemy/admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/stylesheets/alchemy/admin/archive.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ alchemy-uploader {
7575
}
7676

7777
img {
78-
max-width: 100%;
79-
max-height: 100%;
78+
max-width: var(--picture-width);
79+
max-height: var(--picture-height);
8080

8181
&:not([src*="alchemy/missing-image"]) {
8282
background: var(--thumbnail-background);

app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
search_filter_params.merge(
2323
size: "small",
2424
form_field_id: @form_field_id
25-
)
25+
).to_h
2626
),
2727
class: "icon_button"
2828
) %>
@@ -34,7 +34,7 @@
3434
search_filter_params.merge(
3535
size: "medium",
3636
form_field_id: @form_field_id
37-
)
37+
).to_h
3838
),
3939
class: "icon_button"
4040
) %>
@@ -46,7 +46,7 @@
4646
search_filter_params.merge(
4747
size: "large",
4848
form_field_id: @form_field_id
49-
)
49+
).to_h
5050
),
5151
class: "icon_button"
5252
) %>

app/views/alchemy/admin/pictures/_picture_to_assign.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
onclick: '$(self).attr("href", "#").off("click"); return false',
1111
method: 'put',
1212
) do %>
13-
<%= render Alchemy::Admin::PictureThumbnail.new(picture_to_assign) %>
13+
<%= render Alchemy::Admin::PictureThumbnail.new(picture_to_assign, size: size) %>
1414
<% end %>
1515
</sl-tooltip>
1616
<% else %>

spec/features/admin/picture_assignment_overlay_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
visit alchemy.admin_pictures_path(form_field_id: "ingredients_#{ingredient.id}_picture_id")
1717
expect(page).to have_css %(a[data-method="put"][href*="/admin/pictures/#{picture.id}/assign"])
1818
end
19+
20+
scenario "thumbnail renders at the selected size" do
21+
expect(Alchemy::Admin::PictureThumbnail).to receive(:new)
22+
.with(picture, size: "large").and_call_original
23+
visit alchemy.admin_pictures_path(
24+
form_field_id: "ingredients_#{ingredient.id}_picture_id",
25+
size: "large"
26+
)
27+
end
1928
end
2029

2130
describe "filtering the picture list" do

0 commit comments

Comments
 (0)