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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Rename admin tabs to content tabs
Inga Maidfbe71231546
diff --git a/app/views/common/_tabs.html.erb b/app/views/common/_tabs.html.erbindex e1774a3a10d..962fe0a512d 100644--- a/app/views/common/_tabs.html.erb+++ b/app/views/common/_tabs.html.erb@@ -26,12 +26,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See docs/COPYRIGHT.rdoc for more details.++#%>-<% gon.admin_tabs = { tabs: tabs.to_json.html_safe, selected: selected_tab.to_json.html_safe } %>+<% gon.content_tabs = { tabs: tabs.to_json.html_safe, selected: selected_tab.to_json.html_safe } %><%= nonced_javascript_tag do %><%= include_gon(need_tag: false) -%><% end %>-<admin-tabs></admin-tabs>+<content-tabs></content-tabs><%= content_tag 'div',render(partial: selected_tab[:partial], locals: { tab: selected_tab } ),diff --git a/frontend/src/app/modules/admin/openproject-admin.module.ts b/frontend/src/app/modules/admin/openproject-admin.module.tsindex b5643804622..8c8faea7b73 100644--- a/frontend/src/app/modules/admin/openproject-admin.module.ts+++ b/frontend/src/app/modules/admin/openproject-admin.module.ts@@ -33,7 +33,7 @@ import {GroupEditInPlaceComponent} from 'core-app/modules/admin/types/group-editimport {TypeFormAttributeGroupComponent} from 'core-app/modules/admin/types/attribute-group.component';import {DragulaModule} from 'ng2-dragula';import {TypeFormQueryGroupComponent} from "core-app/modules/admin/types/query-group.component";-import {AdminTabsComponent} from "core-app/modules/admin/tabs/admin-tabs.component";+import {ContentTabsComponent} from "core-app/modules/admin/tabs/content-tabs.component";@NgModule({imports: [@@ -47,11 +47,11 @@ import {AdminTabsComponent} from "core-app/modules/admin/tabs/admin-tabs.componeTypeFormQueryGroupComponent,TypeFormConfigurationComponent,GroupEditInPlaceComponent,- AdminTabsComponent+ ContentTabsComponent],entryComponents: [TypeFormConfigurationComponent,- AdminTabsComponent+ ContentTabsComponent]})export class OpenprojectAdminModule { }diff --git a/frontend/src/app/modules/admin/tabs/admin-tabs.component.ts b/frontend/src/app/modules/admin/tabs/content-tabs.component.tssimilarity index 69%rename from frontend/src/app/modules/admin/tabs/admin-tabs.component.tsrename to frontend/src/app/modules/admin/tabs/content-tabs.component.tsindex c5708fa6972..73447c7102c 100644--- a/frontend/src/app/modules/admin/tabs/admin-tabs.component.ts+++ b/frontend/src/app/modules/admin/tabs/content-tabs.component.ts@@ -39,57 +39,42 @@ import {I18nService} from "core-app/modules/common/i18n/i18n.service";import {ScrollableTabsComponent} from "core-app/modules/common/tabs/scrollable-tabs.component";-export const adminTabsSelector = 'admin-tabs';--interface Tab {- name:string;- partial:string;- label:string;-}+export const contentTabsSelector = 'content-tabs';@Component({- selector: adminTabsSelector,+ selector: contentTabsSelector,templateUrl: '/app/modules/common/tabs/scrollable-tabs.component.html'})-export class AdminTabsComponent extends ScrollableTabsComponent {- public myTabs:Tab[] = [];- public currentTab:Tab;-- public classes:string[] = ['admin--tabs', 'scrollable-tabs'];+export class ContentTabsComponent extends ScrollableTabsComponent {+ public gonTabs:{ name:string, partial:string, label:string }[];+ public currentTab:{ name:string, partial:string, label:string };- private gonData:any = this.gon.get('admin_tabs');+ public classes:string[] = ['content--tabs', 'scrollable-tabs'];constructor(readonly elementRef:ElementRef,readonly $state:StateService,readonly gon:GonService,readonly I18n:I18nService) {super();++ this.gonTabs = JSON.parse((this.gon.get('content_tabs') as any).tabs);+ this.currentTab = JSON.parse((this.gon.get('content_tabs') as any).selected);+// parse tabs from backend and map them to scrollable tabs structure- this.myTabs = jQuery.parseJSON(this.gonData.tabs);- this.tabs = jQuery.map(this.myTabs, (tab:Tab) => {+ this.tabs = this.gonTabs.map((tab:{ name:string, partial:string, label:string }) => {return {id: tab.name,- name: this.I18n.t('js.' + tab.label)+ name: this.I18n.t('js.' + tab.label),+ partial: window.location.pathname + '?tab=' + tab.name};});// highlight current tab- this.currentTab = jQuery.parseJSON(this.gonData.selected);this.currentTabId = this.currentTab.name;}-- public clickTab(tab:string) {- // set selected tab as current- this.currentTab = jQuery.grep(this.myTabs, thisTab => thisTab.name === tab)[0];-- // set correct partial for selected tab- this.partial = window.location.pathname + '?tab=' + this.currentTab.name;-- super.clickTab(tab);- }}DynamicBootstrapper.register({- selector: adminTabsSelector, cls: AdminTabsComponent+ selector: contentTabsSelector, cls: ContentTabsComponent});diff --git a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.html b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.htmlindex 34f95636091..6c05cd05151 100644--- a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.html+++ b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.html@@ -3,7 +3,7 @@<li *ngFor="let tab of tabs"[class.selected]="tab.id === currentTabId"[attr.tab-id]="tab.id">- <a [href]="partial" (click)="clickTab(tab.id)" [textContent]="tab.name"></a>+ <a [href]="tab.partial || '#'" (click)="clickTab(tab.id)" [textContent]="tab.name"></a></li></ul><div #scrollLeftBtn [hidden]="hideLeftButton"diff --git a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.tsindex 230cca7e243..c7805ae9e10 100644--- a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts+++ b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts@@ -1,5 +1,11 @@import {AfterViewInit, Component, ElementRef, ViewChild} from "@angular/core";+export interface Tab {+ id:string;+ name:string;+ partial?:string;+}+@Component({templateUrl: 'scrollable-tabs.component.html'})@@ -11,9 +17,8 @@ export class ScrollableTabsComponent implements AfterViewInit {@ViewChild('scrollLeftBtn', { static: true }) scrollLeftBtn:ElementRef;public currentTabId:string = '';- public tabs:{id:string, name:string}[] = [];+ public tabs:Tab[] = [];public classes:string[] = ['scrollable-tabs'];- public partial:string = '#';public hideLeftButton:boolean = true;public hideRightButton:boolean = true;