提交 abff0399 编写于 作者: D Dmitriy Zaporozhets

Fix project labels scope

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