Files
nairobi/app/components/budgets/ballot/investment_for_sidebar_component.rb
CoslaJohn c4d8c92ae2 Change the order in which votes are displayed to be in the order they were selected by the voter
Note that the `budget` parameter was added to the `delete_path` method
so it works in the tests; on production, it worked because this
component is only rendered on pages which already have the `budget`
parameter.

Co-authored-by: Javi Martín <javim@elretirao.net>
2024-04-04 18:47:03 +02:00

24 lines
570 B
Ruby

class Budgets::Ballot::InvestmentForSidebarComponent < Budgets::Ballot::InvestmentComponent
with_collection_parameter :investment
attr_reader :investment_ids
def initialize(investment:, investment_ids:)
super(investment: investment)
@investment_ids = investment_ids
end
private
def list_item_id
"#{super}_sidebar"
end
def investment_title
tag.span investment.title, class: "ballot-list-title"
end
def delete_path
budget_ballot_line_path(budget, id: investment.id, investments_ids: investment_ids)
end
end