Class: Adminpanel::CategoriesController
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
#show
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 16
def create
create! do |success, failure|
success.html do
flash.now[:success] = I18n.t("action.save_success")
redirect_to categories_path
end
failure.html do
set_collections
render "shared/new"
end
success.js do
render :locals => {:category => resource }
end
failure.js do
set_collections
render "new", :locals => {:category => resource, :model => resource.model }, :formats => [:js]
end
end
end
|
#destroy ⇒ Object
63
64
65
66
67
68
69
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 63
def destroy
destroy! do |format|
format.html do
redirect_to categories_path
end
end
end
|
#edit ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 40
def edit
edit! do |format|
format.html do
set_collections
render "shared/edit"
end
end
end
|
#index ⇒ Object
3
4
5
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 3
def index
@categories = Category.all
end
|
#new ⇒ Object
7
8
9
10
11
12
13
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 7
def new
set_collections
new! do |format|
format.html { render "shared/new" }
format.js {render :locals => {:category => resource, :model => params[:model]}}
end
end
|
#update ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 49
def update
update! do |success, failure|
success.html do
flash.now[:success] = I18n.t("action.save_success")
redirect_to categories_path
end
failure.html do
set_collections
render "shared/edit"
end
end
end
|