debian-mirror-gitlab/app/controllers/admin/application_settings_controller.rb

67 lines
1.7 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Admin::ApplicationSettingsController < Admin::ApplicationController
2015-09-11 14:41:01 +05:30
before_action :set_application_setting
2015-04-26 12:48:37 +05:30
def show
end
def update
if @application_setting.update_attributes(application_setting_params)
redirect_to admin_application_settings_path,
notice: 'Application settings saved successfully'
else
render :show
end
end
private
def set_application_setting
@application_setting = ApplicationSetting.current
end
def application_setting_params
restricted_levels = params[:application_setting][:restricted_visibility_levels]
if restricted_levels.nil?
params[:application_setting][:restricted_visibility_levels] = []
else
restricted_levels.map! do |level|
level.to_i
end
end
2015-09-25 12:07:36 +05:30
import_sources = params[:application_setting][:import_sources]
if import_sources.nil?
params[:application_setting][:import_sources] = []
else
import_sources.map! do |source|
source.to_str
end
end
2015-04-26 12:48:37 +05:30
params.require(:application_setting).permit(
:default_projects_limit,
:default_branch_protection,
:signup_enabled,
:signin_enabled,
:gravatar_enabled,
:twitter_sharing_enabled,
:sign_in_text,
2015-09-25 12:07:36 +05:30
:help_page_text,
2015-04-26 12:48:37 +05:30
:home_page_url,
2015-09-11 14:41:01 +05:30
:after_sign_out_path,
2015-04-26 12:48:37 +05:30
:max_attachment_size,
2015-09-11 14:41:01 +05:30
:session_expire_delay,
:default_project_visibility,
:default_snippet_visibility,
:restricted_signup_domains_raw,
:version_check_enabled,
2015-10-24 18:46:33 +05:30
:admin_notification_email,
2015-09-11 14:41:01 +05:30
:user_oauth_applications,
2015-11-26 14:37:03 +05:30
:shared_runners_enabled,
:max_artifacts_size,
2015-09-11 14:41:01 +05:30
restricted_visibility_levels: [],
2015-09-25 12:07:36 +05:30
import_sources: []
2015-04-26 12:48:37 +05:30
)
end
end