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>
24 lines
570 B
Ruby
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
|