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 :bot, :sortable => :bot_id do |c|
  6. link_to "ID:" + c.bot_id.to_s + " N:" + Bot.find(c.bot_id).botnick, "bots/" + c.bot_id.to_s
  7. end
  8. column :name
  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 :bot do |c|
  18. link_to "ID:" + c.bot_id.to_s + " N:" + Bot.find(c.bot_id).botnick, "../bots/" + c.bot_id.to_s
  19. end
  20. row :name
  21. row :activate
  22. row :created_at
  23. row :updated_at
  24. end
  25. active_admin_comments
  26. end
  27. filter :id
  28. filter :bot, :as => :select, :member_label => :botnick
  29. filter :name
  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 :bot, :as => :select, :member_label => :botnick # https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/select_input.rb
  37. f.input :name, :label => "Channelname"
  38. f.input :activate
  39. end
  40. f.buttons
  41. end
  42. end