Module: RailsAdmin::Config::Hideable

Included in:
Actions::Base, Fields::Base, Fields::Group, Model
Defined in:
lib/rails_admin/config/hideable.rb

Overview

Defines a visibility configuration

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(klass)

Visibility defaults to true.



6
7
8
9
10
# File 'lib/rails_admin/config/hideable.rb', line 6

def self.included(klass)
  klass.register_instance_option(:visible?) do
    !root.try :excluded?
  end
end

Instance Method Details

- (Boolean) hidden?

Reader whether object is hidden.



13
14
15
# File 'lib/rails_admin/config/hideable.rb', line 13

def hidden?
  not visible
end

- (Object) hide(&block)

Writer to hide object.



18
19
20
# File 'lib/rails_admin/config/hideable.rb', line 18

def hide(&block)
  visible block ? proc { false == (instance_eval &block) } : false
end

- (Object) show(&block)

Writer to show field.



23
24
25
# File 'lib/rails_admin/config/hideable.rb', line 23

def show(&block)
  visible block || true
end