Add images and documents settings to admin panel
This commit is contained in:
@@ -14,6 +14,7 @@ class Admin::SettingsController < Admin::BaseController
|
||||
@participation_processes_settings = all_settings["process"]
|
||||
@map_configuration_settings = all_settings["map"]
|
||||
@proposals_settings = all_settings["proposals"]
|
||||
@uploads_settings = all_settings["uploads"]
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -29,10 +30,24 @@ class Admin::SettingsController < Admin::BaseController
|
||||
redirect_to admin_settings_path, notice: t("admin.settings.index.map.flash.update")
|
||||
end
|
||||
|
||||
def update_content_types
|
||||
setting = Setting.find(params[:id])
|
||||
group = setting.content_type_group
|
||||
mime_type_values = content_type_params.keys.map do |content_type|
|
||||
Setting.mime_types[group][content_type]
|
||||
end
|
||||
setting.update value: mime_type_values.join(" ")
|
||||
redirect_to admin_settings_path, notice: t("admin.settings.flash.updated")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def settings_params
|
||||
params.require(:setting).permit(:value)
|
||||
end
|
||||
|
||||
def content_type_params
|
||||
params.permit(:jpg, :png, :gif, :pdf, :doc, :docx, :xls, :xlsx, :csv, :zip)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user