AyuntamientoMadrid/participacion

View on GitHub
app/components/budgets/investments/my_ballot_component.html.erb

Summary

Maintainability
Test Coverage
<div class="my-ballot">
  <h2 class="sidebar-title">
    <%= t("budgets.investments.index.sidebar.my_ballot") %>
  </h2>

  <% if investments.count > 0 %>
    <p>
      <em><%= sanitize(ballot.voted_info(heading)) %></em>
    </p>
  <% elsif assigned_heading.present? %>
    <p>
      <%= sanitize(t("budgets.investments.index.sidebar.different_heading_assigned",
                     heading_link: heading_link(assigned_heading, budget))) %>
      <br>
      <small>
        <%= sanitize(t("budgets.investments.index.sidebar.change_ballot",
                       check_ballot: link_to(t("budgets.investments.index.sidebar.check_ballot_link"),
                                             budget_ballot_path(budget)))) %>
      </small>
    </p>
  <% else %>
    <p><strong><%= t("budgets.investments.index.sidebar.zero") %></strong></p>
  <% end %>

  <p>
    <%= sanitize(ballot.change_vote_info(
        link: link_to(t("budgets.investments.index.sidebar.change_vote_link"),
                      budget_ballot_path(budget))
      )) %>
  </p>

  <ul class="ballot-list">
    <% if heading %>
      <%= render Budgets::Ballot::InvestmentForSidebarComponent.with_collection(
        investments,
        investment_ids: investment_ids
      ) %>
    <% end %>
  </ul>

  <%= link_to t("budgets.investments.header.check_ballot"),
              budget_ballot_path(budget),
              class: "button hollow expanded" %>
</div>