From 2723df4ef8fc2076708662c0f0254fe840b465ff Mon Sep 17 00:00:00 2001 From: Mark Rosenberg <38965626+markdoeswork@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:34:56 -0400 Subject: [PATCH] [PLAY-1445] Use New Content Tag (#3548) A 2nd attempt of https://github.com/powerhome/playbook/pull/3497 Reverts powerhome/playbook#3518 --- .../playbook/pb_background/background.html.erb | 13 ++----------- playbook/app/pb_kits/playbook/pb_body/body.html.erb | 7 +------ .../pb_bread_crumbs/bread_crumb_item.html.erb | 7 +------ .../playbook/pb_bread_crumbs/bread_crumbs.html.erb | 7 +------ .../pb_kits/playbook/pb_caption/caption.html.erb | 7 +------ playbook/app/pb_kits/playbook/pb_card/card.html.erb | 8 +------- .../app/pb_kits/playbook/pb_detail/detail.html.erb | 7 +------ .../app/pb_kits/playbook/pb_dialog/dialog.html.erb | 7 +------ .../pb_kits/playbook/pb_dialog/dialog_body.html.erb | 7 +------ .../playbook/pb_dialog/dialog_footer.html.erb | 7 ++----- .../playbook/pb_dialog/dialog_header.html.erb | 7 +------ playbook/app/pb_kits/playbook/pb_flex/flex.html.erb | 6 +----- .../pb_kits/playbook/pb_hashtag/hashtag.html.erb | 7 +------ .../playbook/pb_highlight/highlight.html.erb | 6 +----- .../home_address_street.html.erb | 6 +----- 15 files changed, 17 insertions(+), 92 deletions(-) diff --git a/playbook/app/pb_kits/playbook/pb_background/background.html.erb b/playbook/app/pb_kits/playbook/pb_background/background.html.erb index 00d7daa871..c7668e1407 100644 --- a/playbook/app/pb_kits/playbook/pb_background/background.html.erb +++ b/playbook/app/pb_kits/playbook/pb_background/background.html.erb @@ -1,23 +1,14 @@ <% if object.image_url.present? %> - <%= content_tag(object.tag, - aria: object.aria, - data: object.data, - id: object.id, - class: object.classname, + <%= pb_content_tag(object.tag, style: "background-image: url('#{object.image_url}'); background-repeat: #{object.background_repeat}; background-size: #{object.background_size}; background-position: #{object.background_position};", - **combined_html_options ) do %> <%= content.presence %> <% end %> <% else %> - <%= content_tag(object.tag, - aria: object.aria, - data: object.data, - id: object.id, - class: object.classname, + <%= pb_content_tag(object.tag, style: object.custom_background_color ) do %> <%= content.presence %> diff --git a/playbook/app/pb_kits/playbook/pb_body/body.html.erb b/playbook/app/pb_kits/playbook/pb_body/body.html.erb index 99fe28cc3f..1b822d8312 100755 --- a/playbook/app/pb_kits/playbook/pb_body/body.html.erb +++ b/playbook/app/pb_kits/playbook/pb_body/body.html.erb @@ -1,8 +1,3 @@ -<%= content_tag(object.tag, - aria: object.aria, - id: object.id, - data: object.data, - class: object.classname, - **combined_html_options) do %> +<%= pb_content_tag(object.tag) do %> <%= object.content %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb b/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb index f613bd7a8d..677b1b7032 100644 --- a/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +++ b/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb @@ -1,9 +1,4 @@ -<%= content_tag(:div, - id: object.id, - data: object.data, - class: object.classname, - aria: object.aria, - **combined_html_options) do%> +<%= pb_content_tag do%> <%= content_tag(object.link ? 'a' : 'span', class: 'bread_crumb_item', href: object.link) do %> <%= content.presence %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb b/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb index 281545a11c..8e86c2ed56 100644 --- a/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +++ b/playbook/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb @@ -1,8 +1,3 @@ -<%= content_tag(:nav, - aria: object.aria, - id: object.id, - data: object.data, - class: object.classname, - **combined_html_options) do %> +<%= pb_content_tag(:nav) do %> <%= content.presence %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_caption/caption.html.erb b/playbook/app/pb_kits/playbook/pb_caption/caption.html.erb index 44986b8720..4925a27bdc 100755 --- a/playbook/app/pb_kits/playbook/pb_caption/caption.html.erb +++ b/playbook/app/pb_kits/playbook/pb_caption/caption.html.erb @@ -1,8 +1,3 @@ -<%= content_tag(object.tag, - aria: object.aria, - id: object.id, - data: object.data, - class: object.classname, - **combined_html_options) do %> +<%= pb_content_tag(object.tag) do %> <%= content.presence || object.text %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_card/card.html.erb b/playbook/app/pb_kits/playbook/pb_card/card.html.erb index 458f1e2b2e..197832b6d0 100755 --- a/playbook/app/pb_kits/playbook/pb_card/card.html.erb +++ b/playbook/app/pb_kits/playbook/pb_card/card.html.erb @@ -1,10 +1,4 @@ -<%= content_tag(object.tag, - id: object.id, - data: object.data, - class: object.classname, - aria: object.aria, - dark: object.dark, - **combined_html_options) do %> +<%= pb_content_tag(object.tag) do %> <%= content.presence %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_detail/detail.html.erb b/playbook/app/pb_kits/playbook/pb_detail/detail.html.erb index 0becdbba31..1b822d8312 100644 --- a/playbook/app/pb_kits/playbook/pb_detail/detail.html.erb +++ b/playbook/app/pb_kits/playbook/pb_detail/detail.html.erb @@ -1,8 +1,3 @@ -<%= content_tag(object.tag, - aria: object.aria, - class: object.classname, - data: object.data, - id: object.id, - **combined_html_options) do %> +<%= pb_content_tag(object.tag) do %> <%= object.content %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_dialog/dialog.html.erb b/playbook/app/pb_kits/playbook/pb_dialog/dialog.html.erb index 3e45b50774..697fb68ad7 100644 --- a/playbook/app/pb_kits/playbook/pb_dialog/dialog.html.erb +++ b/playbook/app/pb_kits/playbook/pb_dialog/dialog.html.erb @@ -1,10 +1,5 @@
> - <%= content_tag(:dialog, - aria: object.aria, - data: object.data, - id: object.id, - class: object.classname, - **combined_html_options) do %> + <%= pb_content_tag(:dialog) do %> <% if object.status === "" && object.title %> <%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb b/playbook/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb index 262584f71c..f03e43cabc 100644 --- a/playbook/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +++ b/playbook/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb @@ -1,8 +1,3 @@ -<%= content_tag(:div, - id: object.id, - data: object.data, - class: object.classname, - aria: object.aria, - **combined_html_options) do %> +<%= pb_content_tag do %> <%= content.presence || object.text %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb b/playbook/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb index ab3d2e382a..59775229c9 100644 --- a/playbook/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +++ b/playbook/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb @@ -1,8 +1,5 @@ -<%= content_tag(:div, - id: object.id, - data: object.data, - aria: object.aria, - **combined_html_options) do %> +<%= pb_content_tag(:div, class: "") do %> + <% 'excluded classname?' %> <% if object.confirm_button && object.cancel_button %> <%= pb_rails("flex", props: { classname:object.classname, spacing:"between", padding_x:"sm", padding:"sm", padding_bottom:"sm" }) do %> diff --git a/playbook/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb b/playbook/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb index aa4035b1b8..cce14d8d1d 100644 --- a/playbook/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +++ b/playbook/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb @@ -1,9 +1,4 @@ -<%= content_tag(:div, - id: object.id, - data: object.data, - class: object.sticky_header, - aria: object.aria, - **combined_html_options) do %> +<%= pb_content_tag(:div, class: object.sticky_header) do %> <%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %> <%= content.presence || object.title %> diff --git a/playbook/app/pb_kits/playbook/pb_flex/flex.html.erb b/playbook/app/pb_kits/playbook/pb_flex/flex.html.erb index 2109d1083e..919544cc91 100644 --- a/playbook/app/pb_kits/playbook/pb_flex/flex.html.erb +++ b/playbook/app/pb_kits/playbook/pb_flex/flex.html.erb @@ -1,7 +1,3 @@ -<%= content_tag(:div, - id: object.id, - data: object.data, - class: object.classname, - **combined_html_options) do %> +<%= pb_content_tag do %> <%= content.presence %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb b/playbook/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb index bf7fc67730..a5fad1d16f 100644 --- a/playbook/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +++ b/playbook/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb @@ -1,9 +1,4 @@ -<%= content_tag(:span, - aria: object.aria, - class: object.classname, - data: object.data, - id: object.id, - **combined_html_options) do %> +<%= pb_content_tag(:span) do %> <%= link_to object.url, target: object.link_option do %> <%= pb_rails("badge", props: { dark: object.dark, variant: "primary", text: object.hashtag_text }) %> <% end %> diff --git a/playbook/app/pb_kits/playbook/pb_highlight/highlight.html.erb b/playbook/app/pb_kits/playbook/pb_highlight/highlight.html.erb index 1c2ca09309..ec1b4f0e26 100644 --- a/playbook/app/pb_kits/playbook/pb_highlight/highlight.html.erb +++ b/playbook/app/pb_kits/playbook/pb_highlight/highlight.html.erb @@ -1,8 +1,4 @@ -<%= content_tag(:span, - id: object.id, - data: object.data, - class: object.classname, - **combined_html_options) do %> +<%= pb_content_tag(:span) do %> <%= content.presence || object.text %> diff --git a/playbook/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb b/playbook/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb index 3125dfc49e..a46cd967f5 100644 --- a/playbook/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +++ b/playbook/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb @@ -1,8 +1,4 @@ -<%= content_tag(:div, - id: object.id, - data: object.data, - class: object.classname, - **combined_html_options) do %> +<%= pb_content_tag do %> <%= pb_rails("home_address_street/#{emphasis}_emphasis", props: object.send("#{emphasis}_emphasis_props")) %> <% end %>