AyuntamientoMadrid/participacion

View on GitHub
app/views/budgets/investments/_investment_detail.html.erb

Summary

Maintainability
Test Coverage
<h1><%= investment.title %></h1>
<div class="budget-investment-info">
  <%= render "/shared/author_info", resource: investment %>

  <span class="bullet">&nbsp;&bull;&nbsp;</span>
  <%= l investment.created_at.to_date %>
  <span class="bullet">&nbsp;&bull;&nbsp;</span>
  <%= render Shared::CommentsCountComponent.new(investment.comments_count, url: "#comments") %>
  <span class="bullet">&nbsp;&bull;&nbsp;</span>
  <%= investment.heading.name %>
  <span class="bullet">&nbsp;&bull;&nbsp;</span>
  <% if local_assigns[:preview].nil? %>
    <span class="js-flag-actions">
      <%= render "shared/flag_actions", flaggable: investment %>
    </span>
  <% end %>
</div>

<br>

<%= render_image(investment.image, :large, true) if investment.image.present? %>

<p id="investment_code">
  <%= sanitize(t("budgets.investments.show.code", code: investment.id)) %>
</p>

<%= auto_link_already_sanitized_html wysiwyg(investment.description) %>

<% if feature?(:map) && map_location_available?(@investment.map_location) %>
  <div class="margin">
    <%= render_map(investment.map_location) %>
  </div>
<% end %>

<% if investment.location.present? %>
  <p>
    <%= sanitize(t("budgets.investments.show.location", location: investment.location)) %>
  </p>
<% end %>

<% if investment.organization_name.present? %>
  <p>
    <%= sanitize(t("budgets.investments.show.organization_name", name: investment.organization_name)) %>
  </p>
<% end %>

<% if feature?(:allow_attached_documents) %>
  <%= render Documents::DocumentsComponent.new(investment.documents) %>
<% end %>

<%= render "shared/tags", taggable: investment %>

<% if investment.external_url.present? %>
  <div class="investment-external-link">
    <%= sanitize_and_auto_link investment.external_url %>
  </div>
<% end %>

<% if investment.should_show_unfeasibility_explanation? %>
  <h2><%= t("budgets.investments.show.unfeasibility_explanation") %></h2>
  <p><%= investment.unfeasibility_explanation %></p>
<% end %>

<% if investment.should_show_price_explanation? %>
  <h2 id="price_explanation" data-magellan-target="price_explanation">
    <%= t("budgets.investments.show.price_explanation") %>
  </h2>
  <p><%= investment.price_explanation %></p>
<% end %>

<% if local_assigns[:preview].nil? %>
  <%= render "relationable/related_content", relationable: investment %>

  <div class="js-moderator-investment-actions margin">
    <%= render "budgets/investments/actions", investment: investment %>
  </div>
<% end %>