Sha256: a48454ef7d279167d508fd507a4bd5e3af92bc60faae99c1ef65387413f07fad

Contents?: true

Size: 994 Bytes

Versions: 12

Compression:

Stored size: 994 Bytes

Contents

require 'builder'

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 :formatted_value do
            case value
            when nil
              %{<span class="badge">-</span>}
            when false
              %{<span class="badge badge-important">&#x2718;</span>}
            when true
              %{<span class="badge badge-success">&#x2713;</span>}
            end.html_safe
          end

          register_instance_option :export_value do
            value.inspect
          end

          # Accessor for field's help text displayed below input field.
          register_instance_option :help do
            ""
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
rails_admin-0.5.0 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.9 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.8 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.7 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.6 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.5 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.4 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-lbgraham-0.4.2 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.3 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.2 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.1 lib/rails_admin/config/fields/types/boolean.rb
rails_admin-0.4.0 lib/rails_admin/config/fields/types/boolean.rb