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

Better table rendering

Oliver Günther1970bed7ffbb
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 f7488e61583..293aa2d79ed 100644
--- a/app/components/op_primer/border_box_table_component.html.erb
+++ b/app/components/op_primer/border_box_table_component.html.erb
@@ -44,13 +44,13 @@ See COPYRIGHT and LICENSE files for more details.
end
end
- component.with_row(scheme: :default) do
- if rows.empty?
- render_blank_slate
- else
- rows.each do |row|
- concat render(row_class.new(row:, table: self))
- end
+ if rows.empty?
+ component.with_row(scheme: :default) { render_blank_slate }
+ end
+
+ rows.each do |row|
+ component.with_row(scheme: :default) do
+ render(row_class.new(row:, table: self))
end
end
end
diff --git a/modules/auth_saml/app/components/saml/providers/row_component.rb b/modules/auth_saml/app/components/saml/providers/row_component.rb
index d76e40b5f18..bf52b4957d0 100644
--- a/modules/auth_saml/app/components/saml/providers/row_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/row_component.rb
@@ -5,18 +5,27 @@ module Saml
model
end
+ def column_args(column)
+ if column == :name
+ { style: "grid-column: span 3" }
+ else
+ super
+ end
+ end
+
def name
concat render(Primer::Beta::Link.new(
- scheme: :primary,
- href: url_for(action: :show, id: provider.id)
- )) { provider.display_name || provider.name }
+ scheme: :primary,
+ href: url_for(action: :show, id: provider.id)
+ )) { provider.display_name || provider.name }
if provider.idp_sso_service_url
concat render(Primer::Beta::Text.new(
- tag: :p,
- font_size: :small,
- color: :subtle
- )) { provider.idp_sso_service_url }
+ tag: :p,
+ classes: "-break-word",
+ font_size: :small,
+ color: :subtle
+ )) { provider.idp_sso_service_url }
end
end
@@ -26,7 +35,7 @@ module Saml
def edit_link
link_to(
- helpers.op_icon('icon icon-edit button--link'),
+ helpers.op_icon("icon icon-edit button--link"),
url_for(action: :edit, id: provider.id),
title: t(:button_edit)
)
@@ -48,7 +57,7 @@ module Saml
return if provider.readonly
link_to(
- helpers.op_icon('icon icon-delete button--link'),
+ helpers.op_icon("icon icon-delete button--link"),
url_for(action: :destroy, id: provider.id),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
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 564072dc3dc..fd9d403a57e 100644
--- a/modules/auth_saml/app/components/saml/providers/table_component.rb
+++ b/modules/auth_saml/app/components/saml/providers/table_component.rb
@@ -7,29 +7,37 @@ module Saml
%i[id asc]
end
+ def header_args(column)
+ if column == :name
+ { style: "grid-column: span 3" }
+ else
+ super
+ end
+ end
+
def sortable?
false
end
def empty_row_message
- I18n.t 'saml.providers.no_results_table'
+ I18n.t "saml.providers.no_results_table"
end
def headers
[
- ['name', { caption: I18n.t('attributes.name') }],
- ['users', { caption: I18n.t(:label_user_plural) }],
- ['creator', { caption: I18n.t("js.label_created_by") }],
- ['created_at', { caption: Saml::Provider.human_attribute_name(:created_at) }]
+ [:name, { caption: I18n.t("attributes.name") }],
+ [:users, { caption: I18n.t(:label_user_plural) }],
+ [:creator, { caption: I18n.t("js.label_created_by") }],
+ [:created_at, { caption: Saml::Provider.human_attribute_name(:created_at) }]
]
end
def blank_title
- I18n.t('saml.providers.label_empty_title')
+ I18n.t("saml.providers.label_empty_title")
end
def blank_description
- I18n.t('saml.providers.label_empty_description')
+ I18n.t("saml.providers.label_empty_description")
end
def blank_icon
diff --git a/modules/auth_saml/app/components/saml/providers/view_component.html.erb b/modules/auth_saml/app/components/saml/providers/view_component.html.erb
index 58e9b882b0e..32e51ae50ee 100644
--- a/modules/auth_saml/app/components/saml/providers/view_component.html.erb
+++ b/modules/auth_saml/app/components/saml/providers/view_component.html.erb
@@ -23,5 +23,13 @@
render(Saml::Providers::Sections::MetadataComponent.new(provider))
end
end
+
+ component.with_row(scheme: :default) do
+ if edit_state == :configuration
+ render(Saml::Providers::Sections::ConfigurationFormComponent.new(provider))
+ else
+ render(Saml::Providers::Sections::ConfigurationComponent.new(provider))
+ end
+ end
end
%>