Skip to content

Commit

Permalink
Switch to asset URLs instead of paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ahukkanen committed Mar 7, 2024
1 parent 116e348 commit 5cfe0e3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/cells/decidim/plans/plan_m_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def category_icon
return unless cat

content_tag(:span, class: "card__category__icon", "aria-hidden": true) do
image_tag(cat.attached_uploader(:category_icon).path, alt: full_category)
image_tag(cat.attached_uploader(:category_icon).url, alt: full_category)
end
end

Expand Down Expand Up @@ -186,7 +186,7 @@ def default_plan_image
end

def resource_image_path
return plan_image.attached_uploader(:file).path(variant: resource_image_variant) if has_image?
return plan_image.attached_uploader(:file).variant_url(resource_image_variant) if has_image?

if has_category?
path = category_image_path(category)
Expand All @@ -208,7 +208,7 @@ def category_image_path(cat)
return unless cat.category_image
return unless cat.category_image.attached?

cat.attached_uploader(:category_image).path(variant: category_image_variant)
cat.attached_uploader(:category_image).variant_url(category_image_variant)
end

def category_image_variant
Expand Down
2 changes: 1 addition & 1 deletion app/cells/decidim/plans/plan_view_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def organization_share_image_url
scope_name: :homepage,
manifest_name: :hero
).try(:images_container)
container.attached_uploader(:background_image).path if container && container.background_image && container.background_image.attached?
container.attached_uploader(:background_image).url if container && container.background_image && container.background_image.attached?
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/decidim/plans/attachments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def upload_field(form, attribute)
template += form.label(attribute, label_content)
template += form.file_field attribute, label: false

file_path = form.object.attached_uploader(attribute).path
file_path = form.object.attached_uploader(attribute).url
if form.send(:file_is_image?, file)
template += if file.present?
content_tag :label, I18n.t("current_image", scope: "decidim.forms")
Expand Down
2 changes: 1 addition & 1 deletion app/models/decidim/plans/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def upload_type
def main_url
return unless photo?

attached_uploader(:file).path(variant: :main)
attached_uploader(:file).variant_url(:main)
end

private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% add_decidim_page_title(translated_attribute(current_component.name)) if try(:current_component) %>
<% add_decidim_page_title(translated_attribute(current_participatory_space.title)) %>
<% add_decidim_meta_tags(
image_url: current_participatory_space.attached_uploader(:banner_image).path,
image_url: current_participatory_space.attached_uploader(:banner_image).url,
description: translated_attribute(current_participatory_space.short_description),
) %>
Expand All @@ -20,4 +20,4 @@
<% end %>
<% end %>
<% provide :meta_image_url, current_participatory_space.attached_uploader(:banner_image).path %>
<% provide :meta_image_url, current_participatory_space.attached_uploader(:banner_image).url %>

0 comments on commit 5cfe0e3

Please sign in to comment.