Sha256: 49ce4b175ada2cc457867f2e12a2e009ab428a5a9fc7c7f9ee49f5940a14f5ec
Contents?: true
Size: 896 Bytes
Versions: 35
Compression:
Stored size: 896 Bytes
Contents
module Avo module Fields class StatusField < BaseField def initialize(id, **args, &block) super(id, **args, &block) @loading_when = args[:loading_when].present? ? [args[:loading_when]].flatten.map(&:to_sym) : [:waiting, :running] @failed_when = args[:failed_when].present? ? [args[:failed_when]].flatten.map(&:to_sym) : [:failed] @success_when = args[:success_when].present? ? [args[:success_when]].flatten.map(&:to_sym) : [] end def status status = "neutral" if value.present? status = "failed" if @failed_when.include? value.to_sym status = "loading" if @loading_when.include? value.to_sym status = "success" if @success_when.include? value.to_sym end status end def options_for_filter [@failed_when, @loading_when].flatten end end end end
Version data entries
35 entries across 35 versions & 1 rubygems