Class: InnerPlan::Tasks::RowsComponent

Inherits:
Phlex::HTML
  • Object
show all
Includes:
Phlex::Rails::Helpers::DOMID
Defined in:
app/components/inner_plan/tasks/rows_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(tasks, list:, context: nil, id_key: :ongoing_tasks) ⇒ RowsComponent

Returns a new instance of RowsComponent.



5
6
7
8
9
10
# File 'app/components/inner_plan/tasks/rows_component.rb', line 5

def initialize(tasks, list:, context: nil, id_key: :ongoing_tasks)
  @tasks = tasks
  @list = list
  @context = context
  @id_key = id_key
end

Instance Method Details

#template(&content) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'app/components/inner_plan/tasks/rows_component.rb', line 12

def template(&content)
  div(id: dom_id(@list, @id_key), data: { controller: :tasks, tasks_list_id_value: @list.id }) {
    @tasks.each do |task|
      render(InnerPlan::Tasks::RowComponent.new(task, context: @context))
    end

    render(content) if content
  }
end