2013-11-06 10:13:21 -05:00
|
|
|
module VisibilityLevelHelper
|
|
|
|
def visibility_level_color(level)
|
|
|
|
case level
|
|
|
|
when Gitlab::VisibilityLevel::PRIVATE
|
2014-06-03 07:49:50 -04:00
|
|
|
'vs-private'
|
2013-11-06 10:13:21 -05:00
|
|
|
when Gitlab::VisibilityLevel::INTERNAL
|
2014-06-03 07:49:50 -04:00
|
|
|
'vs-internal'
|
2013-11-06 10:13:21 -05:00
|
|
|
when Gitlab::VisibilityLevel::PUBLIC
|
2014-06-03 07:49:50 -04:00
|
|
|
'vs-public'
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def visibility_level_description(level)
|
|
|
|
capture_haml do
|
|
|
|
haml_tag :span do
|
|
|
|
case level
|
|
|
|
when Gitlab::VisibilityLevel::PRIVATE
|
|
|
|
haml_concat "Project access must be granted explicitly for each user."
|
|
|
|
when Gitlab::VisibilityLevel::INTERNAL
|
|
|
|
haml_concat "The project can be cloned by"
|
2013-11-27 06:13:33 -05:00
|
|
|
haml_concat "any logged in user."
|
2013-11-06 10:13:21 -05:00
|
|
|
when Gitlab::VisibilityLevel::PUBLIC
|
|
|
|
haml_concat "The project can be cloned"
|
2013-11-27 06:13:33 -05:00
|
|
|
haml_concat "without any"
|
2013-11-06 10:13:21 -05:00
|
|
|
haml_concat "authentication."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def visibility_level_icon(level)
|
|
|
|
case level
|
|
|
|
when Gitlab::VisibilityLevel::PRIVATE
|
|
|
|
private_icon
|
|
|
|
when Gitlab::VisibilityLevel::INTERNAL
|
|
|
|
internal_icon
|
|
|
|
when Gitlab::VisibilityLevel::PUBLIC
|
|
|
|
public_icon
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def visibility_level_label(level)
|
|
|
|
Project.visibility_levels.key(level)
|
|
|
|
end
|
2013-11-27 06:13:33 -05:00
|
|
|
|
2013-11-06 10:13:21 -05:00
|
|
|
def restricted_visibility_levels
|
|
|
|
current_user.is_admin? ? [] : gitlab_config.restricted_visibility_levels
|
|
|
|
end
|
2013-11-27 06:13:33 -05:00
|
|
|
end
|