123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- ActiveAdmin::Dashboards.build do
- # Define your dashboard sections here. Each block will be
- # rendered on the dashboard in the context of the view. So just
- # return the content which you would like to display.
-
- # == Simple Dashboard Section
- # Here is an example of a simple dashboard section
- #
- section "Bots and Channels" do
- ul do
- @bots = Bot.all
- @bots.each do |bot|
- li bot.botnick
- ol do
- @channels = Channel.find_all_by_bot_id(bot.id)
- @channels.each do |c|
- li c.name
- end
- end
- end
- end
- end
- section "Frequencies and Bans" do
- ul do
- @frequencies = Frequency.all
- @frequencies.each do |f|
- li "Freq: " + f.name + " on prefix: " + f.prefix + " (" + f.delay.to_s + " seconds delay)"
- ul do
- @bans = Ban.find_all_by_frequency_id(f.id)
- @bans.each do |b|
- li "Hostmask: " + b.hostmask + " Reason: " + b.reason + " (from " + b.valid_from.to_s + " to " + b.valid_to.to_s + ")"
- end
- end
- end
- end
- end
- # == Render Partial Section
- # The block is rendered within the context of the view, so you can
- # easily render a partial rather than build content in ruby.
- #
- # section "Recent Posts" do
- # div do
- # render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb
- # end
- # end
-
- # == Section Ordering
- # The dashboard sections are ordered by a given priority from top left to
- # bottom right. The default priority is 10. By giving a section numerically lower
- # priority it will be sorted higher. For example:
- #
- # section "Recent Posts", :priority => 10
- # section "Recent User", :priority => 1
- #
- # Will render the "Recent Users" then the "Recent Posts" sections on the dashboard.
-
- # == Conditionally Display
- # Provide a method name or Proc object to conditionally render a section at run time.
- #
- # section "Membership Summary", :if => :memberships_enabled?
- # section "Membership Summary", :if => Proc.new { current_admin_user.account.memberships.any? }
- end
|