Sha256: c5955cce439cae7b24764d10395c8cfc87cf76c6243d431ee3f5cacaf230fe32
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
module AdminIt class ShowContext < SingleContext extend Renderable include Identifiable CONFIRMS = %i(destroy update) class << self protected def default_icon 'info-circle' end end dsl do dsl_block :read end def self.entity_path? true end def self.read(entity) unless @read.nil? @read.call(entity) end end attr_reader :confirm after_load do |store: {}, params: {}| self.confirm = params[:confirm] end def confirm=(value) value = value.downcase.to_sym if value.is_a?(String) return unless value.is_a?(Symbol) && CONFIRMS.include?(value) @confirm = value end def confirm? !@confirm.nil? 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 do_destroy_entity end else entity_destroyer.call(controller) end end protected def do_destroy_entity; end end end
Version data entries
4 entries across 4 versions & 1 rubygems