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.



32
33
34
# File 'lib/admin_it/context/show_context.rb', line 32

def confirm
  @confirm
end

Class Method Details

.entity_path?Boolean

Returns:

  • (Boolean)


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

def self.entity_path?
  true
end

.read(entity) ⇒ Object



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

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

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

.renderable?Boolean Originally defined in module Renderable

Returns:

  • (Boolean)

Instance Method Details

#confirm?Boolean

Returns:

  • (Boolean)


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

def confirm?
  !@confirm.nil?
end

#destroy_entityObject



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

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