Sha256: 6b64fe33adb94bbb70a98bfe4cb78bd9c19c4793d4d65c3a98ec58153986f33d
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module ActiveAdmin module Dashboards class Section @@renderers = { :default => SectionRenderer } cattr_accessor :renderers DEFAULT_PRIORITY = 10 attr_accessor :name, :block attr_reader :namespace def initialize(namespace, name, options = {}, &block) @namespace = namespace @name = name @options = options @block = block end def priority @options[:priority] || DEFAULT_PRIORITY end # Sort by priority then by name def <=>(other) result = priority <=> other.priority result = name.to_s <=> other.name.to_s if result == 0 result end # Returns the class to use as this sections renderer. Raises # an exception if the renderer could not be found def renderer klass = Section.renderers[@options[:as] || :default] raise StandardError, "Could not find the #{@options[:as].inspect} dashboard section renderer." unless klass klass end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activeadmin-0.1.1 | lib/active_admin/dashboards/section.rb |
activeadmin-0.1.0 | lib/active_admin/dashboards/section.rb |