Commit 3b20c89005686c04966d749239ce312b65bd8f59
1 parent
a767c133
Exists in
master
and in
4 other branches
Add visibility filter to Dashboard#projects
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
29 additions
and
4 deletions
Show diff stats
app/assets/stylesheets/sections/dashboard.scss
... | ... | @@ -100,3 +100,21 @@ |
100 | 100 | padding: 2px 5px; |
101 | 101 | } |
102 | 102 | } |
103 | + | |
104 | +.project-access-icon { | |
105 | + margin-left: 10px; | |
106 | + float: left; | |
107 | + margin-right: 15px; | |
108 | + font-size: 20px; | |
109 | + margin-bottom: 15px; | |
110 | + border: 1px solid #EEE; | |
111 | + padding: 8px 12px; | |
112 | + border-radius: 50px; | |
113 | + background: #f5f5f5; | |
114 | + width: 16px; | |
115 | + text-align: center; | |
116 | + | |
117 | + i { | |
118 | + color: #BBB; | |
119 | + } | |
120 | +} | ... | ... |
app/controllers/dashboard_controller.rb
... | ... | @@ -40,6 +40,7 @@ class DashboardController < ApplicationController |
40 | 40 | end |
41 | 41 | |
42 | 42 | @projects = @projects.where(namespace_id: Group.find_by_name(params[:group])) if params[:group].present? |
43 | + @projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present? | |
43 | 44 | @projects = @projects.includes(:namespace).sorted_by_activity |
44 | 45 | |
45 | 46 | @labels = current_user.authorized_projects.tags_on(:labels) | ... | ... |
app/views/dashboard/projects.html.haml
... | ... | @@ -26,6 +26,14 @@ |
26 | 26 | %span.pull-right |
27 | 27 | = current_user.owned_projects.count |
28 | 28 | |
29 | + %fieldset | |
30 | + %legend Visibility | |
31 | + %ul.bordered-list.visibility-filter | |
32 | + - Gitlab::VisibilityLevel.values.each do |level| | |
33 | + %li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' } | |
34 | + = link_to projects_dashboard_path(visibility_level: level) do | |
35 | + = visibility_level_icon(level) | |
36 | + = visibility_level_label(level) | |
29 | 37 | |
30 | 38 | - if @groups.present? |
31 | 39 | %fieldset |
... | ... | @@ -56,12 +64,10 @@ |
56 | 64 | - @projects.each do |project| |
57 | 65 | %li.my-project-row |
58 | 66 | %h4.project-title |
67 | + .project-access-icon | |
68 | + = visibility_level_icon(project.visibility_level) | |
59 | 69 | = link_to project_path(project), class: dom_class(project) do |
60 | 70 | = project.name_with_namespace |
61 | - - unless project.private? | |
62 | - %small.access-icon | |
63 | - = visibility_level_icon(project.visibility_level) | |
64 | - = visibility_level_label(project.visibility_level) | |
65 | 71 | |
66 | 72 | - if current_user.can_leave_project?(project) |
67 | 73 | .pull-right | ... | ... |