From 5cfe0e363bd1c217f5bcadaea84fa916c3983f37 Mon Sep 17 00:00:00 2001 From: Antti Hukkanen Date: Thu, 7 Mar 2024 03:28:18 +0200 Subject: [PATCH] Switch to asset URLs instead of paths --- app/cells/decidim/plans/plan_m_cell.rb | 6 +++--- app/cells/decidim/plans/plan_view_cell.rb | 2 +- app/helpers/decidim/plans/attachments_helper.rb | 2 +- app/models/decidim/plans/attachment.rb | 2 +- .../decidim/plans/participatory_space_plain.html.erb | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/cells/decidim/plans/plan_m_cell.rb b/app/cells/decidim/plans/plan_m_cell.rb index 42d15124..1715a501 100644 --- a/app/cells/decidim/plans/plan_m_cell.rb +++ b/app/cells/decidim/plans/plan_m_cell.rb @@ -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 @@ -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) @@ -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 diff --git a/app/cells/decidim/plans/plan_view_cell.rb b/app/cells/decidim/plans/plan_view_cell.rb index dc3c378d..74e6c811 100644 --- a/app/cells/decidim/plans/plan_view_cell.rb +++ b/app/cells/decidim/plans/plan_view_cell.rb @@ -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 diff --git a/app/helpers/decidim/plans/attachments_helper.rb b/app/helpers/decidim/plans/attachments_helper.rb index d21c224b..bd481c50 100644 --- a/app/helpers/decidim/plans/attachments_helper.rb +++ b/app/helpers/decidim/plans/attachments_helper.rb @@ -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") diff --git a/app/models/decidim/plans/attachment.rb b/app/models/decidim/plans/attachment.rb index 43ac8a59..a33cff4c 100644 --- a/app/models/decidim/plans/attachment.rb +++ b/app/models/decidim/plans/attachment.rb @@ -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 diff --git a/app/views/layouts/decidim/plans/participatory_space_plain.html.erb b/app/views/layouts/decidim/plans/participatory_space_plain.html.erb index eb0a0747..fe860e4c 100644 --- a/app/views/layouts/decidim/plans/participatory_space_plain.html.erb +++ b/app/views/layouts/decidim/plans/participatory_space_plain.html.erb @@ -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), ) %> @@ -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 %>