Files
nairobi/app/views/proposals/_info.html.erb
Javi Martín b9518d64e1 Use Rails methods to get map location input IDs
We were manually generating the IDs in order to pass them as data
attributes in the HTML in a component where we don't have access to the
form which has the inputs.

However, these data attributes only make sense when there's a form
present, so we can pass the form as a parameter and use it to get the
IDs.

We can now define a map as editable when there's an associated form,
which makes sense IMHO.
2023-05-04 15:27:15 +02:00

76 lines
2.2 KiB
Plaintext

<div class="proposal-info">
<%= render "/shared/author_info", resource: @proposal %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l @proposal.created_at.to_date %>
<% unless @proposal.selected? %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= render Shared::CommentsCountComponent.new(@proposal.comments_count, url: "#comments") %>
<% end %>
<% if current_user %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="js-flag-actions">
<%= render "shared/flag_actions", flaggable: @proposal %>
</span>
<% end %>
</div>
<%= render_image(@proposal.image, :large, true) if @proposal.image.present? %>
<br>
<% unless @proposal.selected? %>
<p>
<%= t("proposals.show.code") %>
<strong><%= @proposal.code %></strong>
</p>
<% end %>
<blockquote><%= @proposal.summary %></blockquote>
<% if @proposal.video_url.present? %>
<div class="small-12 medium-7 small-centered">
<div class="flex-video">
<div id="js-embedded-video" data-video-code="<%= embedded_video_code(@proposal) %>"></div>
</div>
</div>
<% end %>
<%= auto_link_already_sanitized_html wysiwyg(@proposal.description) %>
<% if feature?(:map) && map_location_available?(@proposal.map_location) %>
<div class="margin">
<%= render_map(@proposal.map_location) %>
</div>
<% end %>
<% if @proposal.video_url.present? %>
<div class="video-link">
<p>
<span class="icon-video"></span>&nbsp;
<strong><%= t("proposals.show.title_video_url") %></strong>
</p>
<%= sanitize_and_auto_link @proposal.video_url %>
</div>
<% end %>
<% if @proposal.retired? %>
<div id="retired_explanation" class="callout">
<h2>
<%= t("proposals.show.retired") %>:
<%= t("proposals.retire_options.#{@proposal.retired_reason}") unless @proposal.retired_reason == "other" %>
</h2>
<%= simple_format sanitize_and_auto_link(@proposal.retired_explanation), {}, sanitize: false %>
</div>
<% end %>
<% if feature?(:allow_attached_documents) %>
<%= render "documents/documents",
documents: @proposal.documents,
max_documents_allowed: Proposal.max_documents_allowed %>
<% end %>
<%= render "shared/tags", taggable: @proposal %>