Class: AppyantraAdmin::AssetsController
Instance Method Summary
collapse
#add_breadcrumb, #asset_display_name, #current_breadcrumb, #get_object_name, #set_objects
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/appyantra_admin/assets_controller.rb', line 22
def create
asset_object_name = get_object_name @asset_class
@asset_object = @asset_class.new(params[asset_object_name.to_sym])
respond_to do |format|
if @asset_object.save
format.html do |format|
flash[:notice] = "#{@asset_name} was successfully created."
redirect_to "/appyantra_admin/assets/#{@asset_name}/#{@asset_object.id}/show"
end
else
end
end
end
|
#destroy ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/controllers/appyantra_admin/assets_controller.rb', line 54
def destroy
@asset_object = @asset_class.find(params[:id])
@asset_object.destroy
respond_to do |format|
format.html do |format|
flash[:notice] = "#{@asset_name} was successfully deleted."
redirect_to "/appyantra_admin/assets/#{@asset_name}"
end
end
end
|
#display ⇒ Object
74
75
76
77
78
79
|
# File 'app/controllers/appyantra_admin/assets_controller.rb', line 74
def display
@asset_object = @asset_class.find(params[:id])
respond_to do |format|
format.js
end
end
|
#edit ⇒ Object
66
67
68
69
70
71
72
|
# File 'app/controllers/appyantra_admin/assets_controller.rb', line 66
def edit
asset_id = params[:id]
@asset_object = @asset_class.find(asset_id)
add_breadcrumb(["#{asset_display_name @asset_object}", "/appyantra_admin/assets/#{@asset_name}/#{asset_id}/show"])
@page_title = 'Edit'
current_breadcrumb @page_title
end
|
#new ⇒ Object
16
17
18
19
20
|
# File 'app/controllers/appyantra_admin/assets_controller.rb', line 16
def new
@page_title = 'New'
current_breadcrumb @page_title
@asset_object = @asset_class.new
end
|
#show ⇒ Object
9
10
11
12
13
14
|
# File 'app/controllers/appyantra_admin/assets_controller.rb', line 9
def show
@page_title = @asset_name.pluralize
current_breadcrumb @page_title
@asset_objects = @asset_class.all
@asset_object = @asset_class.find(params[:id]) if params[:id]
end
|
#update ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/controllers/appyantra_admin/assets_controller.rb', line 39
def update
@asset_object = @asset_class.find(params[:id])
asset_object_name = @asset_class.table_name.singularize
respond_to do |format|
if @asset_object.update_attributes(params[asset_object_name.to_sym])
format.html do |format|
flash[:notice] = "#{@asset_name} was successfully updated."
redirect_to "/appyantra_admin/assets/#{@asset_name}/#{@asset_object.id}/show"
end
else
end
end
end
|