Files
grecia/app/components/dashboard/resources_component.rb
taitus 1e06e676a4 Move dashboard system tests to resources component specs
We're making the `new_actions_since_last_login` parameter optional in
order to simplify the tests.
2025-08-27 17:40:45 +02:00

22 lines
660 B
Ruby

class Dashboard::ResourcesComponent < ApplicationComponent
attr_reader :proposal, :new_actions_since_last_login
def initialize(proposal, new_actions_since_last_login = [])
@proposal = proposal
@new_actions_since_last_login = new_actions_since_last_login
end
private
def default_resources
%w[polls mailing poster]
end
def active_resources
@active_resources ||= Dashboard::Action.active
.resources
.by_proposal(proposal)
.order(required_supports: :asc, day_offset: :asc)
end
end