Skip to content

Commit

Permalink
Merge pull request #2667 from tvdeyen/fix-missing-image-styles
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen authored Jan 3, 2024
2 parents c59ab3d + f1a524d commit 770b318
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/assets/images/alchemy/missing-image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions app/assets/stylesheets/alchemy/archive.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@
img {
max-width: 100%;
max-height: 100%;
background: $thumbnail-background;

&[src*=".svg"] {
&:not([src*="alchemy/missing-image"]) {
background: $thumbnail-background;
}

&[src$=".svg"]:not([src*="alchemy/missing-image"]) {
width: var(--picture-width);
max-height: var(--picture-height);
}
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/alchemy/buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ input.button {
height: $icon-button-small-height;
background: none;
border: none;
padding: 0; // button.small has padding
}

&.active,
Expand Down
5 changes: 2 additions & 3 deletions app/assets/stylesheets/alchemy/elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,8 @@ alchemy-publish-element-button {
height: 120px;

.icon {
font-size: 4em;
color: $medium-gray;
vertical-align: top;
font-size: 3em;
color: var(--color-grey_dark);

&.error {
font-size: 1.2em;
Expand Down
8 changes: 3 additions & 5 deletions app/views/alchemy/admin/pictures/_picture.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
</sl-tooltip>
</span>
<% end %>
<% image = image_tag(
picture.url(size: preview_size(@size), flatten: true) || "alchemy/missing-image.svg",
alt: picture.name
) %>
<% if can?(:edit, picture) %>
<% picture_url = picture.url(size: preview_size(@size), flatten: true) %>
<% image = image_tag(picture_url || "alchemy/missing-image.svg", alt: picture.name) %>
<% if can?(:edit, picture) && picture_url %>
<%= link_to(
image,
alchemy.admin_picture_path(
Expand Down
4 changes: 2 additions & 2 deletions app/views/alchemy/ingredients/shared/_picture_tools.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<% if linkable %>
<%= render "alchemy/ingredients/shared/link_tools", ingredient_editor: picture_editor %>
<% else %>
<span class="disabled"><%= render_icon("link", style: "m") %></span>
<span class="disabled"><%= render_icon("link-unlink", style: "m") %></span>
<span class="icon_button disabled"><%= render_icon("link", style: "m") %></span>
<span class="icon_button disabled"><%= render_icon("link-unlink", style: "m") %></span>
<% end %>

<%= content_tag "sl-tooltip", content: Alchemy.t(:edit_image_properties), placement: "top-end" do %>
Expand Down

0 comments on commit 770b318

Please sign in to comment.