2015-01-08 08:22:50 +00:00
|
|
|
module ApplicationSettingsHelper
|
2015-01-08 22:26:43 +00:00
|
|
|
def gravatar_enabled?
|
|
|
|
current_application_settings.gravatar_enabled?
|
|
|
|
end
|
|
|
|
|
2015-01-08 17:53:35 +00:00
|
|
|
def signup_enabled?
|
2015-01-08 22:26:43 +00:00
|
|
|
current_application_settings.signup_enabled?
|
2015-01-08 17:53:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def signin_enabled?
|
2015-01-08 22:26:43 +00:00
|
|
|
current_application_settings.signin_enabled?
|
2015-01-08 17:53:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def extra_sign_in_text
|
|
|
|
current_application_settings.sign_in_text
|
|
|
|
end
|
2015-03-01 15:06:46 +00:00
|
|
|
|
2015-05-29 11:29:16 +00:00
|
|
|
def user_oauth_applications?
|
|
|
|
current_application_settings.user_oauth_applications
|
|
|
|
end
|
|
|
|
|
2016-02-02 00:25:00 +00:00
|
|
|
def askimet_enabled?
|
|
|
|
current_application_settings.akismet_enabled?
|
|
|
|
end
|
|
|
|
|
2015-03-01 15:06:46 +00:00
|
|
|
# Return a group of checkboxes that use Bootstrap's button plugin for a
|
|
|
|
# toggle button effect.
|
|
|
|
def restricted_level_checkboxes(help_block_id)
|
|
|
|
Gitlab::VisibilityLevel.options.map do |name, level|
|
|
|
|
checked = restricted_visibility_levels(true).include?(level)
|
2015-07-10 20:41:52 +00:00
|
|
|
css_class = 'btn'
|
2015-03-01 15:06:46 +00:00
|
|
|
css_class += ' active' if checked
|
|
|
|
checkbox_name = 'application_setting[restricted_visibility_levels][]'
|
|
|
|
|
|
|
|
label_tag(checkbox_name, class: css_class) do
|
2015-03-11 00:21:09 +00:00
|
|
|
check_box_tag(checkbox_name, level, checked,
|
|
|
|
autocomplete: 'off',
|
2015-03-01 15:06:46 +00:00
|
|
|
'aria-describedby' => help_block_id) + name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-08-12 06:13:20 +00:00
|
|
|
|
|
|
|
# Return a group of checkboxes that use Bootstrap's button plugin for a
|
|
|
|
# toggle button effect.
|
|
|
|
def import_sources_checkboxes(help_block_id)
|
|
|
|
Gitlab::ImportSources.options.map do |name, source|
|
|
|
|
checked = current_application_settings.import_sources.include?(source)
|
|
|
|
css_class = 'btn'
|
|
|
|
css_class += ' active' if checked
|
|
|
|
checkbox_name = 'application_setting[import_sources][]'
|
|
|
|
|
|
|
|
label_tag(checkbox_name, class: css_class) do
|
|
|
|
check_box_tag(checkbox_name, source, checked,
|
|
|
|
autocomplete: 'off',
|
|
|
|
'aria-describedby' => help_block_id) + name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-01-08 08:22:50 +00:00
|
|
|
end
|