class ActiveAdmin::Views::StatusTagFor

Constants

VERSION

Public Instance Methods

build(condition, *args) click to toggle source
Calls superclass method
# File lib/active_admin/views/components/status_tag_for.rb, line 11
def build(condition, *args)
  if condition
    super(true_content(args), :ok)
  else
    super(false_content(args), :warn)
  end
end

Private Instance Methods

false_content(args) click to toggle source
# File lib/active_admin/views/components/status_tag_for.rb, line 31
def false_content(args)
  case args.length
  when 0
    I18n.t('status_tag_for.true', default: 'No')
  when 1
    args.fetch(0)
  when 2
    args.fetch(1)
  else
    raise ArgumentError, "Invalid number of argument: #{args}"
  end
end
true_content(args) click to toggle source
# File lib/active_admin/views/components/status_tag_for.rb, line 20
def true_content(args)
  case args.length
  when 0
    I18n.t('status_tag_for.true', default: 'Yes')
  when 1, 2
    args.fetch(0)
  else
    raise ArgumentError, "Invalid number of argument: #{args}"
  end
end