channels.rb 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. if params[:bot_id] && params[:botnick] then
  38. f.input :bot_id, :as => :string, :member_label => :botnick, :input_html => { :readonly => true, :size => 10, :value => params[:botnick] }
  39. f.input :bot_id, :as => :hidden, :value => params[:bot_id], :member_label => :botnick, :input_html => { :readonly => true, :size => 10, :value => params[:bot_id] }
  40. #f.input :bot, :as => :select, :member_label => :botnick # https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/select_input.rb
  41. else
  42. f.input :bot, :as => :select, :member_label => :botnick # https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/select_input.rb
  43. end
  44. f.input :activate
  45. end
  46. f.buttons
  47. end
  48. end