Sha256: 1c0f0e6a2ac9589774125eb1866344ef2a5f04ceb9eb2d1d8be5897ac8471e13

Contents?: true

Size: 740 Bytes

Versions: 6

Compression:

Stored size: 740 Bytes

Contents

module KlassExtension

  def join_classes *classes
    klasses = [*classes].flatten.compact.uniq.reject(&:blank?)
    klasses.empty? ? nil : klasses
  end

  # Override this method to add a status class
  def status
  end

  private

  def initialize_component_html_classes
    cls = [
      html_options[:class],
      state,
      status,
      effect,
      options_classes,
      connect,
      component_html_classes
    ]
    html_options[:class] = join_classes(cls)
  end

  def effect
    options[:effect]
  end

  def options_classes
    options[:class] if options.kind_of?(Hash)
  end

  def state
    options[:state] unless options[:state].nil?
  end

  def connect
    "ui-bibz-connect" unless options[:connect].nil?
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.alpha32 lib/ui_bibz/ui/core/component/klass_extension.rb
ui_bibz-2.0.0.alpha31 lib/ui_bibz/ui/core/component/klass_extension.rb
ui_bibz-2.0.0.alpha30 lib/ui_bibz/ui/core/component/klass_extension.rb
ui_bibz-2.0.0.alpha29 lib/ui_bibz/ui/core/component/klass_extension.rb
ui_bibz-2.0.0.alpha28 lib/ui_bibz/ui/core/component/klass_extension.rb
ui_bibz-2.0.0.alpha27 lib/ui_bibz/ui/core/component/klass_extension.rb