Add images and documents settings to admin panel

This commit is contained in:
Julian Herrero
2019-05-16 16:14:40 +02:00
parent 35cd26c117
commit 220bfb065a
13 changed files with 146 additions and 2 deletions

View File

@@ -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