diff --git a/app/helpers/investments_helper.rb b/app/helpers/investments_helper.rb index 51d38d09a..f8fd84bf4 100644 --- a/app/helpers/investments_helper.rb +++ b/app/helpers/investments_helper.rb @@ -1,5 +1,9 @@ module InvestmentsHelper + def investment_image_full_url(investment, version) + URI(request.url) + investment.image.url(version) + end + def investment_image_file_name(investment) investment.image.url.split('/').last.split("?")[0] if investment.image.present? end diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index a13df2626..6867c04a4 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -1,6 +1,7 @@
+
<% if investment.image.exists? %> @@ -16,12 +17,16 @@
<% end %>
+
+ <% cache [locale_and_user_status(investment), 'index', investment, investment.author] do %>

<%= link_to investment.title, namespaced_budget_investment_path(investment) %>

+

<%= l investment.created_at.to_date %> + <% if investment.author.hidden? || investment.author.erased? %>  •  @@ -39,6 +44,7 @@ <% end %> <% end %> +  •  <%= investment.heading.name %>

@@ -52,6 +58,7 @@
<% unless investment.unfeasible? %> + <% if investment.should_show_votes? %>
@@ -88,6 +95,7 @@

<% end %> + <% end %>
diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index c8e1376c7..5166bed36 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -1,4 +1,5 @@
+
<%= back_link_to budget_investments_path(investment.budget, heading_id: investment.heading) %> @@ -18,12 +19,15 @@

<%= investment.title %>

<%= render '/shared/author_info', resource: investment %> +  •  <%= l investment.created_at.to_date %>  •  <%= investment.heading.name %>
+
+ <% if investment.image.exists? %>
@@ -39,19 +43,23 @@
<% end %> +

<%= t("budgets.investments.show.code_html", code: investment.id) %>

+ <% if investment.location.present? %>

<%= t("budgets.investments.show.location_html", location: investment.location) %>

<% end %> + <% if investment.organization_name.present? %>

<%= t("budgets.investments.show.organization_name_html", name: investment.organization_name) %>

<% end %> + <%= render 'shared/tags', taggable: investment %> <%= safe_html_with_links investment.description.html_safe %> @@ -61,10 +69,12 @@ <%= text_with_links investment.external_url %>
<% end %> + <% if investment.unfeasible? && investment.unfeasibility_explanation.present? %>

<%= t('budgets.investments.show.unfeasibility_explanation') %>

<%= investment.unfeasibility_explanation %>

<% end %> + <% if investment.should_show_price_info? %>

<%= t('budgets.investments.show.price_explanation') %>

<%= investment.price_explanation %>

@@ -129,7 +139,7 @@ <%= render partial: 'shared/social_share', locals: { share_title: t("budgets.investments.show.share"), title: investment.title, - image_url: investment.image.exists? ? URI(request.url) + investment.image.url(:thumb) : '', + image_url: investment.image.exists? ? investment_image_full_url(investment, :thumb) : '', url: budget_investment_url(budget_id: investment.budget_id, id: investment.id) } %>