Commit abff0399 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix project labels scope

parent de12eba2
...@@ -37,6 +37,8 @@ class DashboardController < ApplicationController ...@@ -37,6 +37,8 @@ class DashboardController < ApplicationController
@projects = @projects.tagged_with(params[:label]) if params[:label].present? @projects = @projects.tagged_with(params[:label]) if params[:label].present?
@projects = @projects.search(params[:search]) if params[:search].present? @projects = @projects.search(params[:search]) if params[:search].present?
@projects = @projects.page(params[:page]).per(30) @projects = @projects.page(params[:page]).per(30)
@labels = Project.where(id: @projects.map(&:id)).tags_on(:labels)
end end
# Get authored or assigned open merge requests # Get authored or assigned open merge requests
......
...@@ -3,10 +3,6 @@ module ProjectsHelper ...@@ -3,10 +3,6 @@ module ProjectsHelper
"You are going to remove #{user.name} from #{project.name} project team. Are you sure?" "You are going to remove #{user.name} from #{project.name} project team. Are you sure?"
end end
def projects_labels
Project.tag_counts_on(:labels).map(&:name)
end
def link_to_project project def link_to_project project
link_to project do link_to project do
title = content_tag(:strong, project.name) title = content_tag(:strong, project.name)
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
%p.light Filter by label: %p.light Filter by label:
%ul.bordered-list %ul.bordered-list
- projects_labels.each do |label| - @labels.each do |label|
%li{ class: (label == params[:label]) ? 'active' : 'light' } %li{ class: (label.name == params[:label]) ? 'active' : 'light' }
= link_to projects_dashboard_path(scope: params[:scope], label: label) do = link_to projects_dashboard_path(scope: params[:scope], label: label.name) do
%i.icon-tag %i.icon-tag
= label = label.name
.span9 .span9
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment