diff options
author | Luke Bennett <lbennett@gitlab.com> | 2019-06-28 22:38:26 +0100 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-07-15 13:00:55 -0300 |
commit | 9b40fc7416c55625f46139f89f0dff3b028a30c0 (patch) | |
tree | 91ab62a693b74a8637ce1b5cd653c40bde0897c6 /app/helpers | |
parent | 96277bb9d61b5aaf5c2edc388c5eabfc743478f0 (diff) | |
download | gitlab-ce-9b40fc7416c55625f46139f89f0dff3b028a30c0.tar.gz |
Hide restricted and disallowed visibility radioshide-restricted-visibility-radio
Show a message if many levels are restricted and a
different message if all levels are restricted.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/visibility_level_helper.rb | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index b318b27992a..2bd803c0177 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -65,20 +65,6 @@ module VisibilityLevelHelper end end - def restricted_visibility_level_description(level) - level_name = Gitlab::VisibilityLevel.level_name(level) - _("%{level_name} visibility has been restricted by the administrator.") % { level_name: level_name.capitalize } - end - - def disallowed_visibility_level_description(level, form_model) - case form_model - when Project - disallowed_project_visibility_level_description(level, form_model) - when Group - disallowed_group_visibility_level_description(level, form_model) - end - end - # Note: these messages closely mirror the form validation strings found in the project # model and any changes or additons to these may also need to be made there. def disallowed_project_visibility_level_description(level, project) @@ -181,6 +167,14 @@ module VisibilityLevelHelper [requested_level, max_allowed_visibility_level(form_model)].min end + def multiple_visibility_levels_restricted? + restricted_visibility_levels.many? # rubocop: disable CodeReuse/ActiveRecord + end + + def all_visibility_levels_restricted? + Gitlab::VisibilityLevel.values == restricted_visibility_levels + end + private def max_allowed_visibility_level(form_model) |