Patch #30071

Show parent projects when filtering in the project jump box

Added by Anders Thomsen almost 3 years ago. Updated over 2 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:


Target version:Candidate for next major release


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.

redmine-show-parent-projects-jump-box.png (8.56 KB) Anders Thomsen, 2018-12-01 17:12

0002-Mark-current-project-when-filtering-project-jump-box.patch Magnifier (2.14 KB) Anders Thomsen, 2018-12-01 17:20

0001-show-ascendant-parent-projects-when-filtering-projec.patch Magnifier (5 KB) Anders Thomsen, 2018-12-01 17:20

0003-Mark-nodes-with-matching-child-in-filtered-project-j.patch Magnifier (840 Bytes) Anders Thomsen, 2018-12-03 18:10


#1 Updated by Go MAEDA almost 3 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.

#2 Updated by Anders Thomsen almost 3 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?

#3 Updated by Go MAEDA almost 3 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.

#4 Updated by Marius BALTEANU almost 3 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.

#5 Updated by Jean-Philippe Lang over 2 years ago

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

Also available in: Atom PDF