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
22
23
24
25
26
27
28
29
30
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 22
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
41
42
43
44
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 41
def destroy
@gallery.destroy
redirect_to(forge_galleries_path)
end
|
#edit ⇒ Object
18
19
20
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 18
def edit
@gallery = Gallery.find_with_photos(params[:id])
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
|
# 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 {
@galleries = Gallery.where("title LIKE ?", "%#{params[:q]}%")
render :partial => "gallery", :collection => @galleries
}
end
end
|
#new ⇒ Object
14
15
16
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 14
def new
@gallery = Gallery.new
end
|
#reorder ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 47
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
32
33
34
35
36
37
38
39
|
# File 'lib/forge/app/controllers/forge/galleries_controller.rb', line 32
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
|