8000 Include print styles in main stylesheet by deivid-rodriguez · Pull Request #6922 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content

Include print styles in main stylesheet #6922

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

Merged
merged 1 commit into from
May 11, 2021
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
80 changes: 43 additions & 37 deletions app/assets/stylesheets/active_admin/_base.scss
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
/* Active Admin CSS */
// Normalize
@import "./normalize";
@media screen {
// Normalize
@import "./normalize";

// Partials
@import "./typography";
@import "./header";
@import "./forms";
@import "./components/comments";
@import "./components/flash_messages";
@import "./components/date_picker";
@import "./components/tables";
@import "./components/batch_actions";
@import "./components/modal_dialog";
@import "./components/blank_slates";
@import "./components/breadcrumbs";
@import "./components/dropdown_menu";
@import "./components/buttons";
@import "./components/grid";
@import "./components/links";
@import "./components/pagination";
@import "./components/panels";
@import "./components/columns";
@import "./components/scopes";
@import "./components/status_tags";
@import "./components/table_tools";
@import "./components/index_list";
@import "./components/unsupported_browser";
@import "./components/tabs";
@import "./pages/logged_out";
@import "./structure/footer";
@import "./structure/main_structure";
@import "./structure/title_bar";
// Partials
@import "./typography";
@import "./header";
@import "./forms";
@import "./components/comments";
@import "./components/flash_messages";
@import "./components/date_picker";
@import "./components/tables";
@import "./components/batch_actions";
@import "./components/modal_dialog";
@import "./components/blank_slates";
@import "./components/breadcrumbs";
@import "./components/dropdown_menu";
@import "./components/buttons";
@import "./components/grid";
@import "./components/links";
@import "./components/pagination";
@import "./components/panels";
@import "./components/columns";
@import "./components/scopes";
@import "./components/status_tags";
@import "./components/table_tools";
@import "./components/index_list";
@import "./components/unsupported_browser";
@import "./components/tabs";
@import "./pages/logged_out";
@import "./structure/footer";
@import "./structure/main_structure";
@import "./structure/title_bar";

body {
@include sans-family;
line-height: 1.5;
font-size: 72%;
background: $body-background-color;
color: $text-color;
body {
@include sans-family;
line-height: 1.5;
font-size: 72%;
background: $body-background-color;
color: $text-color;
}
}

@media print {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this line defined in the _print.scss partial instead. I'm not sure but I figured that is required for it to work because I think Sass only allows @import "..."; at the outermost level.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I moved it ouside, because since I was wrapping the rest of the styles under @media screen, moving it outside brought a nice simmetry in my opinion.

Not sure about Sass an not outermost imports, it seems to work just fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok great, thank you!

@import "./print";
}
2 changes: 1 addition & 1 deletion features/step_definitions/asset_steps.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Then /^I should see the css file "([^"]*)"$/ do |path|
step %{I should see the css file "#{path}" of media "screen"}
step %{I should see the css file "#{path}" of media "all"}
end

Then /^I should see the css file "([^"]*)" of media "([^"]*)"$/ do |path, media|
Expand Down
3 changes: 1 addition & 2 deletions lib/active_admin/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ def controllers_for_filters
private

def register_default_assets
register_stylesheet "active_admin.css", media: "screen"
register_stylesheet "active_admin/print.css", media: "print"
register_stylesheet "active_admin.css", media: "all"
register_javascript "active_admin.js"
end

Expand Down
0