Commit 4091322dba7ee3b94de9ad0b8b061622ba1e468c

Authored by Dmitriy Zaporozhets
1 parent fa7d6249

Improve UX of project visiblity level. Improve "Public Access" help page

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/stylesheets/sections/projects.scss
... ... @@ -18,7 +18,7 @@
18 18 border-bottom: 1px solid #DDD;
19 19 padding-bottom: 25px;
20 20 margin-bottom: 30px;
21   -
  21 +
22 22 &.empty-project {
23 23 border-bottom: 0px;
24 24 padding-bottom: 15px;
... ... @@ -112,6 +112,13 @@
112 112 &.restricted {
113 113 color: #888;
114 114 }
  115 +
  116 + label {
  117 + float: none;
  118 + padding: 0;
  119 + margin: 0;
  120 + text-align: left;
  121 + }
115 122 }
116 123 .info {
117 124 display: block;
... ...
app/helpers/visibility_level_helper.rb
... ... @@ -18,17 +18,11 @@ module VisibilityLevelHelper
18 18 haml_concat "Project access must be granted explicitly for each user."
19 19 when Gitlab::VisibilityLevel::INTERNAL
20 20 haml_concat "The project can be cloned by"
21   - haml_tag :em, "any logged in user."
22   - haml_concat "It will also be listed on the #{link_to "public access directory", public_root_path} for logged in users."
23   - haml_tag :em, "Any logged in user"
24   - haml_concat "will have #{link_to "Guest", help_permissions_path} permissions on the repository."
  21 + haml_concat "any logged in user."
25 22 when Gitlab::VisibilityLevel::PUBLIC
26 23 haml_concat "The project can be cloned"
27   - haml_tag :em, "without any"
  24 + haml_concat "without any"
28 25 haml_concat "authentication."
29   - haml_concat "It will also be listed on the #{link_to "public access directory", public_root_path}."
30   - haml_tag :em, "Any logged in user"
31   - haml_concat "will have #{link_to "Guest", help_permissions_path} permissions on the repository."
32 26 end
33 27 end
34 28 end
... ... @@ -48,8 +42,8 @@ module VisibilityLevelHelper
48 42 def visibility_level_label(level)
49 43 Project.visibility_levels.key(level)
50 44 end
51   -
  45 +
52 46 def restricted_visibility_levels
53 47 current_user.is_admin? ? [] : gitlab_config.restricted_visibility_levels
54 48 end
55   -end
56 49 \ No newline at end of file
  50 +end
... ...
app/views/help/public_access.html.haml
1 1 = render layout: 'help/layout' do
2 2 %h3.page-title Public Access
3 3  
4   - %p
5   - GitLab allows you to open selected projects to be accessed publicly or internally.
6   - 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.
7   - %p
  4 + %p.slead
  5 + GitLab allows you to open selected projects to be accessed
  6 + %strong publicly
  7 + or
  8 + %strong internally
  9 + \.
  10 + %br
  11 + Projects with either of these visibility levels will be listed in the #{link_to "public access directory", public_root_path}.
  12 + %br
  13 + Internal projects will only be available to authenticated users.
  14 +
  15 + %hr
  16 + %h4
8 17 = public_icon
9   - Public projects will be cloneable
10   - %em without any
11   - authentication.
  18 + &nbsp;
  19 + Public projects
12 20 %p
  21 + Public project can be cloned
  22 + %strong without any
  23 + authentication.
  24 + %br
  25 + It will also be listed on the #{link_to "public access directory", public_root_path}."
  26 + %br
  27 + %strong Any logged in user
  28 + will have #{link_to "Guest", help_permissions_path} permissions on the repository."
  29 +
  30 + %hr
  31 + %h4
13 32 = internal_icon
14   - Internal projects will be cloneable by
15   - %em any authenticated user.
  33 + &nbsp;
  34 + Internal projects
  35 + %p
  36 + Internal project can be cloned by any logged in user.
  37 + %br
  38 + It will also be listed on the #{link_to "public access directory", public_root_path} for logged in users.
  39 + %br
  40 + Any logged in user will have #{link_to "Guest", help_permissions_path} permissions on the repository.
16 41  
  42 + %hr
  43 +
  44 + %h4 How to change project visibility
17 45 %ol
18 46 %li Go to your project dashboard
19 47 %li Click on the "Edit" tab
20 48 %li Change "Visibility Level"
21   -
... ...
app/views/projects/_visibility_level.html.haml
1 1 .control-group.project-visibility-level-holder
2   - = f.label :visibility_level, "Visibility Level"
  2 + = f.label :visibility_level do
  3 + Visibility Level
  4 + = link_to "(?)", help_public_access_path
3 5 - if can_change_visibility_level
4 6 - Gitlab::VisibilityLevel.values.each do |level|
5 7 - restricted = restricted_visibility_levels.include?(level)
6 8 .controls
7 9 = f.radio_button :visibility_level, level, checked: (visibility_level == level), disabled: restricted
8 10 %span.descr{:class => ("restricted" if restricted)}
9   - = visibility_level_icon(level)
10   - %strong
11   - = visibility_level_label(level)
12   - = visibility_level_description(level)
  11 + = label :project_visibility_level, level do
  12 + = visibility_level_icon(level)
  13 + %strong
  14 + = visibility_level_label(level)
  15 + .light= visibility_level_description(level)
13 16 - unless restricted_visibility_levels.empty?
14 17 .controls
15 18 %span.info
... ... @@ -20,4 +23,4 @@
20 23 = visibility_level_icon(visibility_level)
21 24 %strong
22 25 = visibility_level_label(visibility_level)
23   - = visibility_level_description(visibility_level)
24 26 \ No newline at end of file
  27 + .light= visibility_level_description(visibility_level)
... ...