From 5880e9f9b0038e971864b0e9582d2e38a2442820 Mon Sep 17 00:00:00 2001 From: Kirill Platonov Date: Fri, 9 Feb 2024 15:35:53 +0100 Subject: [PATCH] Add `polaris_html_classes` helper --- app/helpers/polaris/view_helper.rb | 4 ++++ demo/app/views/layouts/application.html.erb | 2 +- lib/install/install.rb | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/helpers/polaris/view_helper.rb b/app/helpers/polaris/view_helper.rb index 56992074..2a98657e 100644 --- a/app/helpers/polaris/view_helper.rb +++ b/app/helpers/polaris/view_helper.rb @@ -110,6 +110,10 @@ def polaris_icon_source(name) doc.to_html.html_safe end + def polaris_html_classes + "Polaris-Summer-Editions-2023" + end + def polaris_html_styles %(--pc-frame-global-ribbon-height:0px; --pc-frame-offset:0px;) end diff --git a/demo/app/views/layouts/application.html.erb b/demo/app/views/layouts/application.html.erb index 51057b7d..34b34b7f 100644 --- a/demo/app/views/layouts/application.html.erb +++ b/demo/app/views/layouts/application.html.erb @@ -1,5 +1,5 @@ - + Demo diff --git a/lib/install/install.rb b/lib/install/install.rb index d9e41825..24d0f2d8 100644 --- a/lib/install/install.rb +++ b/lib/install/install.rb @@ -8,20 +8,20 @@ insert_into_file APPLICATION_LAYOUT_PATH.to_s, "\n <%= stylesheet_link_tag \"polaris_view_components\" %>", before: /\s*<\/head>/ if File.read(APPLICATION_LAYOUT_PATH).include?("") - say "Add Polaris inline styles for in application layout" - gsub_file APPLICATION_LAYOUT_PATH.to_s, "\"" + say "Add Polaris classes and inline styles for in application layout" + gsub_file APPLICATION_LAYOUT_PATH.to_s, "\" style=\"<%= polaris_html_styles %>\"" say "Add Polaris inline styles for in application layout" gsub_file APPLICATION_LAYOUT_PATH.to_s, "", "\">" else say " tag is not found in application layout.", :red - say " Replace with \"> in your custom layour." + say " Replace with \" style=\"<%= polaris_html_styles %>\"> in your custom layour." say " Replace with \"> in your custom layour." end else say "Default application.html.erb is missing!", :red say " 1. Add <%= stylesheet_link_tag \"polaris_view_components\" %> within the tag in your custom layout." - say " 2. Replace with \"> in your custom layour." + say " 2. Replace with \" style=\"<%= polaris_html_styles %>\"> in your custom layour." say " 3. Replace with \"> in your custom layour." end