-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[74625] Make project hierarchy collapsable in the global project selector #23137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
HDinger
merged 12 commits into
dev
from
feature/74625-make-project-hierarchy-collapsable-in-the-global-project-selector
Jun 8, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
09bd037
Use new async FilterableTreeView for global project selector
HDinger b03879a
Remove replaced angular component
HDinger ade8b02
Fine tune sorting and expansion state of the new project selector
HDinger c801a94
Update primer to 0.86.1
HDinger 3b4ef4d
Add workspace information and filter results hierarchy information to…
HDinger b1939e9
Merge remote-tracking branch 'origin/dev' into feature/74625-make-pro…
HDinger 8a6a3e6
Include review feedback: Harmonize I18n keys, fix visible scope, use …
HDinger 628bb85
Add a turboFrame in the project select overlay to only load the proje…
HDinger 6332f01
Restore BIM tab styles which were broken for a while already but the …
HDinger d2f3bd2
Merge remote-tracking branch 'origin/dev' into feature/74625-make-pro…
HDinger dc7491e
Clarify spec expectation
HDinger 0627cd4
Merge remote-tracking branch 'origin/dev' into feature/74625-make-pro…
HDinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <%#-- copyright | ||
| OpenProject is an open source project management software. | ||
| Copyright (C) the OpenProject GmbH | ||
|
|
||
| This program is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU General Public License version 3. | ||
|
|
||
| OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| Copyright (C) 2010-2013 the ChiliProject Team | ||
|
|
||
| This program is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU General Public License | ||
| as published by the Free Software Foundation; either version 2 | ||
| of the License, or (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
|
||
| See COPYRIGHT and LICENSE files for more details. | ||
|
|
||
| ++#%> | ||
|
|
||
| <%= render( | ||
| Primer::Alpha::Overlay.new( | ||
| title: t(".title"), | ||
| visually_hide_title: true, | ||
| anchor_side: :outside_bottom, | ||
| anchor_align: :start, | ||
| size: :medium_portrait, | ||
| padding: :none | ||
| ) | ||
| ) do |overlay| %> | ||
| <% overlay.with_show_button( | ||
| id: "projects-menu", | ||
| classes: "op-project-select--trigger-button", | ||
| scheme: :invisible, | ||
| data: { "test-selector": "op-projects-menu" }, | ||
| accesskey: "5" | ||
| ) do |button| %> | ||
| <%= trigger_label %> | ||
| <% button.with_trailing_visual_icon(icon: :"triangle-down") %> | ||
| <% end %> | ||
|
|
||
| <% overlay.with_body( | ||
| classes: "op-project-select--body", data: { controller: "header-project-select", | ||
| test_selector: "op-header-project-select" } | ||
| ) do %> | ||
| <%= helpers.turbo_frame_tag "op-header-project-frame", | ||
| src: tree_src, | ||
| loading: :lazy, | ||
| target: "_top", | ||
| class: "op-project-select--frame" %> | ||
| <% end %> | ||
| <% end %> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| #-- copyright | ||
| # OpenProject is an open source project management software. | ||
| # Copyright (C) the OpenProject GmbH | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License version 3. | ||
| # | ||
| # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| # Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| # Copyright (C) 2010-2013 the ChiliProject Team | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| # | ||
| # See COPYRIGHT and LICENSE files for more details. | ||
| #++ | ||
|
|
||
| module Header | ||
| class ProjectSelectComponent < ApplicationComponent | ||
| include OpenProject::StaticRouting::UrlHelpers | ||
|
|
||
| delegate :logged?, to: :@current_user | ||
|
|
||
| def initialize(current_project: nil, current_menu_item: nil, current_user: User.current) | ||
| super() | ||
| @current_project = current_project | ||
| @current_user = current_user | ||
| @current_menu_item = current_menu_item | ||
| end | ||
|
|
||
| def trigger_label | ||
| @current_project&.name || t(".all_projects") | ||
| end | ||
|
|
||
| def tree_src | ||
| frame_header_projects_path( | ||
| current_project_id: @current_project&.id, | ||
| jump: @current_menu_item.presence | ||
| ) | ||
| end | ||
|
|
||
| def can_create_projects? | ||
| @current_user.allowed_globally?(:add_project) | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| //-- copyright | ||
| // OpenProject is an open source project management software. | ||
| // Copyright (C) the OpenProject GmbH | ||
| // | ||
| // This program is free software; you can redistribute it and/or | ||
| // modify it under the terms of the GNU General Public License version 3. | ||
| // | ||
| // OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| // Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| // Copyright (C) 2010-2013 the ChiliProject Team | ||
| // | ||
| // This program is free software; you can redistribute it and/or | ||
| // modify it under the terms of the GNU General Public License | ||
| // as published by the Free Software Foundation; either version 2 | ||
| // of the License, or (at your option) any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License | ||
| // along with this program; if not, write to the Free Software | ||
| // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| // | ||
| // See COPYRIGHT and LICENSE files for more details. | ||
| //++ | ||
|
|
||
| .op-project-select | ||
| &--body | ||
| display: flex | ||
| max-height: 75dvh | ||
| overflow: hidden | ||
| margin: var(--base-size-16) | ||
| margin-right: 0 | ||
|
|
||
| &--frame | ||
| max-height: 100% | ||
| flex-basis: 100% | ||
|
|
||
| &--trigger-button | ||
| min-width: unset | ||
| display: block | ||
|
|
||
| .Button-label | ||
| @include text-shortener |
57 changes: 57 additions & 0 deletions
57
app/components/header/projects/filterable_tree_view_component.html.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <%#-- copyright | ||
| OpenProject is an open source project management software. | ||
| Copyright (C) the OpenProject GmbH | ||
|
|
||
| This program is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU General Public License version 3. | ||
|
|
||
| OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| Copyright (C) 2010-2013 the ChiliProject Team | ||
|
|
||
| This program is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU General Public License | ||
| as published by the Free Software Foundation; either version 2 | ||
| of the License, or (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
|
||
| See COPYRIGHT and LICENSE files for more details. | ||
|
|
||
| ++#%> | ||
|
|
||
| <%= helpers.turbo_frame_tag "op-header-project-frame", class: "op-project-select--frame" do %> | ||
| <%= render( | ||
| Primer::OpenProject::FilterableTreeView.new( | ||
| src: tree_src, | ||
| include_sub_items_check_box_arguments: { hidden: true }, | ||
| filter_mode_control_arguments: logged? ? {} : { hidden: true }, | ||
| filter_input_arguments: { name: "filter", | ||
| label: t(:label_filter), | ||
| visually_hide_label: true, | ||
| data: { test_selector: "op-header-project-select--search" } }, | ||
| no_results_node_arguments: { data: { test_selector: "op-header-project-select--no-results" }, | ||
| label: I18n.t("filterable_tree_view.no_results_text") } | ||
| ) | ||
| ) do |tree_view| %> | ||
| <% if logged? %> | ||
| <% tree_view.with_filter_mode( | ||
| name: "all", | ||
| label: t("filterable_tree_view.filter_mode.all"), | ||
| selected: @filter_mode != "favorited" | ||
| ) %> | ||
| <% tree_view.with_filter_mode( | ||
| name: "favorited", | ||
| label: t("header.project_select_component.favorites"), | ||
| selected: @filter_mode == "favorited" | ||
| ) %> | ||
| <% end %> | ||
| <% end %> | ||
| <% end %> |
52 changes: 52 additions & 0 deletions
52
app/components/header/projects/filterable_tree_view_component.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| #-- copyright | ||
| # OpenProject is an open source project management software. | ||
| # Copyright (C) the OpenProject GmbH | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License version 3. | ||
| # | ||
| # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| # Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| # Copyright (C) 2010-2013 the ChiliProject Team | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| # | ||
| # See COPYRIGHT and LICENSE files for more details. | ||
| #++ | ||
|
|
||
| module Header | ||
| module Projects | ||
| class FilterableTreeViewComponent < ApplicationComponent | ||
| def initialize(current_project_id:, jump:, filter_mode:) | ||
| super() | ||
| @current_project_id = current_project_id | ||
| @jump = jump | ||
| @filter_mode = filter_mode | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def tree_src | ||
| helpers.header_projects_path(current_project_id: @current_project_id, jump: @jump.presence) | ||
| end | ||
|
|
||
| def logged? | ||
| helpers.current_user.logged? | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| <%#-- copyright | ||
| OpenProject is an open source project management software. | ||
| Copyright (C) the OpenProject GmbH | ||
|
|
||
| This program is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU General Public License version 3. | ||
|
|
||
| OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| Copyright (C) 2010-2013 the ChiliProject Team | ||
|
|
||
| This program is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU General Public License | ||
| as published by the Free Software Foundation; either version 2 | ||
| of the License, or (at your option) any later version. | ||
|
|
||
| This program is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with this program; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
|
||
| See COPYRIGHT and LICENSE files for more details. | ||
|
|
||
| ++#%> | ||
|
|
||
| <% add_icons = ->(tree_node) do | ||
| if current? | ||
| tree_node.with_trailing_action_button( | ||
| icon: :"x-circle", | ||
| tag: :a, | ||
| href: home_path(jump: @jump), | ||
| show_tooltip: false, | ||
| aria: { label: t("header.project_select_component.leave_project") }, | ||
| data: { test_selector: "op-header-project-select--remove-item" } | ||
| ) | ||
|
HDinger marked this conversation as resolved.
|
||
| end | ||
| end %> | ||
|
|
||
| <% if children.any? %> | ||
| <% @component.with_sub_tree( | ||
| label:, | ||
| select_variant: :none, | ||
| current: current?, | ||
| expanded: expanded?, | ||
| href:, | ||
| disabled: !matches_query?, | ||
| data: { node_id: project.id, test_selector: "op-header-project-select--item" } | ||
| ) do |sub| %> | ||
| <% add_icons.call(sub) %> | ||
| <% children.each do |child_node| %> | ||
| <%= render Header::Projects::NodeComponent.new( | ||
| component: sub, | ||
| node: child_node, | ||
| current_project_id: @current_project_id, | ||
| favorited_ids: @favorited_ids, | ||
| jump: @jump | ||
| ) %> | ||
| <% end %> | ||
| <% end %> | ||
| <% else %> | ||
| <% @component.with_leaf( | ||
| label:, | ||
| select_variant: :none, | ||
| current: current?, | ||
| href:, | ||
| disabled: !matches_query?, | ||
| data: { node_id: project.id, test_selector: "op-header-project-select--item" } | ||
| ) do |leaf| %> | ||
| <% add_icons.call(leaf) %> | ||
| <% end %> | ||
| <% end %> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no right padding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What browser is that? The
FilterableTreeViewTreeContainershould itself add some right side padding via thescrollbar-gutter