Sha256: 69475868dca736226b9464ca3762585e86c09fb6614fba02a7d1f462c9ff23ac
Contents?: true
Size: 1.39 KB
Versions: 66
Compression:
Stored size: 1.39 KB
Contents
module Pageflow # A registry of additional rows to display in attribute tables on # admin pages. # # @since 12.2 module Admin class AttributesTableRows # @api private def initialize @rows = {} end # Insert an additional row into an attribute table. # # @param resource_name [Symbol] Either :entry, :account or :theming. # # @param name [Symbol] Name of the attribute to display. # # @param options [Hash] Supports same options as # ActiveAdmin::Views::AttributesTable#row, in addition to: # # @option options [Symbol] :before Insert row before row with # given name. Append to table if not found. # # @option options [Symbol] :after Insert row after row with # given name. Append to table if not found. # # @yieldparam resource [ActiveRecord::Base] A block which is # evaluated in the context of the Arbre template to render the # contents of the cell. def register(resource_name, name, options = {}, &block) @rows[resource_name] ||= [] @rows[resource_name] << { name: name, block: block, options: options.except(:before, :after), **options.slice(:before, :after) } end # @api private def for(resource_name) @rows.fetch(resource_name, []) end end end end
Version data entries
66 entries across 66 versions & 1 rubygems