Sha256: b0af18058e8f069d65161190116790f8085f4f3e9daa6e310bf4d82c23a8bba5
Contents?: true
Size: 1.58 KB
Versions: 12
Compression:
Stored size: 1.58 KB
Contents
module RailsAdmin module Config module Actions class Dashboard < RailsAdmin::Config::Actions::Base RailsAdmin::Config::Actions.register(self) register_instance_option :root? do true end register_instance_option :breadcrumb_parent do nil end register_instance_option :controller do Proc.new do @history = @auditing_adapter && @auditing_adapter.latest || [] if @action.statistics? @abstract_models = RailsAdmin::Config.visible_models(:controller => self).map(&:abstract_model) @most_recent_changes = {} @count = {} @max = 0 @abstract_models.each do |t| scope = @authorization_adapter && @authorization_adapter.query(:index, t) current_count = t.count({}, scope) @max = current_count > @max ? current_count : @max @count[t.pretty_name] = current_count if t.properties.find{|c| c[:name] == :updated_at } @most_recent_changes[t.pretty_name] = t.first(:sort => :updated_at).try(:updated_at) end end end render @action.template_name, :status => (flash[:error].present? ? :not_found : 200) end end register_instance_option :route_fragment do '' end register_instance_option :link_icon do 'icon-home' end register_instance_option :statistics? do true end end end end end
Version data entries
12 entries across 12 versions & 2 rubygems