Sha256: 86feff3a1ccdba769fd6af980ab5f88f364f981885779ed9d7b8a938769ec561

Contents?: true

Size: 1.74 KB

Versions: 17

Compression:

Stored size: 1.74 KB

Contents

module UiBibz::Helpers::Ui::Core::NotificationsHelper

  # Alert Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  #
  def ui_alert content = nil, options = nil, html_options = nil, &block
    if is_tap(content, options)
      UiBibz::Ui::Core::Notifications::Alert.new(content, options, html_options).tap(&block).render
    else
      UiBibz::Ui::Core::Notifications::Alert.new(content, options, html_options, &block).render
    end
  end

  # Badge (Label) Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  #
  def ui_badge content = nil, options = nil, html_options = nil, &block
    UiBibz::Ui::Core::Notifications::Badge.new(content, options, html_options, &block).render
  end

  # ProgressBar Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  def ui_progress_bar percentage = nil, options = nil, html_options = nil, &block
    if is_tap(percentage, options)
      UiBibz::Ui::Core::Notifications::ProgressBar.new(percentage, options, html_options).tap(&block).render
    else
      UiBibz::Ui::Core::Notifications::ProgressBar.new(percentage, options, html_options, &block).render
    end
  end

  # Toast Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  def ui_toast content = nil, options = nil, html_options = nil, &block
    UiBibz::Ui::Core::Notifications::Toast.new(content, options, html_options).tap(&block).render
  end

  # Spinner Component
  #
  # +options+ (Hash)
  # +html_options+ (Hash)
  #
  def ui_spinner content = nil, options = nil, html_options = nil, &block
    UiBibz::Ui::Core::Notifications::Spinner.new(content, options, html_options, &block).render
  end

  private

  def is_tap content, options
    (content[:tap] if content.kind_of?(Hash)) || (options[:tap] unless options.nil?)
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ui_bibz-2.4.0 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.15 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.14 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.13 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.12 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.11 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.10 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.9 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.8 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.7 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.6 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.5 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.4 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.3 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.2 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.1 lib/ui_bibz/helpers/ui/core/notifications_helper.rb
ui_bibz-2.3.0 lib/ui_bibz/helpers/ui/core/notifications_helper.rb