diff options
author | Jason Hollingsworth <jhworth.developer@gmail.com> | 2013-11-06 09:13:21 -0600 |
---|---|---|
committer | Jason Hollingsworth <jhworth.developer@gmail.com> | 2013-11-26 22:22:07 -0600 |
commit | d9bb4230cc3aa161876df821c34d8e9c53d2e7a6 (patch) | |
tree | d9923bbf4ebe3f6cf96f71cdcfe4c07cc94b6752 /app/helpers/visibility_level_helper.rb | |
parent | 51b5509bacdfba1d3ca84a4b56c6bd21942f1d2e (diff) | |
download | gitlab-ce-d9bb4230cc3aa161876df821c34d8e9c53d2e7a6.tar.gz |
Adding authenticated public mode (internal).
Added visibility_level icons to project view (rather than just text).
Added public projects to search results.
Added ability to restrict visibility levels standard users can set.
Diffstat (limited to 'app/helpers/visibility_level_helper.rb')
-rw-r--r-- | app/helpers/visibility_level_helper.rb | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb new file mode 100644 index 00000000000..5cec7f8b4e6 --- /dev/null +++ b/app/helpers/visibility_level_helper.rb @@ -0,0 +1,55 @@ +module VisibilityLevelHelper + def visibility_level_color(level) + case level + when Gitlab::VisibilityLevel::PRIVATE + 'cgreen' + when Gitlab::VisibilityLevel::INTERNAL + 'camber' + when Gitlab::VisibilityLevel::PUBLIC + 'cblue' + 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" + haml_tag :em, "any logged in user." + haml_concat "It will also be listed on the #{link_to "public access directory", public_root_path} for logged in users." + haml_tag :em, "Any logged in user" + haml_concat "will have #{link_to "Guest", help_permissions_path} permissions on the repository." + when Gitlab::VisibilityLevel::PUBLIC + haml_concat "The project can be cloned" + haml_tag :em, "without any" + haml_concat "authentication." + haml_concat "It will also be listed on the #{link_to "public access directory", public_root_path}." + haml_tag :em, "Any logged in user" + haml_concat "will have #{link_to "Guest", help_permissions_path} permissions on the repository." + 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 + + def restricted_visibility_levels + current_user.is_admin? ? [] : gitlab_config.restricted_visibility_levels + end +end
\ No newline at end of file |