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

Fix/34711 swap background colors of sum rows and group rows (#8767)

Aleix Suau055086577d81
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 7addce935a7..5629b6786aa 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -445,6 +445,7 @@ en:
label_public_query: "Public"
label_sum: "Sum"
label_sum_for: "Sum for"
+ label_total_sum: "Total sum"
label_subject: "Subject"
label_this_week: "this week"
label_today: "Today"
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts
index 89097406e88..715fde05b1a 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts
@@ -14,7 +14,7 @@ export class GroupSumsBuilder extends SingleRowBuilder {
@InjectField() readonly schemaCache:SchemaCacheService;
@InjectField() readonly displayFieldService:DisplayFieldService;
- private text = {
+ public text = {
sum: this.I18n.t('js.label_sum')
};
@@ -44,6 +44,7 @@ export class GroupSumsBuilder extends SingleRowBuilder {
private appendFirstLabel(div:HTMLElement) {
const span = document.createElement('span');
span.textContent = `${this.text.sum}`;
+ span.title = `${this.text.sum}`;
div.prepend(span);
}
diff --git a/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.ts b/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.ts
index 13b864b018d..8b3aa78d219 100644
--- a/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.ts
+++ b/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.ts
@@ -66,7 +66,7 @@ export class WorkPackageTableSumsRowController implements AfterViewInit {
readonly I18n:I18nService) {
this.text = {
- sum: I18n.t('js.label_sum')
+ sum: I18n.t('js.label_total_sum')
};
}
@@ -105,6 +105,7 @@ export class WorkPackageTableSumsRowController implements AfterViewInit {
private render(columns:QueryColumn[], resource:WorkPackageCollectionResource, schema:SchemaResource) {
this.groupSumsBuilder = new GroupSumsBuilder(this.injector, this.workPackageTable);
+ this.groupSumsBuilder.text = this.text;
this.groupSumsBuilder.renderColumns(resource.totalSums!, this.elementRef.nativeElement);
}
}
diff --git a/frontend/src/app/components/wp-table/wp-table.directive.html b/frontend/src/app/components/wp-table/wp-table.directive.html
index 7ff375bd132..bcca81ff1d3 100644
--- a/frontend/src/app/components/wp-table/wp-table.directive.html
+++ b/frontend/src/app/components/wp-table/wp-table.directive.html
@@ -53,18 +53,22 @@
</td>
</tr>
</tbody>
- <tbody class="results-tbody work-package--results-tbody"></tbody>
+
+ <tbody class="results-tbody work-package--results-tbody">
+ </tbody>
+
+ <tbody>
+ <tr class="wp-table--sums-row wp-table--row"
+ wpTableSumsRow
+ [wpTableSumsRow-table]="workPackageTable">
+ </tr>
+ </tbody>
+
<tbody *ngIf="tableElement && configuration.inlineCreateEnabled"
wpInlineCreate
[wp-inline-create--table]="workPackageTable"
- [wp-inline-create--project-identifier]="projectIdentifier"
- >
+ [wp-inline-create--project-identifier]="projectIdentifier">
</tbody>
- <tfoot>
- <tr class="wp-table--sums-row wp-table--row"
- wpTableSumsRow
- [wpTableSumsRow-table]="workPackageTable"></tr>
- </tfoot>
</table>
</div>
diff --git a/frontend/src/global_styles/content/work_packages/_table_content.sass b/frontend/src/global_styles/content/work_packages/_table_content.sass
index 61a01176461..beca7d28ff8 100644
--- a/frontend/src/global_styles/content/work_packages/_table_content.sass
+++ b/frontend/src/global_styles/content/work_packages/_table_content.sass
@@ -55,10 +55,16 @@
.wp-table--cell-td
display: none !important
+ &.wp-table--sums-row:empty
+ height: 0
+
.wp-table--sum-container
font-weight: bold
padding: 3px 6px
+ &.__internal-sorthandle
+ white-space: nowrap
+
.work-package-table--container table.generic-table tbody td
padding-left: 0
padding-top: 0
diff --git a/spec/features/work_packages/index_sums_spec.rb b/spec/features/work_packages/index_sums_spec.rb
index 725fc9751d0..d0a805bbbc1 100644
--- a/spec/features/work_packages/index_sums_spec.rb
+++ b/spec/features/work_packages/index_sums_spec.rb
@@ -132,7 +132,7 @@ RSpec.feature 'Work package index sums', js: true do
# Expect the total sums row
expect(page).to have_selector('.wp-table--sums-row', count: 1)
- expect(page).to have_selector('.wp-table--sum-container', text: 'Sum')
+ expect(page).to have_selector('.wp-table--sum-container', text: 'Total sum')
expect(page).to have_selector('.wp-table--sum-container', text: '25')
expect(page).to have_selector('.wp-table--sum-container', text: '12')
expect(page).to have_selector('.wp-table--sum-container', text: '13.2')
@@ -147,7 +147,7 @@ RSpec.feature 'Work package index sums', js: true do
edit_field = wp_table.edit_field(work_package_1, :estimatedTime)
edit_field.update '20'
- expect(page).to have_selector('.wp-table--sum-container', text: 'Sum')
+ expect(page).to have_selector('.wp-table--sum-container', text: 'Total sum')
expect(page).to have_selector('.wp-table--sum-container', text: '35')
expect(page).to have_selector('.wp-table--sum-container', text: '12')
expect(page).to have_selector('.wp-table--sum-container', text: '13.2')
@@ -181,15 +181,15 @@ RSpec.feature 'Work package index sums', js: true do
expect(page).to have_selector(".wp-table--sum-container.customField#{float_cf.id}", text: '7.7')
# Total sums row is unchanged
- expect(page).to have_selector('tfoot .wp-table--sum-container', text: '35')
- expect(page).to have_selector("tfoot .wp-table--sum-container.customField#{int_cf.id}", text: '12')
- expect(page).to have_selector("tfoot .wp-table--sum-container.customField#{float_cf.id}", text: '13.2')
+ expect(page).to have_selector('tbody .wp-table--sum-container', text: '35')
+ expect(page).to have_selector("tbody .wp-table--sum-container.customField#{int_cf.id}", text: '12')
+ expect(page).to have_selector("tbody .wp-table--sum-container.customField#{float_cf.id}", text: '13.2')
# Unit costs
- expect(page).to have_selector('tfoot .wp-table--sum-container.materialCosts', text: '7.50')
+ expect(page).to have_selector('tbody .wp-table--sum-container.materialCosts', text: '7.50')
# Overall costs
- expect(page).to have_selector('tfoot .wp-table--sum-container.overallCosts', text: '22.50')
+ expect(page).to have_selector('tbody .wp-table--sum-container.overallCosts', text: '22.50')
# Labor costs
- expect(page).to have_selector('tfoot .wp-table--sum-container.laborCosts', text: '15.00')
+ expect(page).to have_selector('tbody .wp-table--sum-container.laborCosts', text: '15.00')
# Collapsing groups will also hide the sums row
page.find('.expander.icon-minus2', match: :first).click
@@ -197,7 +197,6 @@ RSpec.feature 'Work package index sums', js: true do
page.find('.expander.icon-minus2', match: :first).click
# Expect to have only the final sums
- expect(page).to have_selector('tbody .wp-table--sums-row', count: 0)
- expect(page).to have_selector('tfoot .wp-table--sums-row', count: 1)
+ expect(page).to have_selector('tbody .wp-table--sums-row', count: 1)
end
end