1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 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
- @bots = Bot.all
- @bots.each do |bot|
- panel "Botnick: " + bot.botnick do
- span link_to("view this bot", "/admin/bots/" + bot.id.to_s)
- span "|"
- span link_to("edit this bot", "/admin/bots/" + bot.id.to_s + "/edit")
- span "|"
- span link_to("add a channel to this bot", "/admin/channels/new?bot_id=" + bot.id.to_s + "&botnick=" + bot.botnick.to_s)
- table do
- @channels = Channel.find_all_by_bot_id(bot.id)
- th :Name
- th :Activate
- th :Actions
- @channels.each do |c|
- tr do
- td c.name
- td c.activate
- td do
- span link_to("view", "/admin/channels/" + c.id.to_s)
- span link_to("edit", "/admin/channels/" + c.id.to_s + "/edit")
- span link_to("delete", "/admin/channels/" + c.id.to_s, :method => 'delete', :confirm => "You sure?")
- end
- end
- end
- end
- end
- end
- span link_to("add a new bot", "admin/bots/new")
- 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
|