Class: Georgia::MenusController
Instance Method Summary
collapse
#current_ability, #current_locale
Instance Method Details
#create ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/georgia/menus_controller.rb', line 14
def create
= .new(params[:menu])
if .save
respond_to do |format|
format.html { redirect_to [:edit, ], notice: "#{@menu.title} was successfully created." }
format.js { render layout: false }
end
else
respond_to do |format|
format.html { render :edit }
format.js { render layout: false }
end
end
end
|
#destroy ⇒ Object
55
56
57
58
59
60
|
# File 'app/controllers/georgia/menus_controller.rb', line 55
def destroy
= .find(params[:id])
.destroy
redirect_to
end
|
#edit ⇒ Object
33
34
35
36
|
# File 'app/controllers/georgia/menus_controller.rb', line 33
def edit
= .find(params[:id])
@links = .links.roots
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/georgia/menus_controller.rb', line 6
def index
= .scoped.page(params[:page])
end
|
#new ⇒ Object
10
11
12
|
# File 'app/controllers/georgia/menus_controller.rb', line 10
def new
= .new
end
|
#show ⇒ Object
29
30
31
|
# File 'app/controllers/georgia/menus_controller.rb', line 29
def show
redirect_to (params[:id])
end
|
#update ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/georgia/menus_controller.rb', line 38
def update
= .find(params[:id])
update_links_attributes(params[:menu].delete(:ancestry))
if .update_attributes(params[:menu])
respond_to do |format|
format.html { redirect_to [:edit, ], notice: "#{@menu.title} was successfully updated." }
format.js { head :ok }
end
else
respond_to do |format|
format.html { render :edit, alert: "Oups. Something went wrong." }
format.js { head :internal_server_error }
end
end
end
|