Sha256: 518c60fa4fe9b6ee762a1aee2bd0ad01db43c0f903da50be2c16fe8193857d3e

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'rails_admin/config/fields/types/string'

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

          register_instance_option :view_helper do
            :password_field
          end

          def parse_input(params)
            if params[name].present?
              params[name] = params[name]
            else
              params.delete(name)
            end
          end

          register_instance_option :formatted_value do
            ''.html_safe
          end

          # Password field's value does not need to be read
          def value
            ''
          end

          register_instance_option :visible do
            section.is_a?(RailsAdmin::Config::Sections::Edit)
          end

          register_instance_option :pretty_value do
            '*****'
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rails_admin-3.3.0 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.2.1 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.2.0 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.2.0.rc lib/rails_admin/config/fields/types/password.rb
rails_admin-3.2.0.beta lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.4 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.3 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.2 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.1 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.0 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.0.rc2 lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.0.rc lib/rails_admin/config/fields/types/password.rb
rails_admin-3.1.0.beta lib/rails_admin/config/fields/types/password.rb