Class: AdminIt::ShowContext

Inherits:
SingleContext show all
Extended by:
Renderable
Includes:
Identifiable
Defined in:
lib/admin_it/context/show_context.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from AdminIt::Context

Class Method Details

.entity_path?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/admin_it/context/show_context.rb', line 15

def self.entity_path?
  true
end

.read(entity = nil, &block) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/admin_it/context/show_context.rb', line 19

def self.read(entity = nil, &block)
  if entity.nil?
    @reader = block if block_given?
  elsif !@reader.nil?
    @reader.call(entity)
  end
end

.render(entity = nil, instance = nil, &block) ⇒ Object Originally defined in module Renderable

Instance Method Details

#destroy_entityObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/admin_it/context/show_context.rb', line 27

def destroy_entity
  if entity_destroyer.nil?
    if controller.respond_to?("#{resource.name}_destroy")
      controller.send("#{resource.name}_destroy")
    elsif controller.respond_to?(:destroy_entity)
      controller.destroy_entity(entity_class)
    else
      destroy
    end
  else
    entity_destroyer.call(controller)
  end
end

#identityObject Originally defined in module Identifiable