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.



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

def confirm
  @confirm
end

Class Method Details

.entity_path?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/admin_it/context/show_context.rb', line 20

def self.entity_path?
  true
end

.read(entity) ⇒ Object



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

def self.read(entity)
  unless @read.nil?
    @read.call(entity)
  end
end

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

Instance Method Details

#confirm?Boolean

Returns:

  • (Boolean)


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

def confirm?
  !@confirm.nil?
end

#destroy_entityObject



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

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