channels.rb 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ActiveAdmin.register Channel do
  2. menu :priority => 5 #,:parent => "Bots"
  3. index do
  4. column :id
  5. column :name
  6. column :bot, :sortable => :bot_id do |c|
  7. link_to "ID:" + c.bot_id.to_s + " N:" + Bot.find(c.bot_id).botnick, "bots/" + c.bot_id.to_s
  8. end
  9. column :activate
  10. column :created_at
  11. column :updated_at
  12. default_actions
  13. end
  14. show :title => :name do
  15. attributes_table do
  16. row :id
  17. row :name
  18. row :bot do |c|
  19. link_to "ID:" + c.bot_id.to_s + " N:" + Bot.find(c.bot_id).botnick, "../bots/" + c.bot_id.to_s
  20. end
  21. row :activate
  22. row :created_at
  23. row :updated_at
  24. end
  25. active_admin_comments
  26. end
  27. filter :id
  28. filter :name
  29. filter :bot, :as => :select, :member_label => :botnick
  30. filter :activate, :as => :select
  31. filter :created_at
  32. filter :updated_at
  33. form do |f|
  34. #@user = User.new(:email => params[:email])
  35. f.inputs "Details" do
  36. f.input :name, :label => "Channelname"
  37. f.input :bot, :as => :select, :member_label => :botnick # https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/select_input.rb
  38. f.input :activate
  39. end
  40. f.buttons
  41. end
  42. end