module SurroundExtension

Private Instance Methods

input_group_classes() click to toggle source
# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 34
def input_group_classes
  [input_group_status, input_group_size]
end
input_group_refresh() click to toggle source
# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 30
def input_group_refresh
  'field-refresh' unless options[:refresh].nil?
end
input_group_size() click to toggle source

:lg, :sm or :xs

# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 39
def input_group_size
  "input-group-#{options[:size]}" unless options[:size].nil?
end
input_group_status() click to toggle source
# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 43
def input_group_status
  "has-#{options[:status]}" unless options[:status].nil?
end
surround_classes() click to toggle source
# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 26
def surround_classes
  [input_group_refresh, input_group_classes]
end
surround_field(field_tag, _options = {}) click to toggle source
# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 22
def surround_field(field_tag, _options = {})
  surrounded? ? surround_wrapper_tag(field_tag) : field_tag
end
surround_wrapper_tag(ct_tag) click to toggle source
# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 13
def surround_wrapper_tag(ct_tag)
  UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(class: surround_classes).tap do |sf|
    sf.addon options[:append] unless options[:append].nil?
    sf.html ct_tag
    sf.button_refresh connect_opts      unless options[:refresh].nil?
    sf.addon options[:prepend]          unless options[:prepend].nil?
  end.render
end
surrounded?() click to toggle source
# File lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb, line 9
def surrounded?
  options[:append].present? || options[:prepend].present? || options[:refresh].present? || options[:surrounded].present?
end