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

Move user profile page to SidePanel component

Oliver Günther3162631d1222
diff --git a/Gemfile b/Gemfile
index 6619165004f..726dc203ca1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -392,4 +392,4 @@ end
gem "openproject-octicons", "~>19.15.0"
gem "openproject-octicons_helper", "~>19.15.0"
-gem "openproject-primer_view_components", "~>0.36.2"
+gem "openproject-primer_view_components", "~>0.37.0"
diff --git a/Gemfile.lock b/Gemfile.lock
index 8eb60222f86..4927c3635b1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -776,7 +776,7 @@ GEM
actionview
openproject-octicons (= 19.15.0)
railties
- openproject-primer_view_components (0.36.2)
+ openproject-primer_view_components (0.37.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
openproject-octicons (>= 19.15.0)
@@ -1266,7 +1266,7 @@ DEPENDENCIES
openproject-octicons (~> 19.15.0)
openproject-octicons_helper (~> 19.15.0)
openproject-openid_connect!
- openproject-primer_view_components (~> 0.36.2)
+ openproject-primer_view_components (~> 0.37.0)
openproject-recaptcha!
openproject-reporting!
openproject-storages!
diff --git a/app/components/users/profile/attributes_component.html.erb b/app/components/users/profile/attributes_component.html.erb
index b8ac21cadab..f6dac59e953 100644
--- a/app/components/users/profile/attributes_component.html.erb
+++ b/app/components/users/profile/attributes_component.html.erb
@@ -1,47 +1,31 @@
<%=
- component_wrapper do
- flex_layout(mt: 3) do |details_container|
- details_container.with_row do
- flex_layout(align_items: :center, justify_content: :space_between) do |heading|
- heading.with_column(flex: 1) do
- render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_information) }
- end
+ render(Primer::OpenProject::SidePanel::Section.new) do |section|
+ section.with_title { t(:label_information) }
- if User.current.admin? || User.current == @user
- heading.with_column do
- render(Primer::Beta::IconButton.new(
- icon: :gear,
- scheme: :invisible,
- tag: :a,
- "aria-label": t(:label_manage),
- href: User.current == @user ? my_account_path : edit_user_path(@user)
- ))
- end
+ component_wrapper do
+ flex_layout do |details_container|
+ if @user.pref.can_expose_mail?
+ details_container.with_row(font_weight: :bold) do
+ User.human_attribute_name(:mail)
end
- end
- end
-
- if @user.pref.can_expose_mail?
- details_container.with_row(mt: 2, font_weight: :bold) do
- User.human_attribute_name(:mail)
- end
- details_container.with_row do
- mail_to(escape_javascript(@user.mail), nil, encode: 'javascript')
+ details_container.with_row do
+ mail_to(escape_javascript(@user.mail), nil, encode: 'javascript')
+ end
end
- end
- visible_custom_fields.each do |custom_field|
- details_container.with_row(mt: 2, font_weight: :bold, test_selector: "user-custom-field") do
- custom_field.name
- end
+ visible_custom_fields.each do |custom_field|
+ details_container.with_row(mt: 2, font_weight: :bold, test_selector: "user-custom-field") do
+ custom_field.name
+ end
- details_container.with_row do
- value = @user.formatted_custom_value_for(custom_field)
- if value.is_a?(Array)
- safe_join(value, ", ")
- else
- value
+ details_container.with_row do
+ value = @user.formatted_custom_value_for(custom_field)
+ if value.is_a?(Array)
+ safe_join(value, ", ")
+ else
+ value
+ end
end
end
end
diff --git a/app/components/users/profile/groups_component.html.erb b/app/components/users/profile/groups_component.html.erb
index 617e88fe3ef..cf81ed045d5 100644
--- a/app/components/users/profile/groups_component.html.erb
+++ b/app/components/users/profile/groups_component.html.erb
@@ -1,41 +1,21 @@
<%=
- component_wrapper do
- flex_layout(mt: 3) do |details_container|
- details_container.with_row do
- flex_layout(align_items: :center, justify_content: :space_between) do |heading|
- heading.with_column(flex: 1) do
- flex_layout(align_items: :center) do |title|
- title.with_column(mr: 2) do
- render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_group_plural) }
- end
+ render(Primer::OpenProject::SidePanel::Section.new) do |section|
+ section.with_title { t(:label_group_plural) }
+ section.with_counter(count: @groups.count, scheme: :primary)
- title.with_column do
- render(Primer::Beta::Counter.new(count: @groups.count, scheme: :primary))
- end
- end
- end
-
- if User.current.admin?
- heading.with_column do
- render(Primer::Beta::IconButton.new(
- icon: :gear,
- scheme: :invisible,
- tag: :a,
- "aria-label": t(:label_manage),
- href: edit_user_path(@user, tab: :groups)
- ))
- end
- end
- end
- end
+ if User.current.admin?
+ section.with_action_icon(
+ icon: :gear,
+ tag: :a,
+ "aria-label": t(:label_manage),
+ href: edit_user_path(@user, tab: :groups)
+ )
+ end
- details_container.with_row(mt: 2) do
- render(OpPrimer::ExpandableListComponent.new) do |list|
- @groups.each do |group|
- list.with_element do
- helpers.avatar(group, size: :mini, hide_name: false)
- end
- end
+ render(OpPrimer::ExpandableListComponent.new) do |list|
+ @groups.each do |group|
+ list.with_element do
+ helpers.avatar(group, size: :mini, hide_name: false)
end
end
end
diff --git a/app/components/users/profile/projects_component.html.erb b/app/components/users/profile/projects_component.html.erb
index e34f88105de..5794a8fa877 100644
--- a/app/components/users/profile/projects_component.html.erb
+++ b/app/components/users/profile/projects_component.html.erb
@@ -1,44 +1,24 @@
<%=
- component_wrapper do
- flex_layout(mt: 3) do |details_container|
- details_container.with_row do
- flex_layout(align_items: :center, justify_content: :space_between) do |heading|
- heading.with_column(flex: 1) do
- flex_layout(align_items: :center) do |title|
- title.with_column(mr: 2) do
- render(Primer::Beta::Heading.new(tag: :h4)) { t(:label_project_plural) }
- end
+ render(Primer::OpenProject::SidePanel::Section.new) do |section|
+ section.with_title { t(:label_project_plural) }
+ section.with_counter(count: @memberships.count, scheme: :primary)
- title.with_column do
- render(Primer::Beta::Counter.new(count: @memberships.count, scheme: :primary))
- end
- end
- end
-
- if User.current.admin?
- heading.with_column do
- render(Primer::Beta::IconButton.new(
- icon: :gear,
- scheme: :invisible,
- tag: :a,
- "aria-label": t(:label_manage),
- href: edit_user_path(@user, tab: :memberships)
- ))
- end
- end
- end
- end
+ if User.current.admin?
+ section.with_action_icon(
+ icon: :gear,
+ tag: :a,
+ "aria-label": t(:label_manage),
+ href: edit_user_path(@user, tab: :memberships)
+ )
+ end
- details_container.with_row(mt: 2) do
- render(OpPrimer::ExpandableListComponent.new) do |list|
- @memberships.each do |membership|
- list.with_element do
- concat helpers.link_to_project(membership.project)
+ render(OpPrimer::ExpandableListComponent.new) do |list|
+ @memberships.each do |membership|
+ list.with_element do
+ concat helpers.link_to_project(membership.project)
- roles = membership.roles.sort.collect(&:to_s).join(', ')
- concat render(Primer::Beta::Text.new(ml: 1, color: :subtle, font_size: :small)) { "(#{roles})" }
- end
- end
+ roles = membership.roles.sort.collect(&:to_s).join(', ')
+ concat render(Primer::Beta::Text.new(ml: 1, color: :subtle, font_size: :small)) { "(#{roles})" }
end
end
end
diff --git a/app/components/users/profile/sidebar_component.html.erb b/app/components/users/profile/side_panel_component.html.erb
similarity index 60%
rename from app/components/users/profile/sidebar_component.html.erb
rename to app/components/users/profile/side_panel_component.html.erb
index 50298f772d0..0d426180cde 100644
--- a/app/components/users/profile/sidebar_component.html.erb
+++ b/app/components/users/profile/side_panel_component.html.erb
@@ -1,14 +1,12 @@
<%=
component_wrapper do
- render(Primer::OpenProject::BorderGrid.new(spacious: true)) do |border_grid|
+ render(Primer::OpenProject::SidePanel.new(spacious: true)) do |panel|
[
Users::Profile::AttributesComponent.new(user: @user),
Users::Profile::GroupsComponent.new(user: @user),
Users::Profile::ProjectsComponent.new(user: @user)
].each do |component|
- if component.render?
- border_grid.with_row { render(component) }
- end
+ panel.with_section(component)
end
end
end
diff --git a/app/components/users/profile/sidebar_component.rb b/app/components/users/profile/side_panel_component.rb
similarity index 92%
rename from app/components/users/profile/sidebar_component.rb
rename to app/components/users/profile/side_panel_component.rb
index b0509e70ded..53620023076 100644
--- a/app/components/users/profile/sidebar_component.rb
+++ b/app/components/users/profile/side_panel_component.rb
@@ -28,7 +28,7 @@
module Users
module Profile
- class SidebarComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
+ class SidePanelComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
include ApplicationHelper
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
diff --git a/app/components/users/profile_component.html.erb b/app/components/users/profile_component.html.erb
index 5d5336dbb70..b018104abc6 100644
--- a/app/components/users/profile_component.html.erb
+++ b/app/components/users/profile_component.html.erb
@@ -13,7 +13,7 @@
end
content.with_sidebar(row_placement: :start, col_placement: :end) do
- render(Users::Profile::SidebarComponent.new(user: @user))
+ render(Users::Profile::SidePanelComponent.new(user: @user))
end
end
%>
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 1a123310334..f01a67f3196 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -47,7 +47,7 @@
"@ngneat/content-loader": "^7.0.0",
"@ngx-formly/core": "^6.1.4",
"@openproject/octicons-angular": "^19.15.0",
- "@openproject/primer-view-components": "^0.36.2",
+ "@openproject/primer-view-components": "^0.37.0",
"@openproject/reactivestates": "^3.0.1",
"@primer/css": "^21.3.3",
"@types/hotwired__turbo": "^8.0.1",
@@ -4816,9 +4816,9 @@
}
},
"node_modules/@openproject/primer-view-components": {
- "version": "0.36.2",
- "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.36.2.tgz",
- "integrity": "sha512-2q3QshalAClN1qAHL65AUPrXYo1bC9TP6a9yItkXxomb46+mvjkc45k7lrkDiNUUg12vbeLCTiqqCg4Q10jtSA==",
+ "version": "0.37.0",
+ "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.37.0.tgz",
+ "integrity": "sha512-JkTHoLb2B9zaQXLJpboyB+XRkLxhpPrH3PDMVgZAZsO6kNsW0+8ZAUceyGM8t4eh3R6zTrRzXG7qy7ALkhYGww==",
"license": "MIT",
"dependencies": {
"@github/auto-check-element": "^5.2.0",
@@ -4884,9 +4884,9 @@
},
"node_modules/@primer/view-components": {
"name": "@openproject/primer-view-components",
- "version": "0.36.2",
- "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.36.2.tgz",
- "integrity": "sha512-2q3QshalAClN1qAHL65AUPrXYo1bC9TP6a9yItkXxomb46+mvjkc45k7lrkDiNUUg12vbeLCTiqqCg4Q10jtSA==",
+ "version": "0.37.0",
+ "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.37.0.tgz",
+ "integrity": "sha512-JkTHoLb2B9zaQXLJpboyB+XRkLxhpPrH3PDMVgZAZsO6kNsW0+8ZAUceyGM8t4eh3R6zTrRzXG7qy7ALkhYGww==",
"license": "MIT",
"dependencies": {
"@github/auto-check-element": "^5.2.0",
@@ -25360,9 +25360,9 @@
}
},
"@openproject/primer-view-components": {
- "version": "0.36.2",
- "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.36.2.tgz",
- "integrity": "sha512-2q3QshalAClN1qAHL65AUPrXYo1bC9TP6a9yItkXxomb46+mvjkc45k7lrkDiNUUg12vbeLCTiqqCg4Q10jtSA==",
+ "version": "0.37.0",
+ "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.37.0.tgz",
+ "integrity": "sha512-JkTHoLb2B9zaQXLJpboyB+XRkLxhpPrH3PDMVgZAZsO6kNsW0+8ZAUceyGM8t4eh3R6zTrRzXG7qy7ALkhYGww==",
"requires": {
"@github/auto-check-element": "^5.2.0",
"@github/auto-complete-element": "^3.6.2",
@@ -25408,7 +25408,7 @@
"integrity": "sha512-h2ITbCj415T1JpWQDeQd1xYL6TrzkehfUOXxnV0FpblYyMsVBAks6LL7HGJ+ZrydG+Ds0i1rvvi8Q61jErieNA==",
"requires": {
"@primer/primitives": "^8.2.0",
- "@primer/view-components": "npm:@openproject/primer-view-components@^0.36.2"
+ "@primer/view-components": "npm:@openproject/primer-view-components@^0.37.0"
}
},
"@primer/primitives": {
@@ -25417,9 +25417,9 @@
"integrity": "sha512-K8A/DA6xv8P/kD/9DupFn+KYlo06OpcrwfwJf+sKp+KnX7ZRwLLDg1AaEGAoRoaykXRY/gfrXlgDfK7laOTWyA=="
},
"@primer/view-components": {
- "version": "npm:@openproject/[email protected]",
- "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.36.2.tgz",
- "integrity": "sha512-2q3QshalAClN1qAHL65AUPrXYo1bC9TP6a9yItkXxomb46+mvjkc45k7lrkDiNUUg12vbeLCTiqqCg4Q10jtSA==",
+ "version": "npm:@openproject/[email protected]",
+ "resolved": "https://registry.npmjs.org/@openproject/primer-view-components/-/primer-view-components-0.37.0.tgz",
+ "integrity": "sha512-JkTHoLb2B9zaQXLJpboyB+XRkLxhpPrH3PDMVgZAZsO6kNsW0+8ZAUceyGM8t4eh3R6zTrRzXG7qy7ALkhYGww==",
"requires": {
"@github/auto-check-element": "^5.2.0",
"@github/auto-complete-element": "^3.6.2",
diff --git a/frontend/package.json b/frontend/package.json
index 767e66bdd36..4240f339ee3 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -98,7 +98,7 @@
"@ngneat/content-loader": "^7.0.0",
"@ngx-formly/core": "^6.1.4",
"@openproject/octicons-angular": "^19.15.0",
- "@openproject/primer-view-components": "^0.36.2",
+ "@openproject/primer-view-components": "^0.37.0",
"@openproject/reactivestates": "^3.0.1",
"@primer/css": "^21.3.3",
"@types/hotwired__turbo": "^8.0.1",
@@ -175,6 +175,6 @@
"generate-typings": "tsc -d -p src/tsconfig.app.json"
},
"overrides": {
- "@primer/view-components": "npm:@openproject/primer-view-components@^0.36.2"
+ "@primer/view-components": "npm:@openproject/primer-view-components@^0.37.0"
}
}