Class: Forge::EventsController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/forge/app/controllers/forge/events_controller.rb', line 23
def create
@event = Event.new(params[:event])
if @event.save
flash[:notice] = 'Event was successfully created.'
redirect_to(forge_events_path)
else
render :action => "new"
end
end
|
#destroy ⇒ Object
42
43
44
45
|
# File 'lib/forge/app/controllers/forge/events_controller.rb', line 42
def destroy
@event.destroy
redirect_to(forge_events_path)
end
|
#edit ⇒ Object
20
21
|
# File 'lib/forge/app/controllers/forge/events_controller.rb', line 20
def edit
end
|
#index ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/forge/app/controllers/forge/events_controller.rb', line 5
def index
respond_to do |format|
format.html { @events = Event.paginate(:per_page => 10, :page => params[:page]) }
format.js {
params[:q] ||= ''
@events = Event.where("LOWER(title) LIKE ? OR LOWER(location) LIKE ? OR LOWER(description) LIKE ?", "%#{params[:q].downcase}%", "%#{params[:q].downcase}%", "%#{params[:q].downcase}%")
render :partial => "event", :collection => @events
}
end
end
|
#new ⇒ Object
16
17
18
|
# File 'lib/forge/app/controllers/forge/events_controller.rb', line 16
def new
@event = Event.new
end
|
#update ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/forge/app/controllers/forge/events_controller.rb', line 33
def update
if @event.update_attributes(params[:event])
flash[:notice] = 'Event was successfully updated.'
redirect_to(forge_events_path)
else
render :action => "edit"
end
end
|