Files
grecia/app/views/budgets/investments/_investment.html.erb
2017-09-26 13:53:42 +02:00

98 lines
3.9 KiB
Plaintext

<div id="<%= dom_id(investment) %>" class="budget-investment clear">
<div class="panel">
<div class="row">
<!-- TODO: ROCK&ROR: Temporal markup. Place it as needed to reflect mockup -->
<div class="small-2 medium-2 large-2 column">
<% if investment.image.exists? %>
<%= image_tag investment.image.url(:thumb),
title: investment.image_description,
alt: investment.image_description, class: "th" %>
<% else %>
<!-- TODO: ROCK&ROR: Create colored placeholder or default image -->
<% end %>
</div>
<div class="small-10 medium-7 large-10 column">
<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">
<p><%= investment.description %></p>
<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">
<%= render partial: '/budgets/investments/votes', locals: {
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">
<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? %>
<div id="<%= dom_id(investment) %>_ballot"
class="small-12 medium-3 column text-center">
<%= render partial: '/budgets/investments/ballot', locals: {
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">
<p class="investment-project-amount margin-top">
<%= investment.formatted_price %>
</p>
</div>
<% end %>
<% end %>
</div>
</div>
</div>