Class: Forge::GalleriesController
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/galleries_controller.rb', line 23
def create
@gallery = Gallery.new(params[:gallery])
if @gallery.save
flash[:notice] = 'Gallery was successfully created.'
redirect_to(forge_galleries_path)
else
render :action => "new"
end
end
|
#destroy ⇒ Object
42
43
44
45
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 42
def destroy
@gallery.destroy
redirect_to(forge_galleries_path)
end
|
#edit ⇒ Object
19
20
21
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 19
def edit
@gallery = Gallery.find_with_photos(params[:id])
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 4
def index
respond_to do |format|
format.html { @galleries = Gallery.paginate(:per_page => 10, :page => params[:page]) }
format.js {
params[:q] ||= ''
@galleries = Gallery.where("LOWER(title) LIKE ?", "%#{params[:q].downcase}%")
render :partial => "gallery", :collection => @galleries
}
end
end
|
#new ⇒ Object
15
16
17
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 15
def new
@gallery = Gallery.new
end
|
#reorder ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 48
def reorder
Gallery.reorder!(params[:gallery_list])
respond_to do |format|
format.js { render :nothing => true }
format.html {flash[:notice] = "Re-ordered successfully" and redirect_to forge_galleries_path }
end
end
|
#update ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 33
def update
if @gallery.update_attributes(params[:gallery])
flash[:notice] = 'Gallery was successfully updated.'
redirect_to(edit_forge_gallery_path(@gallery))
else
render :action => "edit"
end
end
|