Class: InnerPlan::Tasks::Row::HandleComponent

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

Instance Method Summary collapse

Constructor Details

#initialize(task) ⇒ HandleComponent

Returns a new instance of HandleComponent.



6
7
8
# File 'app/components/inner_plan/tasks/row/handle_component.rb', line 6

def initialize(task)
  @task = task
end

Instance Method Details

#templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/components/inner_plan/tasks/row/handle_component.rb', line 10

def template
  div(
    class: class_names('align-top me-2 text-body-tertiary task-handle cm', invisible: task.completed?),
    style: 'line-height: 1.6rem'
  ) {
    div(class: "dropstart") {
      a(class: "align-top text-body-tertiary task-handle cm", data_bs_toggle: "dropdown") {
        render(Phlex::Icons::Tabler::GripVertical.new(width: 20, height: 20))
      }

      ul(class: "dropdown-menu dropdown-menu-end") {
        li {
          link_to(
            helpers.edit_task_path(task),
            class: 'dropdown-item d-flex align-items-center gap-2',
            data: { turbo_frame: :_top }
          ) {
            render(Phlex::Icons::Tabler::Pencil.new(width: 18, height: 18, class: 'text-secondary'))
            span { "Edit task" }
          }
        }
      }
    }
  }
end