Sha256: 63e525539a5a7a2761dc6735d68fbd8f6e8ce91a1235018d746fcbc2f354e9af

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module KlassExtension
  def join_classes(*classes)
    UiBibz::Builders::HtmlClassesBuilder.join_classes classes
  end

  def exclude_classes(arr, *classes)
    UiBibz::Builders::HtmlClassesBuilder.exclude_classes arr, classes
  end

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

  # TODO: Refactor
  # Not very clean but it's the only way to remove classes to html_options
  def exclude_classes_in_html_options(*classes)
    html_options[:class] = exclude_classes [html_options[:class], options[:classes]], classes
  end

  private

  def initialize_component_html_classes
    html_classes_builder = UiBibz::Builders::HtmlClassesBuilder.new
    html_classes_builder.add [
      html_options[:class],
      options[:class],
      state,
      status,
      effect,
      connect,
      component_html_classes
    ]
    # html_options[:class] = html_classes_builder.output
    html_classes_builder.output
  end

  def effect
    options[:effect]
  end

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta16 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta15 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta14 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta13 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta10 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta9 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta8 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta7 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta6 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta4 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
ui_bibz-4.0.0.beta3 lib/ui_bibz/ui/extensions/core/component/klass_extension.rb