Class: InnerPlan::Tasks::RowComponent

Inherits:
Phlex::HTML
  • Object
show all
Includes:
Phlex::Rails::Helpers::CheckBox, Phlex::Rails::Helpers::ClassNames, Phlex::Rails::Helpers::LinkTo
Defined in:
app/components/inner_plan/tasks/row_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(task, context: nil) ⇒ RowComponent

Returns a new instance of RowComponent.



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

def initialize(task, context: nil)
  @task = task
  @context = context
end

Instance Method Details

#templateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/components/inner_plan/tasks/row_component.rb', line 12

def template
  div(class: "d-flex w-100 align-items-start", data: { id: task.id, update_url: helpers.update_position_task_path(task) }) {
    render(InnerPlan::Tasks::Row::HandleComponent.new(task))

    div(class: 'align-top', style: 'width:2rem; height: 2rem; line-height: 1.6rem;') {
      render(InnerPlan::Tasks::CompletedTogglerComponent.new(task, context: context))
    }

    div(class: class_names('form-check-label ms-1 w-100', 'text-body-tertiary' => task.completed?), style: 'line-height: 1.6rem; padding-top: 1px;') {
      link_to(title, task, class: 'text-reset text-decoration-none me-1')
      render(InnerPlan::Tasks::Row::AddonsComponent.new(task))
    }
  }
end