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

Add blankslate

Oliver Günthercd2aea31e82f
diff --git a/app/components/op_primer/border_box_table_component.html.erb b/app/components/op_primer/border_box_table_component.html.erb
index 6b28c0c49e1..60a5ca6177b 100644
--- a/app/components/op_primer/border_box_table_component.html.erb
+++ b/app/components/op_primer/border_box_table_component.html.erb
@@ -44,9 +44,13 @@ See COPYRIGHT and LICENSE files for more details.
end
end
- rows.each do |row|
- component.with_row(scheme: :default) do
- render(row_class.new(row:, table: self))
+ component.with_row(scheme: :default) do
+ if rows.empty?
+ render_blank_slate
+ else
+ rows.each do |row|
+ render(row_class.new(row:, table: self))
+ end
end
end
end
diff --git a/app/components/op_primer/border_box_table_component.rb b/app/components/op_primer/border_box_table_component.rb
index 84f5dee8361..f0a464c8c6f 100644
--- a/app/components/op_primer/border_box_table_component.rb
+++ b/app/components/op_primer/border_box_table_component.rb
@@ -54,5 +54,25 @@ module OpPrimer
def sortable?
false
end
+
+ def render_blank_slate
+ render(Primer::Beta::Blankslate.new(border: false)) do |component|
+ component.with_visual_icon(icon: blank_icon, size: :medium) if blank_icon
+ component.with_heading(tag: :h2) { blank_title }
+ component.with_description { blank_description }
+ end
+ end
+
+ def blank_title
+ I18n.t(:label_nothing_display)
+ end
+
+ def blank_description
+ I18n.t(:no_results_title_text)
+ end
+
+ def blank_icon
+ nil
+ end
end
end
diff --git a/modules/auth_saml/app/components/saml/providers/table_component.rb b/modules/auth_saml/app/components/saml/providers/table_component.rb
index af0fb5b91bb..fde31d890db 100644
--- a/modules/auth_saml/app/components/saml/providers/table_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/table_component.rb
@@ -21,6 +21,18 @@ module Saml
['users', { caption: I18n.t(:label_user_plural) }]
]
end
+
+ def blank_title
+ I18n.t('saml.providers.label_empty_title')
+ end
+
+ def blank_description
+ I18n.t('saml.providers.label_empty_description')
+ end
+
+ def blank_icon
+ :key
+ end
end
end
end