Class: AppyantraAdmin::AdminSettingsController
Instance Method Summary
collapse
#add_breadcrumb, #asset_display_name, #current_breadcrumb, #get_object_name, #set_objects
Instance Method Details
#create ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 21
def create
type_object_name = get_object_name @type_class type_object = @type_class.new(params[type_object_name.to_sym])
AdminSetting.create({ name: @setting_name, display_name: @setting_name, entity_type: @entity_type, entity_id: type_object.id, group: @group }) if type_object.save
respond_to do |format|
format.html do |format|
flash[:notice] = "Setting was successfully added."
redirect_to main_app.settings_path
end
end
end
|
#destroy ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 50
def destroy
setting = AdminSetting.find(params[:id])
setting.entity.destroy
setting.destroy
respond_to do |format|
format.html do |format|
flash[:notice] = "Setting was successfully removed."
redirect_to main_app.settings_path
end
end
end
|
#edit ⇒ Object
64
65
66
67
68
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 64
def edit
@page_title = 'Edit'
current_breadcrumb @page_title
@setting = AdminSetting.find(params[:id])
end
|
#edit_mail_settings ⇒ Object
77
78
79
80
81
82
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 77
def edit_mail_settings
@page_title = 'Mail Settings'
current_breadcrumb @page_title
@mail_settings = AdminSetting.group_settings 'Mail'
render 'mail_settings'
end
|
#index ⇒ Object
10
11
12
13
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 10
def index
@page_title = 'Settings'
current_breadcrumb @page_title
end
|
#new ⇒ Object
15
16
17
18
19
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 15
def new
@page_title = 'New'
current_breadcrumb @page_title
@entity_object = @type_class.new
end
|
#new_mail_settings ⇒ Object
70
71
72
73
74
75
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 70
def new_mail_settings
@page_title = 'Mail Settings'
current_breadcrumb @page_title
@mail_settings = AdminSetting.initialize_group 'Mail', AppyantraAdmin.mail_settings_fields
render 'mail_settings'
end
|
#update ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'app/controllers/appyantra_admin/admin_settings_controller.rb', line 35
def update
setting = AdminSetting.find(params[:id])
type_object_name = get_object_name setting.entity.class
respond_to do |format|
if setting.entity.update_attributes(params[type_object_name.to_sym])
format.html do |format|
flash[:notice] = "Setting was successfully updated."
redirect_to main_app.settings_path
end
else
end
end
end
|
#update_mail_settings ⇒ Object