Sha256: e787ee2d52c0bc67b140847d01590afc5857e9a9db2ea465a1262fe2f5f6a4b2

Contents?: true

Size: 609 Bytes

Versions: 14

Compression:

Stored size: 609 Bytes

Contents

module RailsAdmin
  module Config
    # Defines a visibility configuration
    module Hideable
      # Visibility defaults to true.
      def self.included(klass)
        klass.register_instance_option(:visible?) do
          !root.try :excluded?
        end
      end

      # Reader whether object is hidden.
      def hidden?
        not visible
      end

      # Writer to hide object.
      def hide(&block)
        visible block ? proc { false == (instance_eval &block) } : false
      end

      # Writer to show field.
      def show(&block)
        visible block || true
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
rails_admin-0.1.2 lib/rails_admin/config/hideable.rb
rails_admin-0.1.1 lib/rails_admin/config/hideable.rb
rails_admin-0.1.0 lib/rails_admin/config/hideable.rb
rails_admin-0.0.5 lib/rails_admin/config/hideable.rb
rails_admin-0.0.4 lib/rails_admin/config/hideable.rb
rails_admin-0.0.3 lib/rails_admin/config/hideable.rb
rails_admin-0.0.2 lib/rails_admin/config/hideable.rb
upstream-rails_admin-1.0.2 lib/rails_admin/config/hideable.rb
rails_admin-0.0.1 lib/rails_admin/config/hideable.rb
obitum-rails_admin-0.0.5 lib/rails_admin/config/hideable.rb
drewda_rails_admin-0.0.1 lib/rails_admin/config/hideable.rb
obitum-rails_admin-0.0.4 lib/rails_admin/config/hideable.rb
obitum-rails_admin-0.0.3 lib/rails_admin/config/hideable.rb
obitum-rails_admin-0.0.2 lib/rails_admin/config/hideable.rb