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

[31260] Correctly remove group key from attribute group

Oliver Güntherd4644c7c30f7
diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rb
index 1dd02c97c0e..62ba8d21e81 100644
--- a/app/helpers/types_helper.rb
+++ b/app/helpers/types_helper.rb
@@ -96,11 +96,12 @@ module ::TypesHelper
type.attribute_groups.map do |group|
{
type: group.group_type,
- key: group.key,
name: group.translated_key,
attributes: active_group_attributes_map(group, available, inactive),
query: query_to_query_props(group)
- }
+ }.tap do |group_obj|
+ group_obj[:key] = group.key if group.internal_key?
+ end
end
end
diff --git a/app/models/type/form_group.rb b/app/models/type/form_group.rb
index 224db2c255e..e06a863e85e 100644
--- a/app/models/type/form_group.rb
+++ b/app/models/type/form_group.rb
@@ -39,12 +39,18 @@ class Type::FormGroup
self.type = type
end
+ ##
+ # Returns the symbol key, if it is not translated
+ def internal_key?
+ key.is_a?(Symbol)
+ end
+
##
# Translate the given attribute group if its internal
# (== if it's a symbol)
def translated_key
- if key.is_a? Symbol
- I18n.t(Type.default_groups[key])
+ if internal_key?
+ I18n.t(Type.default_groups[key], default: key.to_s)
else
key
end
diff --git a/frontend/src/app/modules/admin/types/attribute-group.component.ts b/frontend/src/app/modules/admin/types/attribute-group.component.ts
index b6196634a96..eb42fca065a 100644
--- a/frontend/src/app/modules/admin/types/attribute-group.component.ts
+++ b/frontend/src/app/modules/admin/types/attribute-group.component.ts
@@ -23,7 +23,7 @@ export class TypeFormAttributeGroupComponent {
rename(newValue:string) {
this.group.name = newValue;
- this.group.key = null;
+ delete this.group.key;
this.cdRef.detectChanges();
}
diff --git a/frontend/src/app/modules/admin/types/group-edit-in-place.html b/frontend/src/app/modules/admin/types/group-edit-in-place.html
index 65440cf640e..27bdd2b5426 100644
--- a/frontend/src/app/modules/admin/types/group-edit-in-place.html
+++ b/frontend/src/app/modules/admin/types/group-edit-in-place.html
@@ -1,8 +1,8 @@
-<span *ngIf="!editing"
+<div *ngIf="!editing"
(click)="startEditing()"
[textContent]="name"
class="group-edit-handler">
-</span>
+</div>
<input
#nameInput
*ngIf="editing"
diff --git a/spec/features/types/form_configuration_spec.rb b/spec/features/types/form_configuration_spec.rb
index cef990d491d..029d3b5cb31 100644
--- a/spec/features/types/form_configuration_spec.rb
+++ b/spec/features/types/form_configuration_spec.rb
@@ -66,7 +66,7 @@ describe 'form configuration', type: :feature, js: true do
dialog.expect_open
dialog.cancel
- expect(page).to have_selector('span.group-edit-handler', text: 'WHATEVER')
+ expect(page).to have_selector('.group-edit-handler', text: 'WHATEVER')
# Click the dialog again after some time
# Otherwise this may cause issues due to the animation,