Files
nairobi/app/views/budgets/investments/_investment.html.erb
Javi Martín 911fe4e481 Simplify calls to render partial
We're also adding a bit of consistency, since most of our calls to
partial rendering omit the `partial` and `locals` keys.
2019-09-04 15:00:36 +02:00

108 lines
4.5 KiB
Plaintext

<div id="<%= dom_id(investment) %>" class="budget-investment clear">
<div class="panel <%= ("with-image" if feature?(:allow_images) && investment.image.present?) %>">
<% if feature?(:allow_images) && investment.image.present? %>
<div class="row" data-equalizer>
<div class="small-12 medium-3 large-2 column text-center">
<div data-equalizer-watch>
<%= image_tag investment.image_url(:thumb),
alt: investment.image.title.unicode_normalize %>
</div>
</div>
<div class="small-12 medium-6 large-7 column">
<% else %>
<div class="row">
<div class="small-12 medium-9 column">
<% end %>
<div class="budget-investment-content">
<% cache [locale_and_user_status(investment), "index", investment, investment.author] do %>
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
<p class="investment-project-info">
<%= l investment.created_at.to_date %>
<% if investment.author.hidden? || investment.author.erased? %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="author">
<%= t("budgets.investments.show.author_deleted") %>
</span>
<% else %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="author">
<%= investment.author.name %>
</span>
<% if investment.author.official? %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="label round level-<%= investment.author.official_level %>">
<%= investment.author.official_position %>
</span>
<% end %>
<% end %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= investment.heading.name %>
</p>
<div class="investment-project-description">
<%= investment.description %>
<div class="truncate"></div>
</div>
<%= render "shared/tags", taggable: investment, limit: 5 %>
<% end %>
</div>
</div>
<% unless investment.unfeasible? %>
<% if investment.should_show_votes? %>
<div id="<%= dom_id(investment) %>_votes"
class="small-12 medium-3 column text-center"
<%= "data-equalizer-watch" if feature?(:allow_images) && investment.image.present? %>>
<%= render "/budgets/investments/votes",
investment: investment,
investment_votes: investment_votes,
vote_url: namespaced_budget_investment_vote_path(investment, value: "yes")
%>
</div>
<% elsif investment.should_show_vote_count? %>
<div id="<%= dom_id(investment) %>_votes"
class="small-12 medium-3 column text-center"
<%= "data-equalizer-watch" if feature?(:allow_images) && investment.image.present? %>>
<div class="supports js-participation">
<span class="total-supports no-button">
<%= t("budgets.investments.investment.supports",
count: investment.total_votes) %>
</span>
</div>
</div>
<% elsif investment.should_show_ballots? && !management_controller? %>
<div id="<%= dom_id(investment) %>_ballot"
class="small-12 medium-3 column text-center"
<%= "data-equalizer-watch" if feature?(:allow_images) && investment.image.present? %>>
<%= render "/budgets/investments/ballot",
investment: investment,
investment_ids: investment_ids,
ballot: ballot
%>
</div>
<% elsif investment.should_show_price? %>
<div id="<%= dom_id(investment) %>_price"
class="supports small-12 medium-3 column text-center"
<%= "data-equalizer-watch" if feature?(:allow_images) && investment.image.present? %>>
<div class="supports">
<span class="total-supports no-button">
<%= investment.formatted_price %>
</span>
</div>
</div>
<% else %>
<div <%= "data-equalizer-watch" if feature?(:allow_images) && investment.image.present? %>></div>
<% end %>
<% end %>
</div>
</div>
</div>