Files
grecia/app/components/admin/poll/officers/officers_component.rb
Javi Martín 7cb0a4135b Extract component for admin officers table
This way we can remove duplication and simplify the code in the view.

Note we're not using the "within" method in the tests to access a row,
because it doesn't seem to work in components tests when passing the
`text:` option.
2020-10-21 13:19:52 +02:00

19 lines
369 B
Ruby

class Admin::Poll::Officers::OfficersComponent < ApplicationComponent
attr_reader :officers, :options
def initialize(officers, **options)
@officers = officers
@options = options
end
private
def add_user_path(officer)
{
controller: "admin/poll/officers",
action: :create,
user_id: officer.user_id
}
end
end