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
Move timeline-grid block to BEM notation in preparation for using the non-working days API
Henriette Dargedf5869e1eedd
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.tsindex ab5ca5192d4..62c8871902f 100644--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts@@ -38,13 +38,13 @@ import {} from '../wp-timeline';import Moment = moment.Moment;-function checkForWeekendHighlight(date:Moment, cell:HTMLElement) {+function checkForNonWorkingDayHighlight(date:Moment, cell:HTMLElement) {const day = date.day();// Sunday = 0// Monday = 6if (day === 0 || day === 6) {- cell.classList.add('grid-weekend');+ cell.classList.add('wp-timeline--non-working-day');}}@@ -61,17 +61,17 @@ export class WorkPackageTableTimelineGrid implements AfterViewInit {public wpTimeline:WorkPackageTimelineTableController) {}- ngAfterViewInit() {+ ngAfterViewInit():void {const $element = jQuery(this.elementRef.nativeElement);this.gridContainer = $element.find('.wp-table-timeline--grid');this.wpTimeline.onRefreshRequested('grid', (vp:TimelineViewParameters) => this.refreshView(vp));}- refreshView(vp:TimelineViewParameters) {+ refreshView(vp:TimelineViewParameters):void {this.renderLabels(vp);}- private renderLabels(vp:TimelineViewParameters) {+ private renderLabels(vp:TimelineViewParameters):void {if (this.activeZoomLevel === vp.settings.zoomLevel) {return;}@@ -80,81 +80,88 @@ export class WorkPackageTableTimelineGrid implements AfterViewInit {switch (vp.settings.zoomLevel) {case 'days':- return this.renderLabelsDays(vp);+ this.renderLabelsDays(vp);+ break;case 'weeks':- return this.renderLabelsWeeks(vp);+ this.renderLabelsWeeks(vp);+ break;case 'months':- return this.renderLabelsMonths(vp);+ this.renderLabelsMonths(vp);+ break;case 'quarters':- return this.renderLabelsQuarters(vp);+ this.renderLabelsQuarters(vp);+ break;case 'years':- return this.renderLabelsYears(vp);+ this.renderLabelsYears(vp);+ break;+ default:+ return;}this.activeZoomLevel = vp.settings.zoomLevel;}- private renderLabelsDays(vp:TimelineViewParameters) {+ private renderLabelsDays(vp:TimelineViewParameters):void {this.renderTimeSlices(vp, 'day', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {cell.style.paddingTop = '1px';- checkForWeekendHighlight(start, cell);+ checkForNonWorkingDayHighlight(start, cell);});this.renderTimeSlices(vp, 'year', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');cell.style.zIndex = '2';});}- private renderLabelsWeeks(vp:TimelineViewParameters) {+ private renderLabelsWeeks(vp:TimelineViewParameters):void {this.renderTimeSlices(vp, 'day', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- checkForWeekendHighlight(start, cell);+ checkForNonWorkingDayHighlight(start, cell);});this.renderTimeSlices(vp, 'week', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');});this.renderTimeSlices(vp, 'year', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');cell.style.zIndex = '2';});}- private renderLabelsMonths(vp:TimelineViewParameters) {- this.renderTimeSlices(vp, 'week', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {+ private renderLabelsMonths(vp:TimelineViewParameters):void {+ this.renderTimeSlices(vp, 'week', vp.dateDisplayStart, vp.dateDisplayEnd, () => {});this.renderTimeSlices(vp, 'month', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');});this.renderTimeSlices(vp, 'year', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');cell.style.zIndex = '2';});}- private renderLabelsQuarters(vp:TimelineViewParameters) {- this.renderTimeSlices(vp, 'month', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {+ private renderLabelsQuarters(vp:TimelineViewParameters):void {+ this.renderTimeSlices(vp, 'month', vp.dateDisplayStart, vp.dateDisplayEnd, () => {});this.renderTimeSlices(vp, 'quarter', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');});this.renderTimeSlices(vp, 'year', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');cell.style.zIndex = '2';});}- private renderLabelsYears(vp:TimelineViewParameters) {- this.renderTimeSlices(vp, 'month', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {+ private renderLabelsYears(vp:TimelineViewParameters):void {+ this.renderTimeSlices(vp, 'month', vp.dateDisplayStart, vp.dateDisplayEnd, () => {});this.renderTimeSlices(vp, 'year', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {- cell.classList.add('-grid-highlight');+ cell.classList.add('wp-timeline--grid-element_highlight');});}@@ -162,7 +169,7 @@ export class WorkPackageTableTimelineGrid implements AfterViewInit {unit:moment.unitOfTime.DurationConstructor,startView:Moment,endView:Moment,- cellCallback:(start:Moment, cell:HTMLElement) => void) {+ cellCallback:(start:Moment, cell:HTMLElement) => void):void {const { inViewportAndBoundaries, rest } = getTimeSlicesForHeader(vp, unit, startView, endView);for (const [start, end] of inViewportAndBoundaries) {diff --git a/frontend/src/global_styles/content/work_packages/timelines/_grid.sass b/frontend/src/global_styles/content/work_packages/timelines/_grid.sassindex 5864148f4ba..86ca441f86e 100644--- a/frontend/src/global_styles/content/work_packages/timelines/_grid.sass+++ b/frontend/src/global_styles/content/work_packages/timelines/_grid.sass@@ -1,12 +1,13 @@-.wp-timeline--grid-element- position: absolute- top: 0- padding-top: 5px- height: 100%- border-right: 1px solid var(--timeline--grid-color)+.wp-timeline+ &--grid-element+ position: absolute+ top: 0+ padding-top: 5px+ height: 100%+ border-right: 1px solid var(--timeline--grid-color)- &.-grid-highlight- border-right: 1px solid var(--timeline--header-border-color)+ &_highlight+ border-right: 1px solid var(--timeline--header-border-color)- &.grid-weekend+ &--non-working-daybackground-color: #f5f5f5