dashboards.rb 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ActiveAdmin::Dashboards.build do
  2. # Define your dashboard sections here. Each block will be
  3. # rendered on the dashboard in the context of the view. So just
  4. # return the content which you would like to display.
  5. # == Simple Dashboard Section
  6. # Here is an example of a simple dashboard section
  7. #
  8. section "Bots and Channels" do
  9. ul do
  10. @bots = Bot.all
  11. @bots.each do |bot|
  12. li bot.botnick
  13. ol do
  14. @channels = Channel.find_all_by_bot_id(bot.id)
  15. @channels.each do |c|
  16. li c.name
  17. end
  18. end
  19. end
  20. end
  21. end
  22. section "Frequencies and Bans" do
  23. ul do
  24. @frequencies = Frequency.all
  25. @frequencies.each do |f|
  26. li "Freq: " + f.name + " on prefix: " + f.prefix + " (" + f.delay.to_s + " seconds delay)"
  27. ul do
  28. @bans = Ban.find_all_by_frequency_id(f.id)
  29. @bans.each do |b|
  30. li "Hostmask: " + b.hostmask + " Reason: " + b.reason + " (from " + b.valid_from.to_s + " to " + b.valid_to.to_s + ")"
  31. end
  32. end
  33. end
  34. end
  35. end
  36. # == Render Partial Section
  37. # The block is rendered within the context of the view, so you can
  38. # easily render a partial rather than build content in ruby.
  39. #
  40. # section "Recent Posts" do
  41. # div do
  42. # render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb
  43. # end
  44. # end
  45. # == Section Ordering
  46. # The dashboard sections are ordered by a given priority from top left to
  47. # bottom right. The default priority is 10. By giving a section numerically lower
  48. # priority it will be sorted higher. For example:
  49. #
  50. # section "Recent Posts", :priority => 10
  51. # section "Recent User", :priority => 1
  52. #
  53. # Will render the "Recent Users" then the "Recent Posts" sections on the dashboard.
  54. # == Conditionally Display
  55. # Provide a method name or Proc object to conditionally render a section at run time.
  56. #
  57. # section "Membership Summary", :if => :memberships_enabled?
  58. # section "Membership Summary", :if => Proc.new { current_admin_user.account.memberships.any? }
  59. end