1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-23 12:31:30 +00:00

Added @page css rule to auto turn off margins in Chrome when printing

This commit is contained in:
Scott
2016-02-16 14:10:11 -05:00
parent c8b3a0f183
commit 2231dc3684
4 changed files with 82 additions and 67 deletions

View File

@@ -1,5 +1,9 @@
## changelog
#### Tuesday, 16/02/2016
* Paragraphs right after tables now indent (thanks LikeAJi6!)
#### Sunday, 17/01/2016
* Added a printer friendly snippet that injects some CSS to remove backbrounds and images
* Adjusted the styling specific to spell blocks to give it tighter spacing

View File

@@ -9,6 +9,9 @@
@horizontalRule : #9c2b1b;
@headerText : #58180D;
@monsterStatBackground : #FDF1DC;
@page { margin: 0; }
.useSansSerif(){
font-family : ScalySans;
em{
@@ -356,4 +359,8 @@
h4+p+hr+ul{
margin-top : -0.5em
}
//Text indent right after table
table+p{
text-indent: 1em;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -2,8 +2,23 @@ var _ = require('lodash');
var vitreumRender = require('vitreum/render');
var HomebrewModel = require('./homebrew.model.js').model;
var getTopBrews = function(cb){
HomebrewModel.find().sort({views: -1}).limit(5).exec(function(err, brews) {
cb(brews);
});
}
module.exports = function(app){
app.get('/homebrew/top', function(req, res){
getTopBrews(function(topBrews){
return res.json(topBrews);
});
})
app.get('/homebrew/new', function(req, res){
var newHomebrew = new HomebrewModel();
@@ -43,8 +58,6 @@ module.exports = function(app){
});
//Edit Page
app.get('/homebrew/edit/:id', function(req, res){
HomebrewModel.find({editId : req.params.id}, function(err, objs){
@@ -122,52 +135,9 @@ module.exports = function(app){
var page = '<html><head>' + title + PHBStyle + '</head><body>' + content +'</body></html>'
return res.send(page)
})
});
//PDF download
/*
var pdf = require('html-pdf');
app.get('/homebrew/pdf/:id', function(req, res){
HomebrewModel.find({shareId : req.params.id}, function(err, objs){
if(err) return res.status(404).send();
var resObj = null;
var errObj = {text: "# oops\nCould not find the homebrew."}
if(objs.length){
resObj = objs[0];
}
var content = _.map(resObj.text.split('\\page'), function(pageText){
return '<div class="phb">' + Markdown(pageText) + '</div>';
}).join('\n');
var title = '<title>' + resObj.text.split('\n')[0] + '</title>';
var page = '<html><head>' + title + PHBStyle + '</head><body>' + content +'</body></html>'
var config = {
"height": (279.4 - 56) + "mm",
"width": (215.9 - 43) + "mm",
"border": "0",
}
pdf.create(page, config).toStream(function(err, stream){
res.attachment('pdfname.pdf');
return stream.pipe(res);
});
})
});
*/
//Home and 404, etc.
var welcomeText = require('fs').readFileSync('./client/homebrew/homePage/welcome_msg.txt', 'utf8');