Repository URL to install this package:
|
Version:
0.0.12 ▾
|
module Eventful
module CoreExt
module ActiveAdmin
module ResourceDSL
def eventful_activeadmin
config.sort_order = 'start_at_asc'
actions :all, :except => :show
scope :all, :default => true
scope :current
scope :upcoming
scope :past
index do
column :title
column :start_at
default_actions
end
form :partial => 'admin/events/form'
controller do
def new
start_time = DateTime.now.advance(:hours => 1).beginning_of_hour
end_time = start_time.advance(:hours => 1)
instance_variable_set("@#{resource_class.name.underscore}",
resource_class.new(:start_at => start_time,
:end_at => end_time))
end
end
end
end
end
end
end