docbrown/app/controllers/internal/configs_controller.rb
rhymes c1aaf53a40 Add SiteConfig to internal and enable "main_social_image" (#4831) [deploy]
* Redirect /internal to /internal/articles avoiding annoying 404

* Set the navbar on two rows

* Add :main_social_image to SiteConfig and to the internal view

* Add simple tests

* Ameliorate the UI
2019-11-18 18:19:20 -05:00

19 lines
513 B
Ruby

class Internal::ConfigsController < Internal::ApplicationController
layout "internal"
def show; end
def create
config_params.keys.each do |key|
SiteConfig.public_send("#{key}=", config_params[key].strip) unless config_params[key].nil?
end
redirect_to internal_config_path, notice: "Site configuration was successfully updated."
end
private
def config_params
# put this stuff in the policy or in the model
params.require(:site_config).permit(:main_social_image)
end
end