Add some styling to print redux version

This commit is contained in:
Rafael dos Santos Silva 2016-10-12 14:00:05 -03:00
parent 3ad8616f44
commit 41d2620d06
3 changed files with 13 additions and 42 deletions

View File

@ -10,46 +10,6 @@
<%- end %>
<%= render_google_universal_analytics_code %>
<%= yield :head %>
<style>
header img {
max-width: 90% !important;
padding-bottom: 10px;
}
img { max-width: 100%; width: auto; height: auto; }
#main-outlet > div {
margin-bottom: 15px;
}
footer nav a {
margin-right: 15px;
}
footer nav {
line-height: 30px;
}
body {
max-width: 98%;
padding-left: 1%;
}
.topic-list > div > a {
margin-right: 10px;
}
.topic-list > div .posts {
margin-left: 10px;
}
.topic-list > div {
margin-bottom: 15px;
}
body img.emoji {
width: 20px;
height: 20px;
vertical-align: middle;
}
</style>
</head>
<body>
<%- unless customization_disabled? %>

View File

@ -69,6 +69,17 @@
<% if @topic_view.print %>
<% content_for :after_body do %>
<%- if rtl? %>
<%= DiscourseStylesheets.stylesheet_link_tag(mobile_view? ? :mobile_rtl : :desktop_rtl, 'print') %>
<%- else %>
<%= DiscourseStylesheets.stylesheet_link_tag(mobile_view? ? :mobile : :desktop, 'print') %>
<%- end %>
<style media="print">
/* For readability */
a, a:visited {
color: #0088cc !important;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
window.print();

View File

@ -14,7 +14,7 @@ class DiscourseStylesheets
@cache ||= DistributedCache.new("discourse_stylesheet")
end
def self.stylesheet_link_tag(target = :desktop)
def self.stylesheet_link_tag(target = :desktop, media = 'all')
tag = cache[target]
@ -24,7 +24,7 @@ class DiscourseStylesheets
builder = self.new(target)
builder.compile unless File.exists?(builder.stylesheet_fullpath)
builder.ensure_digestless_file
tag = %[<link href="#{Rails.env.production? ? builder.stylesheet_cdnpath : builder.stylesheet_relpath_no_digest + '?body=1'}" media="all" rel="stylesheet" />]
tag = %[<link href="#{Rails.env.production? ? builder.stylesheet_cdnpath : builder.stylesheet_relpath_no_digest + '?body=1'}" media="#{media}" rel="stylesheet" />]
cache[target] = tag