mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-23 08:41:29 +00:00
Added @page css rule to auto turn off margins in Chrome when printing
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
## changelog
|
## changelog
|
||||||
|
|
||||||
|
#### Tuesday, 16/02/2016
|
||||||
|
* Paragraphs right after tables now indent (thanks LikeAJi6!)
|
||||||
|
|
||||||
|
|
||||||
#### Sunday, 17/01/2016
|
#### Sunday, 17/01/2016
|
||||||
* Added a printer friendly snippet that injects some CSS to remove backbrounds and images
|
* 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
|
* Adjusted the styling specific to spell blocks to give it tighter spacing
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
@horizontalRule : #9c2b1b;
|
@horizontalRule : #9c2b1b;
|
||||||
@headerText : #58180D;
|
@headerText : #58180D;
|
||||||
@monsterStatBackground : #FDF1DC;
|
@monsterStatBackground : #FDF1DC;
|
||||||
|
|
||||||
|
@page { margin: 0; }
|
||||||
|
|
||||||
.useSansSerif(){
|
.useSansSerif(){
|
||||||
font-family : ScalySans;
|
font-family : ScalySans;
|
||||||
em{
|
em{
|
||||||
@@ -356,4 +359,8 @@
|
|||||||
h4+p+hr+ul{
|
h4+p+hr+ul{
|
||||||
margin-top : -0.5em
|
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
@@ -2,8 +2,23 @@ var _ = require('lodash');
|
|||||||
var vitreumRender = require('vitreum/render');
|
var vitreumRender = require('vitreum/render');
|
||||||
var HomebrewModel = require('./homebrew.model.js').model;
|
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){
|
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){
|
app.get('/homebrew/new', function(req, res){
|
||||||
var newHomebrew = new HomebrewModel();
|
var newHomebrew = new HomebrewModel();
|
||||||
@@ -43,8 +58,6 @@ module.exports = function(app){
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Edit Page
|
//Edit Page
|
||||||
app.get('/homebrew/edit/:id', function(req, res){
|
app.get('/homebrew/edit/:id', function(req, res){
|
||||||
HomebrewModel.find({editId : req.params.id}, function(err, objs){
|
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>'
|
var page = '<html><head>' + title + PHBStyle + '</head><body>' + content +'</body></html>'
|
||||||
|
|
||||||
return res.send(page)
|
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.
|
//Home and 404, etc.
|
||||||
var welcomeText = require('fs').readFileSync('./client/homebrew/homePage/welcome_msg.txt', 'utf8');
|
var welcomeText = require('fs').readFileSync('./client/homebrew/homePage/welcome_msg.txt', 'utf8');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user