Commit 133d78229ec092cb5360d600b62286c7320869ff
1 parent
edf41005
Exists in
master
and in
4 other branches
Dashboard -> projects -> filtering by project label
Showing
4 changed files
with
23 additions
and
0 deletions
Show diff stats
app/assets/stylesheets/gitlab_bootstrap/lists.scss
app/controllers/dashboard_controller.rb
| ... | ... | @@ -34,6 +34,7 @@ class DashboardController < ApplicationController |
| 34 | 34 | @projects |
| 35 | 35 | end |
| 36 | 36 | |
| 37 | + @projects = @projects.tagged_with(params[:label]) if params[:label].present? | |
| 37 | 38 | @projects = @projects.search(params[:search]) if params[:search].present? |
| 38 | 39 | @projects = @projects.page(params[:page]).per(30) |
| 39 | 40 | end | ... | ... |
app/helpers/projects_helper.rb
| ... | ... | @@ -3,6 +3,10 @@ module ProjectsHelper |
| 3 | 3 | "You are going to remove #{user.name} from #{project.name} project team. Are you sure?" |
| 4 | 4 | end |
| 5 | 5 | |
| 6 | + def projects_labels | |
| 7 | + Project.tag_counts_on(:labels).map(&:name) | |
| 8 | + end | |
| 9 | + | |
| 6 | 10 | def link_to_project project |
| 7 | 11 | link_to project do |
| 8 | 12 | title = content_tag(:strong, project.name) | ... | ... |
app/views/dashboard/projects.html.haml
| ... | ... | @@ -20,6 +20,15 @@ |
| 20 | 20 | = nav_tab :scope, 'joined' do |
| 21 | 21 | = link_to "Joined", projects_dashboard_path(scope: 'joined') |
| 22 | 22 | |
| 23 | + %p.light Filter by label: | |
| 24 | + %ul.bordered-list | |
| 25 | + - projects_labels.each do |label| | |
| 26 | + %li{ class: (label == params[:label]) ? 'active' : 'light' } | |
| 27 | + = link_to projects_dashboard_path(scope: params[:scope], label: label) do | |
| 28 | + %i.icon-tag | |
| 29 | + = label | |
| 30 | + | |
| 31 | + | |
| 23 | 32 | .span9 |
| 24 | 33 | = form_tag projects_dashboard_path, method: 'get' do |
| 25 | 34 | %fieldset.dashboard-search-filter | ... | ... |