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

Display a special "Empty result" blankslate when filtering

Aaron Contreras82d3cba74579
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 02a0e91fad4..177f08ec96c 100644
--- a/app/components/work_packages/share/modal_body_component.html.erb
+++ b/app/components/work_packages/share/modal_body_component.html.erb
@@ -88,12 +88,24 @@
if @shares.blank?
border_box.with_row do
render(Primer::Beta::Blankslate.new) 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') }
+ if params[:filters].blank?
+ 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
+ else
+ component.with_visual_icon(icon: :search, size: :medium)
+ component.with_heading(tag: :h2).with_content(I18n.t('work_package.sharing.text_empty_search_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_search_description') }
+ end
end
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 33a79a1d5fa..353f322a381 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3276,8 +3276,10 @@ en:
view_description: "Can view this work package."
remove: "Remove"
share: "Share"
+ text_empty_search_description: "There are no users with the current filter criteria."
+ text_empty_search_header: "We couldn't find any matching results."
text_empty_state_description: "The work package has not been shared with anyone yet."
- text_empty_state_header: "No shared users"
+ text_empty_state_header: "No shared members."
text_user_limit_reached: "Adding additional users will exceed the current limit. Please contact an administrator to increase the user limit to ensure external users are able to access this work package."
text_user_limit_reached_admins: 'Adding additional users will exceed the current limit. Please <a href="%{upgrade_url}">upgrade your plan</a> to be able to add more users.'
warning_user_limit_reached: >
diff --git a/spec/features/work_packages/share/filter_spec.rb b/spec/features/work_packages/share/filter_spec.rb
index c39e46d319a..8e4cec39b13 100644
--- a/spec/features/work_packages/share/filter_spec.rb
+++ b/spec/features/work_packages/share/filter_spec.rb
@@ -268,7 +268,7 @@ RSpec.describe 'Work package sharing',
share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_member'))
share_modal.filter('role', I18n.t('work_package.sharing.permissions.view'))
- share_modal.expect_blankslate
+ share_modal.expect_empty_search_blankslate
share_modal.expect_shared_count_of(0)
share_modal.expect_select_all_untoggled
end
diff --git a/spec/support/components/work_packages/share_modal.rb b/spec/support/components/work_packages/share_modal.rb
index f4b1d9375d0..cae0dcd233d 100644
--- a/spec/support/components/work_packages/share_modal.rb
+++ b/spec/support/components/work_packages/share_modal.rb
@@ -194,6 +194,12 @@ module Components
end
end
+ def expect_empty_search_blankslate
+ within_modal do
+ expect(page).to have_text(I18n.t('work_package.sharing.text_empty_search_description'))
+ end
+ end
+
def invite_user(users, role_name)
Array(users).each do |user|
case user