Class: UI::ResizableHandle

Inherits:
Phlex::HTML
  • Object
show all
Includes:
ResizableHandleBehavior
Defined in:
app/components/ui/resizable_handle.rb

Overview

ResizableHandle component (Phlex) Draggable handle between resizable panels

Examples:

Basic handle

render UI::Handle.new

Handle with visible grip icon

render UI::Handle.new(with_handle: true)

Instance Method Summary collapse

Methods included from ResizableHandleBehavior

#grip_container_classes, #handle_actions, #handle_base_classes, #handle_data_attributes, #handle_html_attributes, #merged_handle_data_attributes

Constructor Details

#initialize(with_handle: false, classes: "", attributes: {}) ⇒ ResizableHandle

Returns a new instance of ResizableHandle.

Parameters:

  • with_handle (Boolean) (defaults to: false) —

    show visible grip icon

  • classes (String) (defaults to: "") —

    additional CSS classes

  • attributes (Hash) (defaults to: {}) —

    additional HTML attributes



17
18
19
20
21
22
# File 'app/components/ui/resizable_handle.rb', line 17

def initialize(with_handle: false, classes: "", attributes: {}, **)
  @with_handle = with_handle
  @classes = classes
  @attributes = attributes
  super()
end

Instance Method Details

#view_template ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'app/components/ui/resizable_handle.rb', line 24

def view_template
  div(**handle_html_attributes) do
    if @with_handle
      div(class: grip_container_classes) do
        render_grip_icon
      end
    end
  end
end