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

Get rid of `with_tab_nav` from the tab helper as all pages now use the Primer PageHeader and its tabNav. Thus we can also get rid of an old Angular component

Henriette Dargeda8ec0d4c11d
diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rb
index 3361afa0e25..edabf49a877 100644
--- a/app/helpers/tabs_helper.rb
+++ b/app/helpers/tabs_helper.rb
@@ -30,10 +30,10 @@
module TabsHelper
# Renders tabs and their content
- def render_tabs(tabs, form = nil, with_tab_nav: true)
+ def render_tabs(tabs, form = nil)
if tabs.any?
selected = selected_tab(tabs)
- render partial: "common/tabs", locals: { f: form, tabs:, selected_tab: selected, with_tab_nav: }
+ render partial: "common/tabs", locals: { f: form, tabs:, selected_tab: selected }
else
content_tag "p", I18n.t(:label_no_data), class: "nodata"
end
diff --git a/app/views/attribute_help_texts/index.html.erb b/app/views/attribute_help_texts/index.html.erb
index 9a308640566..0d9acdf282d 100644
--- a/app/views/attribute_help_texts/index.html.erb
+++ b/app/views/attribute_help_texts/index.html.erb
@@ -60,4 +60,4 @@ See COPYRIGHT and LICENSE files for more details.
end
%>
-<%= render_tabs tabs, with_tab_nav: false %>
+<%= render_tabs tabs %>
diff --git a/app/views/common/_tabs.html.erb b/app/views/common/_tabs.html.erb
index ade5ac4a876..0b062f081ea 100644
--- a/app/views/common/_tabs.html.erb
+++ b/app/views/common/_tabs.html.erb
@@ -28,10 +28,6 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% gon.contentTabs = { tabs: tabs.to_json.html_safe, selected: selected_tab.to_json.html_safe } %>
-<% if with_tab_nav %>
- <opce-content-tabs></opce-content-tabs>
-<% end %>
-
<%= content_tag "div",
render(partial: selected_tab[:partial], locals: local_assigns.merge(tab: selected_tab)),
id: "tab-content-#{selected_tab[:name]}",
diff --git a/app/views/custom_fields/index.html.erb b/app/views/custom_fields/index.html.erb
index 657483ce59a..1d897f5a3b9 100644
--- a/app/views/custom_fields/index.html.erb
+++ b/app/views/custom_fields/index.html.erb
@@ -46,4 +46,4 @@ See COPYRIGHT and LICENSE files for more details.
end
%>
-<%= render_tabs custom_fields_tabs, with_tab_nav: false %>
+<%= render_tabs custom_fields_tabs %>
diff --git a/app/views/custom_styles/show.html.erb b/app/views/custom_styles/show.html.erb
index cd3640a7575..ca02828492e 100644
--- a/app/views/custom_styles/show.html.erb
+++ b/app/views/custom_styles/show.html.erb
@@ -48,4 +48,4 @@ See COPYRIGHT and LICENSE files for more details.
</section>
<% end %>
-<%= render_tabs design_tabs, with_tab_nav: false %>
+<%= render_tabs design_tabs %>
diff --git a/app/views/groups/edit.html.erb b/app/views/groups/edit.html.erb
index ca051993d2c..0f2e7724e94 100644
--- a/app/views/groups/edit.html.erb
+++ b/app/views/groups/edit.html.erb
@@ -33,4 +33,4 @@ See COPYRIGHT and LICENSE files for more details.
<%= render Groups::EditPageHeaderComponent.new(group: @group, current_user:, tabs: tabs) %>
-<%= render_tabs tabs, with_tab_nav: false %>
+<%= render_tabs tabs %>
diff --git a/app/views/placeholder_users/edit.html.erb b/app/views/placeholder_users/edit.html.erb
index df3fa5fde4b..b332ed99fef 100644
--- a/app/views/placeholder_users/edit.html.erb
+++ b/app/views/placeholder_users/edit.html.erb
@@ -33,4 +33,4 @@ See COPYRIGHT and LICENSE files for more details.
<%= render PlaceholderUsers::EditPageHeaderComponent.new(placeholder_user: @placeholder_user, tabs: tabs) %>
-<%= render_tabs tabs, with_tab_nav: false %>
+<%= render_tabs tabs %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
index c3be219785d..d97a0481878 100644
--- a/app/views/users/edit.html.erb
+++ b/app/views/users/edit.html.erb
@@ -33,4 +33,4 @@ See COPYRIGHT and LICENSE files for more details.
<%= render Users::EditPageHeaderComponent.new(user: @user, current_user:, tabs: tabs) %>
-<%= render_tabs tabs, with_tab_nav: false %>
+<%= render_tabs tabs %>
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 4a55b7fbf0d..41cf9ee4ab6 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -193,7 +193,6 @@ import {
} from 'core-app/shared/components/op-non-working-days-list/op-non-working-days-list.component';
import { CopyToClipboardComponent } from 'core-app/shared/components/copy-to-clipboard/copy-to-clipboard.component';
import { GlobalSearchTitleComponent } from 'core-app/core/global_search/title/global-search-title.component';
-import { ContentTabsComponent } from 'core-app/shared/components/tabs/content-tabs/content-tabs.component';
import { PersistentToggleComponent } from 'core-app/shared/components/persistent-toggle/persistent-toggle.component';
import { TypeFormConfigurationComponent } from 'core-app/features/admin/types/type-form-configuration.component';
import { ToastsContainerComponent } from 'core-app/shared/components/toaster/toasts-container.component';
@@ -456,7 +455,6 @@ export class OpenProjectModule implements DoBootstrap {
registerCustomElement('opce-main-menu-resizer', MainMenuResizerComponent, { injector });
registerCustomElement('opce-copy-to-clipboard', CopyToClipboardComponent, { injector });
registerCustomElement('opce-global-search-title', GlobalSearchTitleComponent, { injector });
- registerCustomElement('opce-content-tabs', ContentTabsComponent, { injector });
registerCustomElement('opce-persistent-toggle', PersistentToggleComponent, { injector });
registerCustomElement('opce-admin-type-form-configuration', TypeFormConfigurationComponent, { injector });
registerCustomElement('opce-toasts-container', ToastsContainerComponent, { injector });
diff --git a/frontend/src/app/shared/components/tabs/content-tabs/content-tabs.component.sass b/frontend/src/app/shared/components/tabs/content-tabs/content-tabs.component.sass
deleted file mode 100644
index 64bd5def44e..00000000000
--- a/frontend/src/app/shared/components/tabs/content-tabs/content-tabs.component.sass
+++ /dev/null
@@ -1,3 +0,0 @@
-content-tabs
- min-height: 73px
- display: block
\ No newline at end of file
diff --git a/frontend/src/app/shared/components/tabs/content-tabs/content-tabs.component.ts b/frontend/src/app/shared/components/tabs/content-tabs/content-tabs.component.ts
deleted file mode 100644
index dc82ce8e035..00000000000
--- a/frontend/src/app/shared/components/tabs/content-tabs/content-tabs.component.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-//-- 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.
-//++
-
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Injector } from '@angular/core';
-import { GonService } from 'core-app/core/gon/gon.service';
-import { StateService } from '@uirouter/core';
-import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { ScrollableTabsComponent } from 'core-app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component';
-import { TabDefinition } from 'core-app/shared/components/tabs/tab.interface';
-
-
-interface GonTab extends TabDefinition {
- partial:string;
- label:string;
-}
-
-@Component({
- selector: 'opce-content-tabs',
- templateUrl: '../scrollable-tabs/scrollable-tabs.component.html',
- styleUrls: ['./content-tabs.component.sass'],
- changeDetection: ChangeDetectionStrategy.OnPush,
-})
-
-export class ContentTabsComponent extends ScrollableTabsComponent {
- public classes:string[] = ['content--tabs', 'scrollable-tabs'];
-
- constructor(
- readonly elementRef:ElementRef,
- protected readonly $state:StateService,
- readonly gon:GonService,
- cdRef:ChangeDetectorRef,
- readonly I18n:I18nService,
- public injector:Injector,
- ) {
- super($state, cdRef, injector);
-
- const gonTabs = JSON.parse((this.gon.get('contentTabs') as any).tabs);
- const currentTab = JSON.parse((this.gon.get('contentTabs') as any).selected);
-
- // parse tabs from backend and map them to scrollable tabs structure
- this.tabs = gonTabs.map((tab:GonTab) => ({
- id: tab.name,
- name: this.I18n.t(`js.${tab.label}`, { defaultValue: tab.label }),
- path: tab.path,
- }));
-
- // highlight current tab
- this.currentTabId = currentTab.name;
- }
-}
diff --git a/frontend/src/app/shared/components/tabs/openproject-tabs.module.ts b/frontend/src/app/shared/components/tabs/openproject-tabs.module.ts
index 3f4330c15b9..07d20132690 100644
--- a/frontend/src/app/shared/components/tabs/openproject-tabs.module.ts
+++ b/frontend/src/app/shared/components/tabs/openproject-tabs.module.ts
@@ -30,7 +30,6 @@ import { CommonModule } from '@angular/common';
import { UIRouterModule } from '@uirouter/angular';
import { FocusModule } from 'core-app/shared/directives/focus/focus.module';
import { AttributeHelpTextModule } from 'core-app/shared/components/attribute-help-texts/attribute-help-text.module';
-import { ContentTabsComponent } from 'core-app/shared/components/tabs/content-tabs/content-tabs.component';
import { ScrollableTabsComponent } from 'core-app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component';
import { TabCountComponent } from 'core-app/shared/components/tabs/tab-badges/tab-count.component';
import { IconModule } from 'core-app/shared/components/icon/icon.module';
@@ -48,7 +47,6 @@ import { IconModule } from 'core-app/shared/components/icon/icon.module';
],
declarations: [
ScrollableTabsComponent,
- ContentTabsComponent,
TabCountComponent,
],
})