Class: Ui::Pagination::Component::NextItem

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/uikit_rails/templates/components/pagination/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href: "#", disabled: false, **html_attrs) ⇒ NextItem

Returns a new instance of NextItem.



66
67
68
69
70
71
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 66

def initialize(href: "#", disabled: false, **html_attrs)
  @href = href
  @disabled = disabled
  @html_attrs = html_attrs
  super()
end

Instance Attribute Details

#disabledObject (readonly)

Returns the value of attribute disabled.



64
65
66
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 64

def disabled
  @disabled
end

#hrefObject (readonly)

Returns the value of attribute href.



64
65
66
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 64

def href
  @href
end

#html_attrsObject (readonly)

Returns the value of attribute html_attrs.



64
65
66
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 64

def html_attrs
  @html_attrs
end

Instance Method Details

#callObject



73
74
75
76
77
78
79
80
# File 'lib/uikit_rails/templates/components/pagination/component.rb', line 73

def call
  classes = class_names("ui-pagination__item ui-pagination__next", "ui-pagination__item--disabled": disabled)
  if disabled
    (:span, content.presence || "Next", class: classes, "aria-disabled": "true", **html_attrs)
  else
    (:a, content.presence || "Next", class: classes, href: href, **html_attrs)
  end
end