Skip to content

Commit

Permalink
Improve UX of project visiblity level. Improve "Public Access" help page
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
  • Loading branch information
dzaporozhets committed Nov 27, 2013
1 parent fa7d624 commit 4091322
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 27 deletions.
9 changes: 8 additions & 1 deletion app/assets/stylesheets/sections/projects.scss
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
border-bottom: 1px solid #DDD; border-bottom: 1px solid #DDD;
padding-bottom: 25px; padding-bottom: 25px;
margin-bottom: 30px; margin-bottom: 30px;

&.empty-project { &.empty-project {
border-bottom: 0px; border-bottom: 0px;
padding-bottom: 15px; padding-bottom: 15px;
Expand Down Expand Up @@ -112,6 +112,13 @@
&.restricted { &.restricted {
color: #888; color: #888;
} }

label {
float: none;
padding: 0;
margin: 0;
text-align: left;
}
} }
.info { .info {
display: block; display: block;
Expand Down
14 changes: 4 additions & 10 deletions app/helpers/visibility_level_helper.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@ def visibility_level_description(level)
haml_concat "Project access must be granted explicitly for each user." haml_concat "Project access must be granted explicitly for each user."
when Gitlab::VisibilityLevel::INTERNAL when Gitlab::VisibilityLevel::INTERNAL
haml_concat "The project can be cloned by" haml_concat "The project can be cloned by"
haml_tag :em, "any logged in user." haml_concat "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 when Gitlab::VisibilityLevel::PUBLIC
haml_concat "The project can be cloned" haml_concat "The project can be cloned"
haml_tag :em, "without any" haml_concat "without any"
haml_concat "authentication." 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
end end
Expand All @@ -48,8 +42,8 @@ def visibility_level_icon(level)
def visibility_level_label(level) def visibility_level_label(level)
Project.visibility_levels.key(level) Project.visibility_levels.key(level)
end end

def restricted_visibility_levels def restricted_visibility_levels
current_user.is_admin? ? [] : gitlab_config.restricted_visibility_levels current_user.is_admin? ? [] : gitlab_config.restricted_visibility_levels
end end
end end
47 changes: 37 additions & 10 deletions app/views/help/public_access.html.haml
Original file line number Original file line Diff line number Diff line change
@@ -1,21 +1,48 @@
= render layout: 'help/layout' do = render layout: 'help/layout' do
%h3.page-title Public Access %h3.page-title Public Access


%p %p.slead
GitLab allows you to open selected projects to be accessed publicly or internally. GitLab allows you to open selected projects to be accessed
Projects with either of these visibility levels will be listed in the #{link_to "public access directory", public_root_path}. Internal projects will only be available to authenticated users. %strong publicly
%p or
%strong internally
\.
%br
Projects with either of these visibility levels will be listed in the #{link_to "public access directory", public_root_path}.
%br
Internal projects will only be available to authenticated users.

%hr
%h4
= public_icon = public_icon
Public projects will be cloneable &nbsp;
%em without any Public projects
authentication.
%p %p
Public project can be cloned
%strong without any
authentication.
%br
It will also be listed on the #{link_to "public access directory", public_root_path}."
%br
%strong Any logged in user
will have #{link_to "Guest", help_permissions_path} permissions on the repository."

%hr
%h4
= internal_icon = internal_icon
Internal projects will be cloneable by &nbsp;
%em any authenticated user. Internal projects
%p
Internal project can be cloned by any logged in user.
%br
It will also be listed on the #{link_to "public access directory", public_root_path} for logged in users.
%br
Any logged in user will have #{link_to "Guest", help_permissions_path} permissions on the repository.


%hr

%h4 How to change project visibility
%ol %ol
%li Go to your project dashboard %li Go to your project dashboard
%li Click on the "Edit" tab %li Click on the "Edit" tab
%li Change "Visibility Level" %li Change "Visibility Level"

15 changes: 9 additions & 6 deletions app/views/projects/_visibility_level.html.haml
Original file line number Original file line Diff line number Diff line change
@@ -1,15 +1,18 @@
.control-group.project-visibility-level-holder .control-group.project-visibility-level-holder
= f.label :visibility_level, "Visibility Level" = f.label :visibility_level do
Visibility Level
= link_to "(?)", help_public_access_path
- if can_change_visibility_level - if can_change_visibility_level
- Gitlab::VisibilityLevel.values.each do |level| - Gitlab::VisibilityLevel.values.each do |level|
- restricted = restricted_visibility_levels.include?(level) - restricted = restricted_visibility_levels.include?(level)
.controls .controls
= f.radio_button :visibility_level, level, checked: (visibility_level == level), disabled: restricted = f.radio_button :visibility_level, level, checked: (visibility_level == level), disabled: restricted
%span.descr{:class => ("restricted" if restricted)} %span.descr{:class => ("restricted" if restricted)}
= visibility_level_icon(level) = label :project_visibility_level, level do
%strong = visibility_level_icon(level)
= visibility_level_label(level) %strong
= visibility_level_description(level) = visibility_level_label(level)
.light= visibility_level_description(level)
- unless restricted_visibility_levels.empty? - unless restricted_visibility_levels.empty?
.controls .controls
%span.info %span.info
Expand All @@ -20,4 +23,4 @@
= visibility_level_icon(visibility_level) = visibility_level_icon(visibility_level)
%strong %strong
= visibility_level_label(visibility_level) = visibility_level_label(visibility_level)
= visibility_level_description(visibility_level) .light= visibility_level_description(visibility_level)

0 comments on commit 4091322

Please sign in to comment.