This way we fix a bug we mentioned in commit 930bb753c which caused
links to documents to be broken when editing their title because the
title was used to generate the URL of the document.
Note we're still using Paperclip to render cached attachments because
this is the only case where we store files with just Paperclip and not
Active Storage.
With Active Storage, we render attachments just like any other resource,
using `polymorphic_path`. Paperclip included the `url` method in the
model; since the model doesn't have access to the request parameters
(like the host), this was inconvenient because it wasn't possible to
generate absolute URLs with Paperclip.
In order to simplify the code and make it similar to the way we used
Paperclip, we're adding a `variant` method accepting the name of a
variant and returning the variant.
107 lines
4.0 KiB
Plaintext
107 lines
4.0 KiB
Plaintext
<% preview = false unless local_assigns.has_key? :preview %>
|
|
<% provide :title do %><%= @proposal.title %><% end %>
|
|
<% content_for :meta_description do %><%= @proposal.summary %><% end %>
|
|
<% provide :social_media_meta_tags do %>
|
|
<%= render "shared/social_media_meta_tags",
|
|
social_url: proposal_url(@proposal),
|
|
social_title: @proposal.title,
|
|
social_description: @proposal.summary,
|
|
twitter_image_url: (@proposal.image.present? ? polymorphic_path(@proposal.image.variant(:thumb)) : nil),
|
|
og_image_url: (@proposal.image.present? ? polymorphic_path(@proposal.image.variant(:thumb)) : nil) %>
|
|
<% end %>
|
|
<% content_for :canonical do %>
|
|
<%= render "shared/canonical", href: proposal_url(@proposal) %>
|
|
<% end %>
|
|
|
|
<% cache [locale_and_user_status(@proposal),
|
|
@proposal,
|
|
@proposal.author,
|
|
Flag.flagged?(current_user, @proposal),
|
|
@proposal.followed_by?(current_user),
|
|
current_user&.voted_for?(@proposal)] do %>
|
|
<div class="proposal-show">
|
|
<div id="<%= dom_id(@proposal) %>" class="row">
|
|
<div class="small-12 medium-9 column">
|
|
<%= back_link_to proposals_path unless preview %>
|
|
|
|
<h1><%= @proposal.title %></h1>
|
|
<% if @proposal.retired? %>
|
|
<div data-alert class="callout alert margin-top proposal-retired">
|
|
<strong>
|
|
<%= t("proposals.show.retired_warning") %><br>
|
|
<%= link_to t("proposals.show.retired_warning_link_to_explanation"),
|
|
"#retired_explanation" %>
|
|
</strong>
|
|
</div>
|
|
<% elsif @proposal.conflictive? %>
|
|
<div data-alert class="callout alert margin-top">
|
|
<strong><%= t("proposals.show.flag") %></strong>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= render "proposals/info", proposal: @proposal %>
|
|
<%= render "shared/geozone", geozonable: @proposal %>
|
|
|
|
<% unless @proposal.selected? %>
|
|
<%= render "relationable/related_content", relationable: @proposal %>
|
|
<% end %>
|
|
|
|
<div class="js-moderator-proposal-actions margin">
|
|
<%= render "proposals/actions", proposal: @proposal %>
|
|
</div>
|
|
</div>
|
|
|
|
<% unless preview %>
|
|
<aside class="small-12 medium-3 column">
|
|
<% if can?(:dashboard, @proposal) %>
|
|
<div class="sidebar-divider"></div>
|
|
<h2><%= t("proposals.show.author") %></h2>
|
|
<div class="show-actions-menu">
|
|
<%= link_to progress_proposal_dashboard_path(@proposal),
|
|
class: "button hollow expanded",
|
|
id: "proposal-dashboard-#{@proposal.id}" do %>
|
|
<span class="icon-edit"></span>
|
|
<%= t("proposals.show.dashboard_proposal_link") %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= render "proposals/support_status", proposal: @proposal %>
|
|
|
|
<%= render "proposals/social_share", proposal: @proposal, share_title: t("proposals.show.share") %>
|
|
|
|
<% if current_user %>
|
|
<div class="sidebar-divider"></div>
|
|
<p class="sidebar-title"><%= t("shared.follow") %></p>
|
|
|
|
<%= render "follows/follow_button", follow: find_or_build_follow(current_user, @proposal) %>
|
|
<% end %>
|
|
|
|
<%= render "communities/access_button", community: @proposal.community %>
|
|
</aside>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% unless preview %>
|
|
<div class="additional-content">
|
|
<div class="filter-subnav">
|
|
<div class="row">
|
|
<div class="small-12 column">
|
|
<%= render "proposals/filter_subnav" %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="tabs-content" data-tabs-content="proposals_tabs">
|
|
<div class="tabs-panel is-active" id="tab-comments">
|
|
<%= render "proposals/comments" %>
|
|
</div>
|
|
|
|
<%= render "proposals/notifications" %>
|
|
<%= render "milestones/milestones", milestoneable: @proposal %>
|
|
</div>
|
|
<% end %>
|