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

Take care that the main menu resizer toggles when the menu is collapsed/expanded

Henriette Dargecc90002befb7
diff --git a/app/components/_index.sass b/app/components/_index.sass
index a4f4cfbe6b6..fa163a22927 100644
--- a/app/components/_index.sass
+++ b/app/components/_index.sass
@@ -6,7 +6,7 @@
@import "open_project/common/attribute_help_text_component"
@import "open_project/common/attribute_label_component"
@import "open_project/common/submenu_component"
-@import "open_project/common/main_menu_toggler_component"
+@import "open_project/common/main_menu_toggle_component"
@import "projects/row_component"
@import "projects/phases/hover_card_component"
@import "shares/invite_user_form_component"
diff --git a/app/components/open_project/common/main_menu_toggler_component.rb b/app/components/open_project/common/main_menu_toggle_component.rb
similarity index 79%
rename from app/components/open_project/common/main_menu_toggler_component.rb
rename to app/components/open_project/common/main_menu_toggle_component.rb
index 12ac73be3c9..f70760d2d8a 100644
--- a/app/components/open_project/common/main_menu_toggler_component.rb
+++ b/app/components/open_project/common/main_menu_toggle_component.rb
@@ -30,23 +30,34 @@
#
module OpenProject
module Common
- class MainMenuTogglerComponent < ApplicationComponent
- def initialize(opened:)
- super
+ class MainMenuToggleComponent < ApplicationComponent
+ def initialize(expanded:)
+ super()
- @opened = opened
+ @expanded = expanded
end
+ def call
+ render(Primer::Beta::IconButton.new(icon:,
+ id:,
+ aria: { label: aria_label },
+ scheme:,
+ size:,
+ data:))
+ end
+
+ private
+
def icon
- @opened ? "sidebar-expand" : :"sidebar-collapse"
+ @expanded ? "sidebar-expand" : :"sidebar-collapse"
end
def id
- "menu-toggler--#{@opened ? 'opener' : 'closer'}"
+ "menu-toggle--#{@expanded ? 'collapse-button' : 'expand-button'}"
end
def aria_label
- @opened ? I18n.t("js.label_hide_project_menu") : I18n.t("js.label_expand_project_menu")
+ @expanded ? I18n.t("js.label_hide_project_menu") : I18n.t("js.label_expand_project_menu")
end
def scheme
@@ -54,23 +65,14 @@ module OpenProject
end
def size
- @opened ? :medium : :small
+ @expanded ? :medium : :small
end
def data
{
- action: "click->menus--main-toggler#toggleNavigation"
+ action: "click->menus--main-toggle#toggleNavigation"
}
end
-
- def call
- render(Primer::Beta::IconButton.new(icon:,
- id:,
- aria: { label: aria_label },
- scheme:,
- size:,
- data:))
- end
end
end
end
diff --git a/app/components/open_project/common/main_menu_toggler_component.sass b/app/components/open_project/common/main_menu_toggle_component.sass
similarity index 86%
rename from app/components/open_project/common/main_menu_toggler_component.sass
rename to app/components/open_project/common/main_menu_toggle_component.sass
index fc320414522..383587d9af5 100644
--- a/app/components/open_project/common/main_menu_toggler_component.sass
+++ b/app/components/open_project/common/main_menu_toggle_component.sass
@@ -26,12 +26,12 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-#menu-toggler--closer
+#menu-toggle--expand-button
position: absolute
- top: 14px
left: 11px
+ z-index: 1
-#menu-toggler--opener
+#menu-toggle--collapse-button
margin-right: 5px
.Button-visual
@@ -39,10 +39,11 @@
#wrapper
.hidden-navigation
- // TODO: Add angular breadcrumb selector once it exists
- .PageHeader-contextBar
+ // Push the breadcrumb to the right when the sidebar is collapsed
+ .PageHeader-contextBar,
+ .op-breadcrumbs
margin-left: 30px
&:not(.hidden-navigation)
- #menu-toggler--closer
+ #menu-toggle--expand-button
display: none
diff --git a/app/components/open_project/common/submenu_component.sass b/app/components/open_project/common/submenu_component.sass
index 4553cc3597a..79dc21791d4 100644
--- a/app/components/open_project/common/submenu_component.sass
+++ b/app/components/open_project/common/submenu_component.sass
@@ -5,8 +5,7 @@
&--search
position: sticky
- // Header item + 10px padding + 77px project selector
- top: calc(var(--main-menu-item-height) + 10px + 77px)
+ top: 0
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 e8cb25ade92..84c452fe28e 100644
--- a/app/views/layouts/base.html.erb
+++ b/app/views/layouts/base.html.erb
@@ -30,9 +30,9 @@ See COPYRIGHT and LICENSE files for more details.
<html xmlns="http://www.w3.org/1999/xhtml"
lang="<%= I18n.locale.to_s %>"
xml:lang="<%= I18n.locale.to_s %>"
- class="<%= 'in_modal' unless show_decoration %>">
+ class="<%= "in_modal" unless show_decoration %>">
<head>
- <%= render partial: 'layouts/common_head' %>
+ <%= render partial: "layouts/common_head" %>
<!-- project specific tags -->
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
@@ -43,13 +43,13 @@ See COPYRIGHT and LICENSE files for more details.
</head>
<%= content_tag :body,
class: "#{body_css_classes} __overflowing_element_container __overflowing_body",
- data: body_data_attributes(local_assigns) do %>
-<%= render partial: 'warning_bar/warning_bar' %>
+ data: body_data_attributes(local_assigns) do %>
+<%= render partial: "warning_bar/warning_bar" %>
<noscript>
<div class="top-shelf">
<p>
<span>
- <%= op_icon 'icon3 icon-warning' %>
+ <%= op_icon "icon3 icon-warning" %>
<strong><%= t(:noscript_heading) %></strong>
</span>
<%= t(:noscript_description) %>
@@ -69,15 +69,15 @@ See COPYRIGHT and LICENSE files for more details.
<% initial_classes = initial_menu_classes(side_displayed, show_decoration) %>
<div id="wrapper" style="<%= initial_menu_styles(side_displayed) %>" class="<%= initial_classes %>">
<% if show_decoration %>
- <header class="op-app-header<%= ' op-app-header_development' if OpenProject::Configuration.development_highlight_enabled? %>">
+ <header class="op-app-header<%= " op-app-header_development" if OpenProject::Configuration.development_highlight_enabled? %>">
<div class="op-app-header--start">
<h1 class="hidden-for-sighted">
<%= t(:label_top_menu) %>
</h1>
<a href="" class="hidden-for-sighted skip-navigation-link"
id="skip-navigation--content"
- aria-label="<%= I18n.t('js.work_packages.jump_marks.label_content') %>">
- <%= I18n.t('js.work_packages.jump_marks.content') %>
+ aria-label="<%= I18n.t("js.work_packages.jump_marks.label_content") %>">
+ <%= I18n.t("js.work_packages.jump_marks.content") %>
</a>
<%= render_top_menu_left %>
</div>
@@ -92,32 +92,36 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<div id="main"
class="<%= initial_classes %>"
- data-controller="menus--main-toggler"
- data-application-target="dynamic">
+ data-controller="menus--main-toggle">
<% if (side_displayed && show_decoration) %>
<div
id="main-menu"
class="main-menu"
- data-controller="menus--main"
- >
+ data-controller="menus--main">
<h1 class="hidden-for-sighted"><%= t(:label_main_menu) %></h1>
<opce-main-menu-resizer></opce-main-menu-resizer>
<div id="menu-sidebar">
- <%= render(Primer::OpenProject::FlexLayout.new(align_items: :center, mt: 2)) do |flex|
- flex.with_column(overflow: :hidden, ml: 2) do
- render_projects_top_menu_node
- end
- flex.with_column(text_align: :right, flex: :auto) do
- render(OpenProject::Common::MainMenuTogglerComponent.new(opened: true))
- end
- end %>
+ <div class="main-menu--top-container">
+ <%= render(Primer::OpenProject::FlexLayout.new(align_items: :center, pt: 3)) do |flex|
+ flex.with_column(overflow: :hidden, ml: 2) do
+ render_projects_top_menu_node
+ end
+ flex.with_column(text_align: :right, flex: :auto) do
+ render(OpenProject::Common::MainMenuToggleComponent.new(expanded: true))
+ end
+ end %>
- <%= render(Primer::BaseComponent.new(tag: :hr,
- classes: "main-menu--projects-divider",
- role: :presentation,
- aria: {
- hidden: true
- })) %>
+ <%= render(
+ Primer::BaseComponent.new(
+ tag: :hr,
+ classes: "main-menu--projects-divider",
+ role: :presentation,
+ aria: {
+ hidden: true
+ }
+ )
+ ) %>
+ </div>
<%= main_menu %>
<%= content_for :main_menu %>
<%= call_hook :view_layouts_base_main_menu %>
@@ -139,11 +143,11 @@ See COPYRIGHT and LICENSE files for more details.
<section data-augmented-model-wrapper
data-modal-initialize-now="true"
data-modal-class-name="onboarding-modal">
- <%= render partial: '/onboarding/configuration_modal' %>
+ <%= render partial: "/onboarding/configuration_modal" %>
</section>
<% end %>
<%= content_tag :div,
- id: 'content',
+ id: "content",
class: "#{initial_classes} #{'content--split' if content_for?(:content_body_right)}" do %>
<h1 class="hidden-for-sighted accessibility-helper"><%= t(:label_content) %></h1>
<% if content_for?(:content_header) %>
@@ -153,7 +157,7 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<div id="content-body">
- <%= render(OpenProject::Common::MainMenuTogglerComponent.new(opened: false)) %>
+ <%= render(OpenProject::Common::MainMenuToggleComponent.new(expanded: false)) %>
<%= content_for :content_body %>
<% unless local_assigns[:no_layout_yield] %>
<%= yield %>
diff --git a/frontend/src/app/core/main-menu/main-menu-toggle.service.ts b/frontend/src/app/core/main-menu/main-menu-toggle.service.ts
index ee0ca792e87..21064937781 100644
--- a/frontend/src/app/core/main-menu/main-menu-toggle.service.ts
+++ b/frontend/src/app/core/main-menu/main-menu-toggle.service.ts
@@ -49,16 +49,14 @@ export class MainMenuToggleService {
@InjectField() currentProject:CurrentProjectService;
- private global = (window as any);
-
private htmlNode = document.getElementsByTagName('html')[0];
private mainMenu = jQuery('#main-menu')[0]; // main menu, containing sidebar and resizer
// Notes all changes of the menu size (currently needed in wp-resizer.component.ts)
- private changeData = new BehaviorSubject<any>({});
-
+ private changeData = new BehaviorSubject<number|undefined>(undefined);
public changeData$ = this.changeData.asObservable();
+
private wasHiddenDueToResize = false;
private wasCollapsedByUser = false;
@@ -140,11 +138,13 @@ export class MainMenuToggleService {
public closeMenu():void {
this.setWidth(0);
+ this.changeData.next(0);
jQuery('.searchable-menu--search-input').blur();
}
public openMenu():void {
this.setWidth(this.defaultWidth);
+ this.changeData.next(this.defaultWidth);
}
public setWidth(width?:number):void {
diff --git a/frontend/src/app/features/bim/ifc_models/pages/viewer/styles/generic.sass b/frontend/src/app/features/bim/ifc_models/pages/viewer/styles/generic.sass
index 209e3888ed2..cbffbbf4e81 100644
--- a/frontend/src/app/features/bim/ifc_models/pages/viewer/styles/generic.sass
+++ b/frontend/src/app/features/bim/ifc_models/pages/viewer/styles/generic.sass
@@ -37,6 +37,10 @@
.op-breadcrumbs
margin-left: 20px
+ #wrapper .hidden-navigation
+ .op-breadcrumbs
+ margin-left: 45px
+
[data-name="bim"] .main-menu--children
overflow-x: hidden !important
diff --git a/frontend/src/app/shared/components/breadcrumbs/op-breadcrumbs.component.sass b/frontend/src/app/shared/components/breadcrumbs/op-breadcrumbs.component.sass
index 5b2861e6336..458d5aee45f 100644
--- a/frontend/src/app/shared/components/breadcrumbs/op-breadcrumbs.component.sass
+++ b/frontend/src/app/shared/components/breadcrumbs/op-breadcrumbs.component.sass
@@ -1,6 +1,10 @@
@import "helpers"
.op-breadcrumbs
+ // Match the height of the Primer breadcrumb which itself takes the height of the small action button it can have on mobile
+ height: var(--control-small-size)
+ line-height: var(--control-small-size)
+
.op-breadcrumbs--items
margin-left: 0
.op-breadcrumbs--item
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 d16ee5804cb..bfc09eaffce 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,21 +9,18 @@
id="projects-menu"
accesskey="5"
aria-haspopup="true"
- class="op-menu--item op-project-select--trigger-button"
+ class="op-project-select--trigger-button"
type="button"
slot="trigger"
(click)="toggleDropModal()"
data-test-selector="op-projects-menu"
>
<span
- class="op-menu--item-title">
- <span
- class="ellipsis"
- [textContent]="currentProjectName()"
- [attr.title]="currentProjectName()">
- </span>
+ class="ellipsis"
+ [textContent]="currentProjectName()"
+ [attr.title]="currentProjectName()">
</span>
- <i class="op-menu--item-dropdown-indicator button--dropdown-indicator"></i>
+ <i class="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 7471095919b..b2465725908 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
@@ -17,10 +17,17 @@
color: var(--fgColor-muted, var(--color-fg-subtle))
&--trigger-button
- height: var(--main-menu-item-height)
+ display: flex
+ align-items: center
+ height: var(--control-medium-size)
color: var(--main-menu-font-color)
+ font-weight: var(--base-text-weight-semibold)
+ padding: 0 8px
border: 1px solid transparent
- padding: 0 var(--main-menu-x-spacing-small)
border-radius: var(--borderRadius-medium)
background-color: transparent
width: 100%
+
+ .button--dropdown-indicator
+ &:before
+ margin-left: var(--base-size-8)
diff --git a/frontend/src/app/shared/components/resizer/resizer/main-menu-resizer.component.ts b/frontend/src/app/shared/components/resizer/resizer/main-menu-resizer.component.ts
index bf99934b4a7..34e4fcb8c42 100644
--- a/frontend/src/app/shared/components/resizer/resizer/main-menu-resizer.component.ts
+++ b/frontend/src/app/shared/components/resizer/resizer/main-menu-resizer.component.ts
@@ -30,6 +30,10 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, OnIn
import { ResizeDelta } from 'core-app/shared/components/resizer/resizer.component';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { MainMenuToggleService } from 'core-app/core/main-menu/main-menu-toggle.service';
+import {
+ debounceTime,
+ distinctUntilChanged,
+} from 'rxjs/operators';
@Component({
selector: 'opce-main-menu-resizer',
@@ -44,7 +48,7 @@ import { MainMenuToggleService } from 'core-app/core/main-menu/main-menu-toggle.
<button
class="spot-link main-menu--navigation-toggler"
[attr.title]="toggleTitle"
- [class.open]="toggleService.showNavigation"
+ [class.open]="isOpen"
(click)="toggleService.toggleNavigation($event)"
>
<span class="resize-handle"><svg op-resizer-vertical-lines-icon size="small"></svg></span>
@@ -58,7 +62,7 @@ import { MainMenuToggleService } from 'core-app/core/main-menu/main-menu-toggle.
export class MainMenuResizerComponent extends UntilDestroyedMixin implements OnInit {
public toggleTitle:string;
- private resizeEvent:string;
+ private resizeEvent:string = 'main-menu-resize';
private elementWidth:number;
@@ -66,6 +70,8 @@ export class MainMenuResizerComponent extends UntilDestroyedMixin implements OnI
public moving = false;
+ public isOpen:boolean;
+
constructor(
readonly toggleService:MainMenuToggleService,
readonly cdRef:ChangeDetectorRef,
@@ -75,7 +81,19 @@ export class MainMenuResizerComponent extends UntilDestroyedMixin implements OnI
}
ngOnInit() {
- this.resizeEvent = 'main-menu-resize';
+ this.isOpen = this.toggleService.showNavigation;
+
+ // Listen on sidebar changes and toggle resizer classes, if necessary
+ this.toggleService.changeData$
+ .pipe(
+ distinctUntilChanged(),
+ this.untilDestroyed(),
+ debounceTime(50),
+ )
+ .subscribe(() => {
+ this.isOpen = this.toggleService.showNavigation;
+ this.cdRef.detectChanges();
+ });
}
public resizeStart() {
diff --git a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
index a09e4700f67..3393c8e2676 100644
--- a/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
+++ b/frontend/src/app/shared/components/resizer/resizer/wp-resizer.component.ts
@@ -27,12 +27,11 @@
//++
import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core';
-import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
+import { debounceTime } from 'rxjs/operators';
import { TransitionService } from '@uirouter/core';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { ResizeDelta } from 'core-app/shared/components/resizer/resizer.component';
import { fromEvent } from 'rxjs';
-import { MainMenuToggleService } from 'core-app/core/main-menu/main-menu-toggle.service';
@Component({
selector: 'wp-resizer',
@@ -73,7 +72,6 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
public resizerClass = 'work-packages--resizer icon-resizer-vertical-lines';
constructor(
- readonly toggleService:MainMenuToggleService,
private elementRef:ElementRef,
readonly $transitions:TransitionService,
) {
@@ -109,17 +107,6 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
// Add event listener
this.element = this.elementRef.nativeElement;
- // Listen on sidebar changes and toggle column layout, if necessary
- this.toggleService.changeData$
- .pipe(
- distinctUntilChanged(),
- this.untilDestroyed(),
- debounceTime(100),
- )
- .subscribe(() => {
- this.applyColumnLayout();
- });
-
// Listen to event
fromEvent(window, 'resize', { passive: true })
.pipe(
diff --git a/frontend/src/global_styles/common/header/app-header.sass b/frontend/src/global_styles/common/header/app-header.sass
index 87f17c2e29a..041fab6cfa1 100644
--- a/frontend/src/global_styles/common/header/app-header.sass
+++ b/frontend/src/global_styles/common/header/app-header.sass
@@ -20,6 +20,9 @@
left: 0
right: 0
+ .op-app-header--start
+ padding-left: 5px
+
@at-root .zen-mode &
display: none
diff --git a/frontend/src/global_styles/common/header/logo.sass b/frontend/src/global_styles/common/header/logo.sass
index 7cec54da947..b0248d7dfa0 100644
--- a/frontend/src/global_styles/common/header/logo.sass
+++ b/frontend/src/global_styles/common/header/logo.sass
@@ -1,17 +1,16 @@
.op-logo
- width: 230px
+ width: 130px
height: var(--header-height)
+ margin: 0 0.5rem
&--link
- margin-top: 12px
+ margin-top: 16px
width: 100%
display: block
- height: 30px
- background: no-repeat 20px 0
+ height: 24px
text-indent: -9999em
- background-position: center
+ background: no-repeat center
background-size: contain
- background-repeat: no-repeat
@media screen and (max-width: 850px)
display: none
diff --git a/frontend/src/global_styles/common/header/quick-add-menu.sass b/frontend/src/global_styles/common/header/quick-add-menu.sass
index a910698b15a..3ec06586836 100644
--- a/frontend/src/global_styles/common/header/quick-add-menu.sass
+++ b/frontend/src/global_styles/common/header/quick-add-menu.sass
@@ -4,6 +4,10 @@
$color: var(--button--primary-font-color)
flex-shrink: 0
+ &--button
+ padding-left: 8px
+ padding-right: 8px
+
&--icon::before
display: flex
justify-content: center
diff --git a/frontend/src/global_styles/common/menu/menu.sass b/frontend/src/global_styles/common/menu/menu.sass
index c305650fc00..c1ee9d4e11d 100644
--- a/frontend/src/global_styles/common/menu/menu.sass
+++ b/frontend/src/global_styles/common/menu/menu.sass
@@ -4,15 +4,6 @@
&--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/modules/_boards.sass b/frontend/src/global_styles/content/modules/_boards.sass
index 5f86c7ba3c8..54bb8f4e44d 100644
--- a/frontend/src/global_styles/content/modules/_boards.sass
+++ b/frontend/src/global_styles/content/modules/_boards.sass
@@ -5,3 +5,7 @@
.op-breadcrumbs
margin-left: 20px
+
+ #wrapper .hidden-navigation
+ .op-breadcrumbs
+ margin-left: 46px
diff --git a/frontend/src/global_styles/layout/_base.sass b/frontend/src/global_styles/layout/_base.sass
index 1f4e0e20933..a04053fa9b2 100644
--- a/frontend/src/global_styles/layout/_base.sass
+++ b/frontend/src/global_styles/layout/_base.sass
@@ -119,6 +119,7 @@ $left-side-min-width: 300px
padding-left: $left-space
#content-body
+ position: relative
grid-area: body
padding-bottom: $bottom-space
padding-right: $right-space
diff --git a/frontend/src/global_styles/layout/_base_mobile.sass b/frontend/src/global_styles/layout/_base_mobile.sass
index 7f671bd3549..4d923a37563 100644
--- a/frontend/src/global_styles/layout/_base_mobile.sass
+++ b/frontend/src/global_styles/layout/_base_mobile.sass
@@ -44,6 +44,7 @@
#content-body,
#content-header
+ padding-top: 15px !important
padding-left: 15px
padding-right: 15px
diff --git a/frontend/src/global_styles/layout/_main_menu.sass b/frontend/src/global_styles/layout/_main_menu.sass
index 408e5e236a8..e6f5ae4b388 100644
--- a/frontend/src/global_styles/layout/_main_menu.sass
+++ b/frontend/src/global_styles/layout/_main_menu.sass
@@ -67,11 +67,6 @@ $arrow-left-width: 40px
position: relative
@include styled-scroll-bar
-
- .main-menu--projects-divider
- background: var(--borderColor-muted)
- margin: 0.75rem 0
-
ul
margin: 0
padding: 0
@@ -130,10 +125,6 @@ $arrow-left-width: 40px
justify-content: center
align-items: center
- .icon-time
- background: none
- padding: 0
-
.op-project-select--trigger-button
&:hover, &:focus, &:active
@include main-menu-hover(false)
@@ -188,7 +179,7 @@ $arrow-left-width: 40px
.main-menu--children-menu-header
position: sticky
- top: 77px
+ top: 0
z-index: 1
background: var(--main-menu-bg-color)
padding: 0px 10px 0 4px
@@ -206,6 +197,16 @@ $arrow-left-width: 40px
&:hover, &:focus, &:active
@include main-menu-hover(false)
+.main-menu--top-container
+ position: sticky
+ top: 0
+ z-index: 1
+ background: var(--main-menu-bg-color)
+
+ .main-menu--projects-divider
+ background: var(--borderColor-neutral-emphasis)
+ margin: 1rem 0
+
a.main-menu--parent-node:not(.Button)
border: 1px solid transparent
display: inline-block
@@ -227,11 +228,13 @@ a.main-menu--parent-node:not(.Button)
flex-grow: 1
&.closed
+ overflow: hidden
li
display: none
> li.open
display: list-item
+ height: 100%
.main-item-wrapper
display: none
@@ -244,9 +247,14 @@ a.main-menu--parent-node:not(.Button)
.main-menu--children
display: block
+ // Children header == 50px
+ height: calc(100% - 50px)
+ overflow: auto
li
display: list-item
+ &.partial
+ height: 100%
&.open
> li
diff --git a/frontend/src/global_styles/layout/work_packages/_mobile.sass b/frontend/src/global_styles/layout/work_packages/_mobile.sass
index 953f3912b81..fc8dd77a154 100644
--- a/frontend/src/global_styles/layout/work_packages/_mobile.sass
+++ b/frontend/src/global_styles/layout/work_packages/_mobile.sass
@@ -131,3 +131,7 @@
.work-packages--filters-optional-container,
.op-breadcrumbs
margin-left: 15px
+
+ #wrapper .hidden-navigation
+ .op-breadcrumbs
+ margin-left: 45px
diff --git a/frontend/src/stimulus/controllers/dynamic/menus/main-toggler.controller.ts b/frontend/src/stimulus/controllers/dynamic/menus/main-toggle.controller.ts
similarity index 71%
rename from frontend/src/stimulus/controllers/dynamic/menus/main-toggler.controller.ts
rename to frontend/src/stimulus/controllers/dynamic/menus/main-toggle.controller.ts
index aa23e675041..f72077c4791 100644
--- a/frontend/src/stimulus/controllers/dynamic/menus/main-toggler.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/menus/main-toggle.controller.ts
@@ -1,11 +1,17 @@
import { Controller } from '@hotwired/stimulus';
import { MainMenuToggleService } from 'core-app/core/main-menu/main-menu-toggle.service';
-export default class MainTogglerController extends Controller {
+export default class MainToggleController extends Controller {
mainMenuService:MainMenuToggleService;
initialize() {
- void window.OpenProject.getPluginContext()
+ console.count("INIT");
+
+ }
+
+ async connect() {
+ console.count("CONNECT");
+ await window.OpenProject.getPluginContext()
.then((pluginContext) => pluginContext.injector.get(MainMenuToggleService))
.then((service) => {
this.mainMenuService = service;
diff --git a/lib/redmine/menu_manager/top_menu/projects_menu.rb b/lib/redmine/menu_manager/top_menu/projects_menu.rb
index 2f140585de4..6673fb4cdbc 100644
--- a/lib/redmine/menu_manager/top_menu/projects_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/projects_menu.rb
@@ -29,7 +29,7 @@
module Redmine::MenuManager::TopMenu::ProjectsMenu
def render_projects_top_menu_node
return "" if User.current.anonymous? and Setting.login_required?
- return "" if User.current.anonymous? and User.current.number_of_known_projects.zero? #TODO
+ return "" if User.current.anonymous? and User.current.number_of_known_projects.zero?
render_projects_dropdown
end
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index 7e05aa88b38..1b686182c20 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -38,11 +38,17 @@ module Redmine::MenuManager::TopMenuHelper
end
def top_menu_left_menu_items
- [render_main_top_menu_nodes,
+ [render_module_top_menu_node,
+ render_logo,
+ render_main_top_menu_nodes,
render_quick_add_menu]
end
def render_top_menu_center
+ nil
+ end
+
+ def render_logo
content_tag :div, class: "op-logo" do
mode_class = User.current.pref.high_contrast_theme? ? "op-logo--link_high_contrast" : ""
link_to(I18n.t("label_home"),
@@ -85,8 +91,7 @@ module Redmine::MenuManager::TopMenuHelper
end
def top_menu_right_menu_items
- [render_module_top_menu_node,
- render_notification_top_menu_node,
+ [render_notification_top_menu_node,
render_help_top_menu_node,
render_user_top_menu_node]
end
@@ -175,7 +180,7 @@ module Redmine::MenuManager::TopMenuHelper
anchor_align: :end) do |menu|
menu.with_show_button(icon: "op-grid-menu",
scheme: :invisible,
- classes: "op-app-menu--item-action op-app-header--primer-button hidden-for-mobile",
+ classes: "op-app-menu--item-action op-app-header--primer-button",
title: I18n.t("label_modules"),
test_selector: "op-app-header--modules-menu-button",
"aria-label": I18n.t("label_modules"))
diff --git a/spec/components/open_project/common/main_menu_toggle_component_spec.rb b/spec/components/open_project/common/main_menu_toggle_component_spec.rb
new file mode 100644
index 00000000000..9a0e2f8d868
--- /dev/null
+++ b/spec/components/open_project/common/main_menu_toggle_component_spec.rb
@@ -0,0 +1,71 @@
+# 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.
+#++
+
+require "rails_helper"
+
+RSpec.describe OpenProject::Common::MainMenuToggleComponent, type: :component do
+ let(:expanded) { true }
+
+ subject do
+ render_inline(described_class.new(expanded:)) do
+ content
+ end
+
+ page
+ end
+
+ context "in expended state" do
+ it "does render the expanded icon" do
+ expect(subject).to have_element class: "octicon-sidebar-expand"
+ expect(subject).to have_no_element class: "octicon-sidebar-collapse"
+ expect(subject).to have_element id: "menu-toggle--collapse-button"
+ expect(subject).to have_element "tool-tip",
+ text: "Collapse project menu",
+ for: "menu-toggle--collapse-button",
+ popover: "manual",
+ "data-type": "label"
+ end
+ end
+
+ context "in collapsed state" do
+ let(:expanded) { false }
+
+ it "does render the collapsed icon" do
+ expect(subject).to have_element class: "octicon-sidebar-collapse"
+ expect(subject).to have_no_element class: "octicon-sidebar-expand"
+ expect(subject).to have_element id: "menu-toggle--expand-button"
+ expect(subject).to have_element "tool-tip",
+ text: "Expand project menu",
+ for: "menu-toggle--expand-button",
+ popover: "manual",
+ "data-type": "label"
+ end
+ end
+end
diff --git a/spec/support/edit_fields/edit_field.rb b/spec/support/edit_fields/edit_field.rb
index 8517feb814b..2a9b545de75 100644
--- a/spec/support/edit_fields/edit_field.rb
+++ b/spec/support/edit_fields/edit_field.rb
@@ -110,7 +110,7 @@ class EditField
retry_block(args: { tries: 2 }) do
unless active?
SeleniumHubWaiter.wait unless using_cuprite?
- scroll_to_and_click(display_trigger_element)
+ scroll_to_and_click(display_trigger_element, block: :nearest)
SeleniumHubWaiter.wait unless using_cuprite?
end
diff --git a/spec/support/shared/scroll_into_view_helpers.rb b/spec/support/shared/scroll_into_view_helpers.rb
index d606f21529a..082c053363d 100644
--- a/spec/support/shared/scroll_into_view_helpers.rb
+++ b/spec/support/shared/scroll_into_view_helpers.rb
@@ -45,9 +45,9 @@ def scroll_to_element(element, block: :start, inline: :nearest)
end
end
-def scroll_to_and_click(element)
+def scroll_to_and_click(element, block: :start, inline: :nearest)
retry_block do
- scroll_to_element(element)
+ scroll_to_element(element, block:, inline:)
element.click
end
end