Sha256: 6a670a242ceed5c9fbd86ff03e518fdad4487bdbe222369fc20aba82ea546e47

Contents?: true

Size: 1.04 KB

Versions: 25

Compression:

Stored size: 1.04 KB

Contents

module RailsAdmin
  module Config
    module Fields
      module Types
        class Boolean < RailsAdmin::Config::Fields::Base
          # Register field type for the type loader
          RailsAdmin::Config::Fields::Types.register(self)

          register_instance_option :view_helper do
            :check_box
          end

          register_instance_option :pretty_value do
            case value
            when nil
              %(<span class='label label-default'>&#x2012;</span>)
            when false
              %(<span class='label label-danger'>&#x2718;</span>)
            when true
              %(<span class='label label-success'>&#x2713;</span>)
            end.html_safe
          end

          register_instance_option :export_value do
            value.inspect
          end

          register_instance_option :partial do
            :form_boolean
          end

          # Accessor for field's help text displayed below input field.
          def generic_help
            ''
          end
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
rails_admin-2.3.1 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.3.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.2.1 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.2.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.1.1 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.1.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.0.2 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.4.3 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.0.1 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.0.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.0.0.rc lib/rails_admin/config/fields/types/boolean.rb
rails_admin-2.0.0.beta lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.4.2 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.4.1 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.4.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.3.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.2.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.1.1 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.1.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-1.0.0 lib/rails_admin/config/fields/types/boolean.rb