Class: Adminpanel::GalleriesController
Instance Method Summary
collapse
#twitter_publish
#fb_choose_page, #fb_publish, #fb_save_token
#edit, #new, #show
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
#create ⇒ Object
def edit
@gallery = Gallery.find(params[:id])
end
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 16
def create
@gallery = Gallery.new(params[:gallery])
if @gallery.save
redirect_to gallery_path(@gallery), :notice => t("gallery.success")
else
render 'new'
end
end
|
#destroy ⇒ Object
38
39
40
41
42
43
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 38
def destroy
@gallery = Gallery.find(params[:id])
@gallery.destroy
redirect_to galleries_path, :notice => t("gallery.deleted")
end
|
#index ⇒ Object
4
5
6
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 4
def index
@galleries = Gallery.all
end
|
#move_better ⇒ Object
26
27
28
29
30
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 26
def move_better
@gallery = Gallery.find(params[:id])
@gallery.move_to_better_position
respond
end
|
#move_worst ⇒ Object
32
33
34
35
36
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 32
def move_worst
@gallery = Gallery.find(params[:id])
@gallery.move_to_worst_position
respond
end
|
#update ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 45
def update
@gallery = Gallery.find(params[:id])
if @gallery.update_attributes(params[:gallery])
redirect_to gallery_path(@gallery)
else
render 'edit'
end
end
|