Move resource partial to a component
We're renaming it to ActiveResource in order to better differentiate it from the DefaultResource component.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
class Dashboard::ResourcesComponent < ApplicationComponent
|
||||
attr_reader :active_resources, :proposal
|
||||
attr_reader :proposal, :new_actions_since_last_login
|
||||
|
||||
def initialize(active_resources, proposal)
|
||||
@active_resources = active_resources
|
||||
def initialize(proposal, new_actions_since_last_login)
|
||||
@proposal = proposal
|
||||
@new_actions_since_last_login = new_actions_since_last_login
|
||||
end
|
||||
|
||||
private
|
||||
@@ -11,4 +11,11 @@ class Dashboard::ResourcesComponent < ApplicationComponent
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user