Active Admin Dashboard
ActiveAdmin.register_page "Dashboard" do
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
content :title => proc{ I18n.t("active_admin.dashboard") } do
section h2 "Top Movie" do
table_for @top_ps.where('ptype = ?', 'movie') do |t|
column("Title"){|p| link_to p.title, admin_program_path(p.id)}
column "Start" do |p|
p.program_schedules.each do |schedule|
link_to distance_of_time_in_words(Time.now, schedule.start,true), admin_program_schedule_path(schedule.id)
end
end
end
end
end # content
end
If I run this i get
[#<ProgramSchedule id: 746, program_id: 430, start: "2012-09-17 09:30:00", stop: "2012-09-17 10:30:00">,
#<ProgramSchedule id: 8124, program_id: 430, start: "2012-09-22 23:30:00", stop: "2012-09-23 00:30:00">]
Instead of
<a href="/path">Start</a>
<a href="/path">Start</a>
I understand where I am wrong, but how to execute that code inside a block?
This template DSL is called Arbre. I’m not sure if it’s used much outside of ActiveAdmin. With the release of ActiveAdmin 0.5.0 it’s been split off into it’s own gem https://github.com/gregbell/arbre
If you don’t want to deal with it you can render a partial. So in your dashboard code put something like
And then