Class: Adminpanel::CategoriesController
Instance Method Summary
collapse
#twitter_publish
#fb_choose_page, #fb_publish, #fb_save_token
#move_better, #move_worst
#show
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
#create ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 19
def create
merge_params
create! do |success, failure|
success.html do
flash[:success] = I18n.t("action.save_success")
redirect_to categories_path
end
failure.html do
set_collections
render 'shared/new'
end
success.js do
if params[:currentcontroller].to_s == 'adminpanel/categories'
render 'create', :locals => {:category => resource}
elsif params[:belongs_request].present?
render 'shared/create_belongs_to'
else
render 'shared/create_has_many'
end
end
failure.js do
set_collections
render "new"
end
end
end
|
#destroy ⇒ Object
70
71
72
73
74
75
76
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 70
def destroy
destroy! do |format|
format.html do
redirect_to categories_path
end
end
end
|
#edit ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 47
def edit
edit! do |format|
format.html do
set_collections
render "shared/edit"
end
end
end
|
#index ⇒ Object
4
5
6
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 4
def index
@categories = Category.all
end
|
#new ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 8
def new
set_collections
new! do |format|
format.html { render "shared/new" }
format.js do
render
end
end
end
|
#update ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'app/controllers/adminpanel/categories_controller.rb', line 56
def update
update! do |success, failure|
success.html do
flash[:success] = I18n.t("action.save_success")
redirect_to categories_path
end
failure.html do
set_collections
render "shared/edit"
end
end
end
|