Class: Adminpanel::GalleriesController
Instance Method Summary
collapse
#get_menu_elements, #handle_unverified_request, #set_model, #signed_in_user
#adminpanel_resources, #default_controllers, #find_resources, #menu_items, #resources_path
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 15
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
61
62
63
64
65
66
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 61
def destroy
@gallery = Gallery.find(params[:id])
@gallery.destroy
redirect_to galleries_path, :notice => t("gallery.deleted")
end
|
#edit ⇒ Object
11
12
13
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 11
def edit
@gallery = Gallery.find(params[:id])
end
|
#index ⇒ Object
3
4
5
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 3
def index
@galleries = Gallery.find(:all)
end
|
#move_better ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 25
def move_better
@gallery = Gallery.find(params[:id])
if @gallery.move_to_better_position
flash[:success] = t("gallery.moved")
else
flash[:warning] = t("gallery.not-moved")
end
respond_to do |format|
format.html do
redirect_to galleries_path
end
format.js do
@galleries = Gallery.all
render :locals => { :galleries => @galleries }
end
end
end
|
#move_worst ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 43
def move_worst
@gallery = Gallery.find(params[:id])
if @gallery.move_to_worst_position
flash[:success] = t("gallery.moved")
else
flash[:warning] = t("gallery.not-moved")
end
respond_to do |format|
format.html do
redirect_to galleries_path
end
format.js do
@galleries = Gallery.all
render :locals => { :galleries => @galleries }
end
end
end
|
#new ⇒ Object
77
78
79
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 77
def new
@gallery = Gallery.new
end
|
#show ⇒ Object
7
8
9
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 7
def show
@gallery = Gallery.find(params[:id])
end
|
#update ⇒ Object
68
69
70
71
72
73
74
75
|
# File 'app/controllers/adminpanel/galleries_controller.rb', line 68
def update
@gallery = Gallery.find(params[:id])
if @gallery.update_attributes(params[:gallery])
redirect_to gallery_path(@gallery)
else
render 'edit'
end
end
|