Skip to content

Commit 2200e45

Browse files
committed
Merge pull request activeadmin#1067 from carnesmedia/print_styles
Print stylesheet
2 parents c43e1d0 + 12374a6 commit 2200e45

File tree

3 files changed

+286
-1
lines changed

3 files changed

+286
-1
lines changed
Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
/* Active Admin Print Stylesheet */
2+
3+
// Set colors used elsewhere
4+
$primary-color: black;
5+
$text-color: black;
6+
7+
// Reset
8+
@import "active_admin/mixins/reset";
9+
@include global-reset;
10+
11+
// Partials
12+
@import "active_admin/typography";
13+
14+
body {
15+
font-family: Helvetica, Arial, sans-serif;
16+
line-height: 150%;
17+
font-size: 72%;
18+
background: #fff;
19+
width: 99%;
20+
margin: 0;
21+
padding: .5%;
22+
color: $text-color;
23+
}
24+
25+
a {
26+
color: $text-color;
27+
text-decoration: none;
28+
}
29+
30+
h3 {
31+
font-weight: bold;
32+
margin-bottom: .5em;
33+
}
34+
35+
// Header
36+
#header {
37+
float: left;
38+
39+
#tabs, #utility_nav {
40+
display: none;
41+
}
42+
43+
h1{
44+
font-weight: bold;
45+
}
46+
}
47+
48+
.flashes {
49+
display: none;
50+
}
51+
52+
#title_bar {
53+
float: right;
54+
55+
h2 {
56+
line-height: 2em;
57+
margin: 0;
58+
}
59+
60+
.breadcrumb, #titlebar_right {
61+
display: none;
62+
}
63+
}
64+
65+
// Content
66+
#active_admin_content {
67+
border-top: thick solid black;
68+
clear: both;
69+
margin-top: 2em;
70+
padding-top: 3em;
71+
}
72+
73+
// Footer
74+
#footer {
75+
display: none;
76+
}
77+
78+
// Tables
79+
.table_tools {
80+
ul {
81+
padding: 0;
82+
margin: 0;
83+
list-style-type: none;
84+
85+
li {
86+
display: none;
87+
padding: 0;
88+
margin-bottom: 1em;
89+
90+
&.scope.selected {
91+
display: block;
92+
93+
&:before {
94+
content: "Showing ";
95+
}
96+
97+
a {
98+
font-weight: bold;
99+
}
100+
101+
span {
102+
display: inline-block;
103+
font-weight: normal;
104+
font-size: .9em;
105+
}
106+
}
107+
}
108+
109+
}
110+
}
111+
112+
table {
113+
margin-bottom: 1.5em;
114+
text-align: left;
115+
width: 100%;
116+
117+
thead {
118+
display: table-header-group;
119+
120+
th {
121+
background: none;
122+
border-bottom: medium solid black;
123+
font-weight: bold;
124+
125+
a{
126+
text-decoration: none;
127+
}
128+
}
129+
}
130+
131+
th, td {
132+
padding: .5em 1em;
133+
134+
.member_link {
135+
display: none;
136+
}
137+
}
138+
139+
td {
140+
border-bottom: thin solid black;
141+
}
142+
143+
tr{
144+
page-break-inside: avoid;
145+
}
146+
}
147+
148+
// Index
149+
#index_footer, .pagination_information {
150+
display: none;
151+
}
152+
153+
.index_grid {
154+
td {
155+
border: none;
156+
text-align: center;
157+
vertical-align: middle;
158+
159+
img {
160+
max-width: 1in;
161+
}
162+
}
163+
}
164+
165+
// Show
166+
.panel {
167+
border-bottom: thick solid #ccc;
168+
margin-bottom: 3em;
169+
padding-bottom: 2em;
170+
page-break-inside: avoid;
171+
172+
&:last-child {
173+
border-bottom: none;
174+
}
175+
}
176+
177+
.comments {
178+
form {
179+
display: none;
180+
}
181+
182+
.active_admin_comment {
183+
border-top: thin solid black;
184+
padding-top: 1em;
185+
186+
.active_admin_comment_meta {
187+
h4 {
188+
font-size: 1em;
189+
font-weight: bold;
190+
float: left;
191+
margin-right: .5em;
192+
margin-bottom: 0;
193+
}
194+
195+
span {
196+
font-size: .9em;
197+
font-style: italic;
198+
vertical-align: top;
199+
}
200+
}
201+
202+
.active_admin_comment_body {
203+
clear: both;
204+
margin-bottom: 1em;
205+
}
206+
}
207+
}
208+
209+
210+
// Attribute Tables
211+
.attributes_table {
212+
border-top: medium solid black;
213+
214+
th {
215+
border-bottom: thin solid black;
216+
vertical-align: top;
217+
218+
&:after {
219+
content: ':';
220+
}
221+
}
222+
223+
td {
224+
img {
225+
max-height: 4in;
226+
max-width: 6in;
227+
}
228+
}
229+
}
230+
231+
// Sidebars
232+
#filters_sidebar_section {
233+
display: none;
234+
}
235+
236+
// Forms
237+
form {
238+
fieldset {
239+
border-top: thick solid #ccc;
240+
padding-top: 2em;
241+
margin-bottom: 2em;
242+
243+
&:last-child {
244+
border-bottom: none;
245+
}
246+
}
247+
248+
.buttons, abbr {
249+
display: none;
250+
}
251+
ol {
252+
list-style-type: none;
253+
padding: 0;
254+
margin: 0;
255+
256+
li{
257+
border-top: thin solid black;
258+
margin: 0;
259+
padding: 1em 0;
260+
overflow: hidden;
261+
262+
&.password, &.hidden {
263+
display: none;
264+
}
265+
266+
label {
267+
font-weight: bold;
268+
float: left;
269+
width: 20%;
270+
}
271+
272+
input, textarea, select {
273+
background: none;
274+
border: 0;
275+
font: Arial, Helvetica, sans-serif;
276+
}
277+
278+
input[type=file] {
279+
display: none;
280+
}
281+
282+
}
283+
}
284+
}

lib/active_admin/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def dashboard_section(name, options = {}, &block)
224224
private
225225

226226
def register_default_assets
227-
register_stylesheet 'active_admin.css', :media => 'all'
227+
register_stylesheet 'active_admin.css', :media => 'screen'
228228

229229
if !ActiveAdmin.use_asset_pipeline?
230230
register_javascript 'jquery.min.js'

lib/active_admin/views/pages/base.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def build_active_admin_head
2626
active_admin_application.stylesheets.each do |style|
2727
text_node(stylesheet_link_tag(style.path, style.options).html_safe)
2828
end
29+
link :href => stylesheet_path('active_admin/print.css'), :media => "print", :rel => "stylesheet", :type => "text/css"
2930
active_admin_application.javascripts.each do |path|
3031
script :src => javascript_path(path), :type => "text/javascript"
3132
end

0 commit comments

Comments
 (0)