1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- ActiveAdmin.register Channel do
- menu :priority => 5 #,:parent => "Bots"
- index do
- column :id
- column :name
- column :bot, :sortable => :bot_id do |c|
- link_to "ID:" + c.bot_id.to_s + " N:" + Bot.find(c.bot_id).botnick, "bots/" + c.bot_id.to_s
- end
- column :activate
- column :created_at
- column :updated_at
- default_actions
- end
- show :title => :name do
- attributes_table do
- row :id
- row :name
- row :bot do |c|
- Bot.find(c.bot_id) do |bot|
- span(link_to("ID:" + c.bot_id.to_s + " N:" + bot.botnick, "../bots/" + c.bot_id.to_s).to_s + " | " +
- link_to("add a channel to this bot", "/admin/channels/new?bot_id=" + bot.id.to_s + "&botnick=" + bot.botnick.to_s))
- end
- end
- row :activate
- row :created_at
- row :updated_at
- end
- active_admin_comments
- end
- filter :id
- filter :name
- filter :bot, :as => :select, :member_label => :botnick
- filter :activate, :as => :select
- filter :created_at
- filter :updated_at
- form do |f|
- #@user = User.new(:email => params[:email])
- f.inputs "Details" do
- f.input :name, :label => "Channelname"
- if params[:bot_id] && params[:botnick] then
- f.input :bot_id, :as => :string, :member_label => :botnick, :input_html => { :readonly => true, :size => 10, :value => params[:botnick] }
- f.input :bot_id, :as => :hidden, :value => params[:bot_id], :member_label => :botnick, :input_html => { :readonly => true, :size => 10, :value => params[:bot_id] }
- #f.input :bot, :as => :select, :member_label => :botnick # https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/select_input.rb
- else
- f.input :bot, :as => :select, :member_label => :botnick # https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/select_input.rb
- end
- f.input :activate
- end
- f.buttons
- end
- end
|