Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polaris html classes #366

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/helpers/polaris/view_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion demo/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="no-js Polaris-Summer-Editions-2023" style="<%= polaris_html_styles %>">
<html class="no-js <%= polaris_html_classes %>" style="<%= polaris_html_styles %>">
<head>
<title>Demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
Expand Down
8 changes: 4 additions & 4 deletions lib/install/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?("<body>")
say "Add Polaris inline styles for <html> in application layout"
gsub_file APPLICATION_LAYOUT_PATH.to_s, "<html", "<html style=\"<%= polaris_html_styles %>\""
say "Add Polaris classes and inline styles for <html> in application layout"
gsub_file APPLICATION_LAYOUT_PATH.to_s, "<html", "<html class=\"<%= polaris_html_classes %>\" style=\"<%= polaris_html_styles %>\""

say "Add Polaris inline styles for <body> in application layout"
gsub_file APPLICATION_LAYOUT_PATH.to_s, "<body>", "<body style=\"<%= polaris_body_styles %>\">"
else
say "<body> tag is not found in application layout.", :red
say " Replace <html> with <html style=\"<%= polaris_html_styles %>\"> in your custom layour."
say " Replace <html> with <html class=\"<%= polaris_html_classes %>\" style=\"<%= polaris_html_styles %>\"> in your custom layour."
say " Replace <body> with <body style=\"<%= polaris_body_styles %>\"> 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 <head> tag in your custom layout."
say " 2. Replace <html> with <html style=\"<%= polaris_html_styles %>\"> in your custom layour."
say " 2. Replace <html> with <html class=\"<%= polaris_html_classes %>\" style=\"<%= polaris_html_styles %>\"> in your custom layour."
say " 3. Replace <body> with <body style=\"<%= polaris_body_styles %>\"> in your custom layour."
end

Expand Down
Loading