Sha256: 0c810bd131ed7f02fe8a8087437bfb44a76b88e10dbc3354ea7c1d2ab523c44b

Contents?: true

Size: 610 Bytes

Versions: 217

Compression:

Stored size: 610 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 : [: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

217 entries across 217 versions & 1 rubygems

Version Path
avo-2.24.1 lib/avo/fields/status_field.rb
avo-2.24.0 lib/avo/fields/status_field.rb
avo-2.23.3.pre.1.pr1529 lib/avo/fields/status_field.rb
avo-2.23.2 lib/avo/fields/status_field.rb
avo-2.23.1 lib/avo/fields/status_field.rb
avo-2.23.0 lib/avo/fields/status_field.rb
avo-2.22.0 lib/avo/fields/status_field.rb
avo-2.21.3.pre.pr1489 lib/avo/fields/status_field.rb
avo-2.21.2.pre.pr1486 lib/avo/fields/status_field.rb
avo-2.21.1.pre.pr1484 lib/avo/fields/status_field.rb
avo-2.21.0 lib/avo/fields/status_field.rb
avo-2.21.1.pre.pr1476 lib/avo/fields/status_field.rb
avo-2.21.1.pre.issue1450 lib/avo/fields/status_field.rb
avo-2.21.1.pre.issue1444 lib/avo/fields/status_field.rb
avo-2.20.0 lib/avo/fields/status_field.rb
avo-2.19.0 lib/avo/fields/status_field.rb
avo-2.18.1 lib/avo/fields/status_field.rb
avo-2.18.1.pre.1.eagerloaddirs lib/avo/fields/status_field.rb
avo-2.18.0 lib/avo/fields/status_field.rb
avo-2.17.1.pre.5.stackedlayout lib/avo/fields/status_field.rb