class UiBibz::Ui::Core::Forms::Numbers::NumberField

Create a NumberField

This element is an extend of UiBibz::Ui::Core::Component.

Attributes

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

Signatures

UiBibz::Ui::Core::Forms::Numbers::NumberField.new(content, options = {}, html_options = {}).render

UiBibz::Ui::Core::Forms::Numbers::NumberField.new(options = {}, html_options = {}) do
  content
end.render

Examples

UiBibz::Ui::Core::Forms::Numbers::NumberField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')

UiBibz::Ui::Core::Forms::Numbers::NumberField.new(prepend: glyph('pencil'), append: glyph('camera-retro')) do
  #content
end

Helper

ui_number_field(options = {}, html_options = {}) do
 # content
end

Public Instance Methods

pre_render() click to toggle source

Render html tag

# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 53
def pre_render
  surround_field number_field_input_tag
end

Private Instance Methods

component_html_options() click to toggle source
# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 64
def component_html_options
  {
    min: options[:min],
    max: options[:max],
    step: options[:step],
    in: options[:in],
    within: options[:within]
  }
end
html_in() click to toggle source
# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 86
def html_in
  options[:in]
end
html_max() click to toggle source
# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 74
def html_max
  options[:max] || 100
end
html_min() click to toggle source
# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 78
def html_min
  options[:min] || 0
end
html_step() click to toggle source
# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 82
def html_step
  options[:step] || 1
end
html_within() click to toggle source
# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 90
def html_within
  options[:within]
end
number_field_input_tag() click to toggle source

Simple_form or not

# File lib/ui_bibz/ui/core/forms/numbers/number_field.rb, line 60
def number_field_input_tag
  number_field_tag content, options[:value] || html_options[:value], html_options
end