Sha256: 522cca64ecf63c400fe74a7a022f5c77f63c557b161c3d2d37b2ee9d469c9d01
Contents?: true
Size: 686 Bytes
Versions: 36
Compression:
Stored size: 686 Bytes
Contents
module Avo module Fields class StatusField < BaseField def initialize(name, **args, &block) @defaults = { partial_name: "status-field" } super(name, **args, &block) @loading_when = args[:loading_when].present? ? [args[:loading_when]].flatten : [:waiting, :running] @failed_when = args[:failed_when].present? ? [args[:failed_when]].flatten : [:failed] end def status status = "success" if value.present? status = "failed" if @failed_when.include? value.to_sym status = "loading" if @loading_when.include? value.to_sym end status end end end end
Version data entries
36 entries across 36 versions & 1 rubygems