bots.rb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ActiveAdmin.register Bot do
  2. menu :priority => 4
  3. index do
  4. column :id
  5. column :botnick do |b|
  6. link_to b.botnick, "bots/" + b.id.to_s
  7. end
  8. column :owner
  9. column :activate
  10. column :created_at
  11. column :updated_at
  12. default_actions
  13. end
  14. show :title => :botnick do
  15. attributes_table do
  16. row :id
  17. row :botnick
  18. row :owner
  19. row :activate
  20. row :created_at
  21. row :updated_at
  22. end
  23. panel "This Bot's Channels" do
  24. span link_to("add a channel to this bot", "/admin/channels/new?bot_id=" + bot.id.to_s + "&botnick=" + bot.botnick.to_s)
  25. table do
  26. @channels = Channel.find_all_by_bot_id(bot.id)
  27. th :Name
  28. th :Activate
  29. th :Actions
  30. @channels.each do |c|
  31. tr do
  32. td c.name
  33. td c.activate
  34. td do
  35. span link_to("view", "/admin/channels/" + c.id.to_s)
  36. span link_to("edit", "/admin/channels/" + c.id.to_s + "/edit")
  37. span link_to("delete", "/admin/channels/" + c.id.to_s, :method => 'delete', :confirm => "You sure?")
  38. end
  39. end
  40. end
  41. end
  42. end
  43. active_admin_comments
  44. end
  45. sidebar :help do
  46. ul do
  47. li "Owner: It is nice to read some contact infos like an email address in the owners field. To make life for spamcrawlers harder, use an obfuscation method for the address, like: foo {at] bar dot domain"
  48. end
  49. end
  50. end