Sha256: f2191758884b5a58e46c48df8fdfb76dabb52ed386fcad387f5ec4c076fd3845

Contents?: true

Size: 1.66 KB

Versions: 17

Compression:

Stored size: 1.66 KB

Contents

require 'ui_bibz/ui/extensions/core/forms/surround_extension'
module UiBibz::Ui::Core::Forms::Numbers

  # Create a NumberField
  #
  # This element is an extend of UiBibz::Ui::Core::Component.
  #
  # ==== Attributes
  #
  # * +content+ - Content of element
  # * +options+ - Options of element
  # * +html_options+ - Html Options of element
  #
  # ==== Options
  #
  # You can add HTML attributes using the +html_options+.
  # You can pass arguments in options attribute:
  # * +prepend+ - String, Html
  # * +append+ - String, Html
  #
  # ==== 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
  #
  class NumberField < UiBibz::Ui::Core::Forms::Texts::TextField

    # See UiBibz::Ui::Core::Component.initialize
    def initialize content = nil, options = nil, html_options = nil, &block
      super
    end

    # Render html tag
    def pre_render
      surround_field number_field_input_tag
    end

    private

    # Simple_form or not
    def number_field_input_tag
      number_field_tag content, options[:value] || html_options[:value], html_options
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ui_bibz-2.1.6 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.1.5 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.1.4 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.1.3 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.1.2 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.1.1 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.10 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.9 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.1.0 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.8 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.7 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.5 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.4 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.3 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.2 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.1 lib/ui_bibz/ui/core/forms/numbers/number_field.rb
ui_bibz-2.0.0 lib/ui_bibz/ui/core/forms/numbers/number_field.rb