Patch #30071


Show parent projects when filtering in the project jump box

Added by Anders Thomsen over 5 years ago. Updated almost 5 years ago.

Start date:
Due date:
% Done:


Estimated time:


Attached patch returns parents projects to matched projects when filtering in the project jump box (improves #23310)

It looks like this:

This solves a problem when having several projects with identical or similar names and project hierarchy is used to distinguish between them. E.g. when using one parent project as a container for business projects and another for the software development part of same project.

Also included is a related patch that marks the current project.


Actions #1

Updated by Go MAEDA over 5 years ago

  • Status changed from New to Needs feedback

It is an interesting improvement.

I tried out the patch. But parent projects were displayed in not grey but black. And the checkmark for the current project was not displayed even after applying the patch 0002-Mark-current-project-when-filtering-project-jump-box.patch.

Could you check the patch again? My browsers are Firefox and Chrome for Mac.

Actions #2

Updated by Anders Thomsen over 5 years ago

The original patch uses on font-weight to grey out the non-matched parent nodes. This relies on the used font to provide the font-style which often it does not. Just realised this as I tested on Windows.

Supplied patch uses "color" instead.

As for not marking the currently selected project, I'm not sure what causes this. I have just copied the functionality from the existing logic that marks the current project on the first page load (i.e. not filtering). Does that work for you?

Actions #3

Updated by Go MAEDA over 5 years ago

  • Status changed from Needs feedback to New
  • Target version set to 4.1.0

LGTM. Setting the target version to 4.1.0.

Actions #4

Updated by Marius BÄ‚LTEANU over 5 years ago

I like the idea of the patch, but I'm worried about the proposed implementation that retrieves every time all the projects visible to the user (ignoring the q parameter). That means more time required to return the project searched by the user on instances with a lot of projects.

The change about I speak is the following one:

diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index a43038a..9fbddf2 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -66,10 +66,14 @@ class ProjectsController < ApplicationController
     respond_to do |format|
       format.js {
         if params[:q].present?
-          @projects =[:q]).to_a
+          @projects = Project.visible.to_a
           @projects = User.current.projects.to_a

Maybe is it enough to show only the parent project? If not, at least we should confirm the proposed change with Jean-Philippe.

Actions #5

Updated by Jean-Philippe Lang almost 5 years ago

  • Target version changed from 4.1.0 to Candidate for next major release

Also available in: Atom PDF