Class: AdminIt::ShowContext

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

Constant Summary collapse

CONFIRMS =
i(destroy update)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from AdminIt::Context

Instance Attribute Details

#confirmObject

Returns the value of attribute confirm.



29
30
31
# File 'lib/admin_it/context/show_context.rb', line 29

def confirm
  @confirm
end

Class Method Details

.entity_path?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/admin_it/context/show_context.rb', line 17

def self.entity_path?
  true
end

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



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

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

#confirm?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/admin_it/context/show_context.rb', line 41

def confirm?
  !@confirm.nil?
end

#destroy_entityObject



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/admin_it/context/show_context.rb', line 45

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
      do_destroy_entity
    end
  else
    entity_destroyer.call(controller)
  end
end

#identityObject Originally defined in module Identifiable