Class: FoxTail::Pagination::ActionComponent

Inherits:
ClickableComponent
  • Object
show all
Defined in:
app/components/fox_tail/pagination/action_component.rb

Instance Method Summary collapse

Instance Method Details

#before_renderObject



41
42
43
44
45
# File 'app/components/fox_tail/pagination/action_component.rb', line 41

def before_render
  super

  with_icon icon if !visual? && icon?
end

#callObject



47
48
49
50
51
52
53
# File 'app/components/fox_tail/pagination/action_component.rb', line 47

def call
  super do
    concat visual if visual? && left?
    concat (:span, content || i18n_content, class: theme.apply(:label, self))
    concat visual if visual? && right?
  end
end

#left?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/components/fox_tail/pagination/action_component.rb', line 33

def left?
  %i[first previous].include? action
end

#right?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/components/fox_tail/pagination/action_component.rb', line 37

def right?
  !left?
end