Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove project selector from top menu left

Behrokh Satarnejada00b1ac13c07
diff --git a/app/components/open_project/common/submenu_component.sass b/app/components/open_project/common/submenu_component.sass
index bb30232b319..d45a2788a92 100644
--- a/app/components/open_project/common/submenu_component.sass
+++ b/app/components/open_project/common/submenu_component.sass
@@ -5,8 +5,8 @@
&--search
position: sticky
- // Header item + 10px padding
- top: calc(var(--main-menu-item-height) + 10px)
+ // Header item + 10px padding + 77px project selector
+ top: calc(var(--main-menu-item-height) + 10px + 77px)
z-index: 1
background: var(--main-menu-bg-color)
padding: 12px var(--main-menu-x-spacing)
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb
index bf8f00021e7..522b1f3242e 100644
--- a/app/views/layouts/base.html.erb
+++ b/app/views/layouts/base.html.erb
@@ -102,6 +102,13 @@ See COPYRIGHT and LICENSE files for more details.
<h1 class="hidden-for-sighted"><%= t(:label_main_menu) %></h1>
<opce-main-menu-resizer></opce-main-menu-resizer>
<div id="menu-sidebar">
+ <%= render_projects_top_menu_node %>
+ <%= render(Primer::BaseComponent.new(tag: :hr,
+ classes: "main-menu--projects-divider",
+ role: :presentation,
+ aria: {
+ hidden: true
+ })) %>
<%= main_menu %>
<%= content_for :main_menu %>
<%= call_hook :view_layouts_base_main_menu %>
diff --git a/frontend/src/app/shared/components/header-project-select/header-project-select.component.html b/frontend/src/app/shared/components/header-project-select/header-project-select.component.html
index 6feddf8bd4f..d16ee5804cb 100644
--- a/frontend/src/app/shared/components/header-project-select/header-project-select.component.html
+++ b/frontend/src/app/shared/components/header-project-select/header-project-select.component.html
@@ -9,17 +9,21 @@
id="projects-menu"
accesskey="5"
aria-haspopup="true"
- class="op-app-menu--item-action"
+ class="op-menu--item op-project-select--trigger-button"
type="button"
slot="trigger"
(click)="toggleDropModal()"
data-test-selector="op-projects-menu"
>
<span
- class="op-app-menu--item-title ellipsis"
- [textContent]="currentProjectName()"
- ></span>
- <i class="op-app-menu--item-dropdown-indicator button--dropdown-indicator"></i>
+ class="op-menu--item-title">
+ <span
+ class="ellipsis"
+ [textContent]="currentProjectName()"
+ [attr.title]="currentProjectName()">
+ </span>
+ </span>
+ <i class="op-menu--item-dropdown-indicator button--dropdown-indicator"></i>
</button>
<ng-container slot="body">
diff --git a/frontend/src/app/shared/components/header-project-select/header-project-select.component.sass b/frontend/src/app/shared/components/header-project-select/header-project-select.component.sass
index 081250ab8ce..03183c041cd 100644
--- a/frontend/src/app/shared/components/header-project-select/header-project-select.component.sass
+++ b/frontend/src/app/shared/components/header-project-select/header-project-select.component.sass
@@ -1,5 +1,7 @@
-.op-header-project-select
- max-width: 100%
+.op-project-select
+ margin-top: 0.75rem
+ flex: 1
+ overflow: hidden
&--no-favorites
display: flex
@@ -15,5 +17,6 @@
font-size: 0.9rem
color: var(--fgColor-muted, var(--color-fg-subtle))
- .op-app-menu--item-action
- padding: 0 8px
+ &--trigger-button
+ background-color: transparent
+ width: 100%
diff --git a/frontend/src/app/shared/components/header-project-select/header-project-select.component.ts b/frontend/src/app/shared/components/header-project-select/header-project-select.component.ts
index 8058d5837eb..822b0c77eb4 100644
--- a/frontend/src/app/shared/components/header-project-select/header-project-select.component.ts
+++ b/frontend/src/app/shared/components/header-project-select/header-project-select.component.ts
@@ -46,7 +46,6 @@ import { ApiV3Filter } from 'core-app/shared/helpers/api-v3/api-v3-filter-builde
import { IHALCollection } from 'core-app/core/apiv3/types/hal-collection.type';
import { ConfigurationService } from 'core-app/core/config/configuration.service';
-
@Component({
selector: 'opce-header-project-select',
templateUrl: './header-project-select.component.html',
@@ -58,7 +57,7 @@ import { ConfigurationService } from 'core-app/core/config/configuration.service
],
})
export class OpHeaderProjectSelectComponent extends UntilDestroyedMixin implements OnInit {
- @HostBinding('class.op-header-project-select') className = true;
+ @HostBinding('class.op-project-select') className = true;
public dropModalOpen = false;
diff --git a/frontend/src/global_styles/common/menu/menu.sass b/frontend/src/global_styles/common/menu/menu.sass
index c1ee9d4e11d..c305650fc00 100644
--- a/frontend/src/global_styles/common/menu/menu.sass
+++ b/frontend/src/global_styles/common/menu/menu.sass
@@ -4,6 +4,15 @@
&--item
white-space: nowrap
+ display: flex
+
+ &-dropdown-indicator
+ display: inline-flex
+ justify-content: center
+ align-items: center
+
+ &:before
+ margin-left: var(--base-size-8)
&-title
font-weight: 400
diff --git a/frontend/src/global_styles/content/_project_list_modal.sass b/frontend/src/global_styles/content/_project_list_modal.sass
index 9b36d34469f..b7f8a1cad82 100644
--- a/frontend/src/global_styles/content/_project_list_modal.sass
+++ b/frontend/src/global_styles/content/_project_list_modal.sass
@@ -10,7 +10,7 @@
&--title
padding: 0
margin: 0
- @include spot-subheader-big
+ @include spot-subheader-extra-small
&--body
flex-shrink: 1
diff --git a/frontend/src/global_styles/layout/_main_menu.sass b/frontend/src/global_styles/layout/_main_menu.sass
index 4adfe007903..075f9ffa283 100644
--- a/frontend/src/global_styles/layout/_main_menu.sass
+++ b/frontend/src/global_styles/layout/_main_menu.sass
@@ -45,6 +45,7 @@ $arrow-left-width: 40px
width: var(--main-menu-width)
min-width: var(--main-menu-width)
overflow-x: hidden
+ overflow-y: hidden
border-right-style: solid
border-right-width: var(--main-menu-border-width)
border-right-color: var(--main-menu-border-color)
@@ -58,7 +59,13 @@ $arrow-left-width: 40px
position: relative
@include styled-scroll-bar
- a:not(.Button):focus
+
+ .main-menu--projects-divider
+ background: var(--borderColor-muted)
+ margin: 0.75rem 0
+
+ a:not(.Button), .op-project-select--trigger-button
+ &:focus
color: var(--main-menu-font-color)
ul
@@ -96,7 +103,7 @@ $arrow-left-width: 40px
// children have no icon so we need to push them right.
padding-left: var(--main-menu-x-spacing)
- a:not(.Button)
+ a:not(.Button), .op-project-select--trigger-button
text-decoration: none
line-height: var(--main-menu-item-height)
position: relative
@@ -130,7 +137,7 @@ $arrow-left-width: 40px
.toggler:hover
@include main-menu-hover
- a:not(.Button)
+ a:not(.Button), .op-project-select--trigger-button
border: 1px solid transparent
&.selected, &.selected + a
@@ -176,7 +183,7 @@ $arrow-left-width: 40px
.main-menu--children-menu-header
position: sticky
- top: 0
+ top: 77px
z-index: 1
background: var(--main-menu-bg-color)
padding: 10px 10px 0 4px
@@ -391,7 +398,6 @@ $badge_offset: 4px
color: var(--main-menu-font-color)
border: none
-
#main-menu-toggle
.icon-close
display: none
diff --git a/lib/redmine/menu_manager/top_menu/projects_menu.rb b/lib/redmine/menu_manager/top_menu/projects_menu.rb
index e8876aba140..6673fb4cdbc 100644
--- a/lib/redmine/menu_manager/top_menu/projects_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/projects_menu.rb
@@ -37,7 +37,7 @@ module Redmine::MenuManager::TopMenu::ProjectsMenu
private
def render_projects_dropdown
- content_tag(:li, class: "op-app-menu--item") do
+ content_tag(:div, class: "main-menu-item") do
angular_component_tag("opce-header-project-select")
end
end
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index 54e294132ee..7e05aa88b38 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -39,7 +39,6 @@ module Redmine::MenuManager::TopMenuHelper
def top_menu_left_menu_items
[render_main_top_menu_nodes,
- render_projects_top_menu_node,
render_quick_add_menu]
end
diff --git a/spec/features/projects/favorite_spec.rb b/spec/features/projects/favorite_spec.rb
index cad76de71b4..7ba60e28b05 100644
--- a/spec/features/projects/favorite_spec.rb
+++ b/spec/features/projects/favorite_spec.rb
@@ -165,6 +165,12 @@ RSpec.describe "Favorite projects", :js, :selenium do
end
context "as an Anonymous User with not login required", with_settings: { login_required: false } do
+ before do
+ # anonymous user needs to have the permission to view the project or they
+ # will be redirected to login page despite the project being public
+ ProjectRole.anonymous.update permissions: [:view_project]
+ end
+
it "does not shows favored projects" do
visit project_path(project)