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: `component_wrapper` rendering

Aaron Contreras6874062bce4d
diff --git a/app/components/work_packages/share/modal_body_component.html.erb b/app/components/work_packages/share/modal_body_component.html.erb
index 701d0a4813f..d3c23d08325 100644
--- a/app/components/work_packages/share/modal_body_component.html.erb
+++ b/app/components/work_packages/share/modal_body_component.html.erb
@@ -1,60 +1,55 @@
<%=
- # Todo: doubled ID
- component_wrapper do
- # The identifier is a magic key also found in the wp-share modal template.
- turbo_frame_tag wrapper_key do
- flex_layout(data: { turbo: true }) do |modal_content|
- modal_content.with_row do
- if sharing_enabled?
- render(WorkPackages::Share::InviteUserFormComponent.new(
- work_package: @work_package))
- else
- render(Primer::Beta::Flash.new(icon: :info)) { I18n.t('work_package.sharing.permissions.denied') }
- end
+ component_wrapper(tag: 'turbo-frame') do
+ flex_layout(data: { turbo: true }) do |modal_content|
+ modal_content.with_row do
+ if sharing_enabled?
+ render(WorkPackages::Share::InviteUserFormComponent.new(work_package: @work_package))
+ else
+ render(Primer::Beta::Flash.new(icon: :info)) { I18n.t('work_package.sharing.permissions.denied') }
end
+ end
- if shared_users.empty?
- modal_content.with_row(mt: 3) do
- render(Primer::Beta::Blankslate.new(border: true)) do |component|
- component.with_visual_icon(icon: :people, size: :medium)
- component.with_heading(tag: :h2).with_content(I18n.t('work_package.sharing.text_empty_state_header') )
- component.with_description do
- flex_layout do |flex|
- flex.with_row(mb: 2) do
- render(Primer::Beta::Text.new(color: :subtle)) { I18n.t('work_package.sharing.text_empty_state_description') }
- end
+ if shared_users.empty?
+ modal_content.with_row(mt: 3) do
+ render(Primer::Beta::Blankslate.new(border: true)) do |component|
+ component.with_visual_icon(icon: :people, size: :medium)
+ component.with_heading(tag: :h2).with_content(I18n.t('work_package.sharing.text_empty_state_header') )
+ component.with_description do
+ flex_layout do |flex|
+ flex.with_row(mb: 2) do
+ render(Primer::Beta::Text.new(color: :subtle)) { I18n.t('work_package.sharing.text_empty_state_description') }
end
end
end
end
- else
- modal_content.with_row(mt: 3, data: { 'test-selector': 'op-share-wp-active-list'}) do
- render(Primer::Beta::BorderBox.new) do |invited_user_list|
- invited_user_list.with_header(color: :subtle, data: { 'test-selector': 'op-share-wp-active-count' }) do
- I18n.t('work_package.sharing.count', count: shared_users.count)
- end
+ end
+ else
+ modal_content.with_row(mt: 3, data: { 'test-selector': 'op-share-wp-active-list'}) do
+ render(Primer::Beta::BorderBox.new) do |invited_user_list|
+ invited_user_list.with_header(color: :subtle, data: { 'test-selector': 'op-share-wp-active-count' }) do
+ I18n.t('work_package.sharing.count', count: shared_users.count)
+ end
- shared_users.each do |user|
- share = user.work_package_shares.first
+ shared_users.each do |user|
+ share = user.work_package_shares.first
- invited_user_list.with_row(data: { 'test-selector': "op-share-wp-active-user-#{user.id}" }) do
- grid_layout('op-share-wp-modal-body--user-row', tag: :div, align_items: :center, classes: 'ellipsis') do |user_row_grid|
- user_row_grid.with_area(:user, tag: :div, classes: 'ellipsis') do
- render(Users::AvatarComponent.new(user: user, size: :medium))
- end
+ invited_user_list.with_row(data: { 'test-selector': "op-share-wp-active-user-#{user.id}" }) do
+ grid_layout('op-share-wp-modal-body--user-row', tag: :div, align_items: :center, classes: 'ellipsis') do |user_row_grid|
+ user_row_grid.with_area(:user, tag: :div, classes: 'ellipsis') do
+ render(Users::AvatarComponent.new(user: user, size: :medium))
+ end
- if sharing_enabled?
- user_row_grid.with_area(:button, tag: :div, color: :subtle) do
- render(WorkPackages::Share::PermissionButtonComponent.new(share:,
- data: { 'test-selector': 'op-share-wp-update-role' }))
- end
+ if sharing_enabled?
+ user_row_grid.with_area(:button, tag: :div, color: :subtle) do
+ render(WorkPackages::Share::PermissionButtonComponent.new(share:,
+ data: { 'test-selector': 'op-share-wp-update-role' }))
end
+ end
- if sharing_enabled?
- user_row_grid.with_area(:remove, tag: :div) do
- form_with url: work_packages_share_path(share), method: :delete do
- render(Primer::Beta::Button.new(type: :submit, scheme: :invisible)) { I18n.t('work_package.sharing.remove') }
- end
+ if sharing_enabled?
+ user_row_grid.with_area(:remove, tag: :div) do
+ form_with url: work_packages_share_path(share), method: :delete do
+ render(Primer::Beta::Button.new(type: :submit, scheme: :invisible)) { I18n.t('work_package.sharing.remove') }
end
end
end
diff --git a/app/components/work_packages/share/modal_body_component.rb b/app/components/work_packages/share/modal_body_component.rb
index c5e51aac5a4..e5579e5d3c1 100644
--- a/app/components/work_packages/share/modal_body_component.rb
+++ b/app/components/work_packages/share/modal_body_component.rb
@@ -30,7 +30,6 @@ module WorkPackages
module Share
class ModalBodyComponent < ApplicationComponent
include ApplicationHelper
- include Turbo::FramesHelper
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers