This way it will be easier to change the behavior of all table actions, like adding ARIA attributes. In the past, when we changed the behavior of the `link_to` method, we had to change all table action classes.
21 lines
455 B
Ruby
21 lines
455 B
Ruby
class Admin::Budgets::TableActionsComponent < ApplicationComponent
|
|
attr_reader :budget
|
|
|
|
def initialize(budget)
|
|
@budget = budget
|
|
end
|
|
|
|
private
|
|
|
|
def create_budget_poll_path
|
|
balloting_phase = budget.phases.find_by(kind: "balloting")
|
|
|
|
admin_polls_path(poll: {
|
|
name: budget.name,
|
|
budget_id: budget.id,
|
|
starts_at: balloting_phase.starts_at,
|
|
ends_at: balloting_phase.ends_at
|
|
})
|
|
end
|
|
end
|