Sha256: 227cd696c95716f492d0c0805994340be1a100e7e747f1c16e7a151c5b1f0d96

Contents?: true

Size: 858 Bytes

Versions: 6

Compression:

Stored size: 858 Bytes

Contents

module AdminIt
  class ShowContext < SingleContext
    include Identifiable

    class << self
      include Renderable

      protected

      def default_icon
        'info-circle'
      end
    end

    def self.entity_path?
      true
    end

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

    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

    protected

    def destroy; end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
admin_it-1.0.6 lib/admin_it/context/show_context.rb
admin_it-1.0.5 lib/admin_it/context/show_context.rb
admin_it-1.0.4 lib/admin_it/context/show_context.rb
admin_it-1.0.3 lib/admin_it/context/show_context.rb
admin_it-1.0.2 lib/admin_it/context/show_context.rb
admin_it-1.0.1 lib/admin_it/context/show_context.rb