@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
"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)
%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