<% reason = investment.reason_for_not_being_selectable_by(current_user) %>
<% voting_allowed = true unless reason.presence == :not_voting_allowed %>
<% user_voted_for = voted_for?(investment_votes, investment) %>

<div class="supports js-participation">

  <span class="total-supports <%= 'no-button' unless voting_allowed || user_voted_for %>">
    <%= t("budgets.investments.investment.supports", count: investment.total_votes) %>
  </span>

  <div class="in-favor js-in-favor">
    <% if user_voted_for %>
      <div class="supported callout success">
        <%= t("budgets.investments.investment.already_supported") %>
      </div>
    <% elsif investment.should_show_votes? %>
      <%= link_to vote_url,
          class: "button button-support small expanded",
          title: t('budgets.investments.investment.support_title'),
          method: "post",
          remote: (current_user && current_user.voted_in_group?(investment.group) ? true : false),
          data:   (current_user && current_user.voted_in_group?(investment.group) ? nil : { confirm: t('budgets.investments.investment.confirm_group')} ),
          "aria-hidden" => css_for_aria_hidden(reason) do %>
        <%= t("budgets.investments.investment.give_support") %>
      <% end %>
    <% end %>
  </div>

  <% if reason.present? && !user_voted_for %>
    <div class="js-participation-not-allowed participation-not-allowed" style='display:none' aria-hidden="false">
      <p>
          <%= t("votes.budget_investments.#{reason}",
                verify_account: link_to(t("votes.verify_account"), verification_path),
                signin: link_to(t("votes.signin"), new_user_session_path),
                signup: link_to(t("votes.signup"), new_user_registration_path)
           ).html_safe %>
      </p>
    </div>
  <% end %>

  <% if user_voted_for && setting['twitter_handle'] %>
    <div class="share-supported">
      <%= social_share_button_tag("#{investment.title} #{setting['twitter_hashtag']}", url: budget_investment_url(budget_id: investment.budget_id, id: investment.id), via: setting['twitter_handle']) %>
    </div>
  <% end %>
</div>
