diff --git a/changelog.md b/changelog.md
index e5f40ac..4544122 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,9 @@
## changelog
-#### Tuesday, 16/02/2016
+#### Tuesday, 16/02/2016, `v2.0.0`
* Paragraphs right after tables now indent (thanks LikeAJi6!)
+* Added a `@page` css rule to auto turn off margins when printing
+* Added a `page-break` property on each `.phb` page to properly page the pages up when exporting (thanks Jokefury!)
#### Sunday, 17/01/2016
diff --git a/client/admin/homebrewAdmin/homebrewAdmin.jsx b/client/admin/homebrewAdmin/homebrewAdmin.jsx
index 2ca9dd0..389910c 100644
--- a/client/admin/homebrewAdmin/homebrewAdmin.jsx
+++ b/client/admin/homebrewAdmin/homebrewAdmin.jsx
@@ -2,10 +2,12 @@ var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
-var Moment = require('moment')
+var Moment = require('moment');
+
+var VIEW_LIMIT = 30;
+var COLUMN_HEIGHT = 52;
var HomebrewAdmin = React.createClass({
-
getDefaultProps: function() {
return {
homebrews : [],
@@ -13,27 +15,29 @@ var HomebrewAdmin = React.createClass({
};
},
+ getInitialState: function() {
+ return {
+ viewStartIndex: 0
+ };
+ },
+
renderBrews : function(){
- return _.map(this.props.homebrews, (brew)=>{
+ return _.times(VIEW_LIMIT, (i)=>{
+ var brew = this.props.homebrews[i + this.state.viewStartIndex];
+ if(!brew) return null;
+
return
- | {brew.editId} |
- {brew.shareId} |
+ {brew.editId} |
+ {brew.shareId} |
{Moment(brew.createdAt).fromNow()} |
{Moment(brew.updatedAt).fromNow()} |
{Moment(brew.lastViewed).fromNow()} |
{brew.views} |
-
- view
-
- {brew.text.slice(0, 500)}
-
- |
|
-
- })
+ });
},
render : function(){
@@ -41,22 +45,23 @@ var HomebrewAdmin = React.createClass({
return(
Homebrews - {this.props.homebrews.length}
-
-
-
- | Edit Id |
- Share Id |
- Created At |
- Last Updated |
- Last Viewed |
- Number of Views |
- Preview |
-
-
-
- {this.renderBrews()}
-
-
+
+
+
+
+ | Edit Id |
+ Share Id |
+ Created At |
+ Last Updated |
+ Last Viewed |
+ Number of Views |
+
+
+
+ {this.renderBrews()}
+
+
+
);
}
diff --git a/client/admin/homebrewAdmin/homebrewAdmin.less b/client/admin/homebrewAdmin/homebrewAdmin.less
index a1a28bd..b16e3aa 100644
--- a/client/admin/homebrewAdmin/homebrewAdmin.less
+++ b/client/admin/homebrewAdmin/homebrewAdmin.less
@@ -1,42 +1,45 @@
.homebrewAdmin{
- table{
+ .brewTable{
overflow-y : scroll;
- max-height : 800px;
- th{
- padding : 10px;
- font-weight : 800;
- }
- tr:nth-child(even){
- background-color : fade(@green, 10%);
- }
- tr.isEmpty{
- background-color : fade(@red, 30%);
- }
- td{
- min-width : 100px;
- padding : 10px;
- text-align : center;
- &.preview{
- position : relative;
- &:hover{
- .content{
- display : block;
+ max-height : 500px;
+ table{
+
+ th{
+ padding : 10px;
+ font-weight : 800;
+ }
+ tr:nth-child(even){
+ background-color : fade(@green, 10%);
+ }
+ tr.isEmpty{
+ background-color : fade(@red, 30%);
+ }
+ td{
+ min-width : 100px;
+ padding : 10px;
+ text-align : center;
+ &.preview{
+ position : relative;
+ &:hover{
+ .content{
+ display : block;
+ }
+ }
+ .content{
+ position : absolute;
+ display : none;
+ top : 100%;
+ left : 0px;
+ z-index : 1000;
+ max-height : 500px;
+ width : 300px;
+ padding : 30px;
+ background-color : white;
+ font-family : monospace;
+ text-align : left;
+ pointer-events : none;
}
- }
- .content{
- position : absolute;
- display : none;
- top : 100%;
- left : 0px;
- z-index : 1000;
- max-height : 500px;
- width : 300px;
- padding : 30px;
- background-color : white;
- font-family : monospace;
- text-align : left;
- pointer-events : none;
}
}
}
diff --git a/client/homebrew/phbStyle/phb.style.less b/client/homebrew/phbStyle/phb.style.less
index dda82e5..37716e5 100644
--- a/client/homebrew/phbStyle/phb.style.less
+++ b/client/homebrew/phbStyle/phb.style.less
@@ -9,9 +9,7 @@
@horizontalRule : #9c2b1b;
@headerText : #58180D;
@monsterStatBackground : #FDF1DC;
-
@page { margin: 0; }
-
.useSansSerif(){
font-family : ScalySans;
em{
@@ -19,9 +17,9 @@
font-style : italic;
}
strong{
- font-family : ScalySans;
- font-weight : 800;
- letter-spacing: -0.02em;
+ font-family : ScalySans;
+ font-weight : 800;
+ letter-spacing : -0.02em;
}
}
.useColumns(){
@@ -38,19 +36,21 @@
}
.phb{
.useColumns();
- position : relative;
- z-index : 15;
- box-sizing : border-box;
- overflow : hidden;
- height : 279.4mm;
- width : 215.9mm;
- padding : 1.0cm 1.7cm;
- padding-bottom : 1.5cm;
- background-color : @background;
- background-image : @backgroundImage;
- font-family : BookSanity;
- font-size : 9pt;
- text-rendering : optimizeLegibility;
+ position : relative;
+ z-index : 15;
+ box-sizing : border-box;
+ overflow : hidden;
+ height : 279.4mm;
+ width : 215.9mm;
+ padding : 1.0cm 1.7cm;
+ padding-bottom : 1.5cm;
+ background-color : @background;
+ background-image : @backgroundImage;
+ font-family : BookSanity;
+ font-size : 9pt;
+ text-rendering : optimizeLegibility;
+ page-break-before : always;
+ page-break-after : always;
//*****************************
// * BASE
// *****************************/
@@ -69,17 +69,17 @@
list-style-type : disc;
}
ol{
- list-style-position: inside;
margin-bottom : 0.8em;
line-height : 1.3em;
+ list-style-position : inside;
list-style-type : decimal;
}
img{
z-index : -1;
}
strong{
- font-weight : bold;
- letter-spacing: 0.03em;
+ font-weight : bold;
+ letter-spacing : 0.03em;
}
em{
font-style : italic;
@@ -100,11 +100,11 @@
-webkit-column-span : 2;
-moz-column-span : 2;
&+p::first-letter{
- float : left;
- font-family : Solberry;
- line-height: 0.8em;
- font-size : 10em;
- color : #222;
+ float : left;
+ font-family : Solberry;
+ font-size : 10em;
+ color : #222;
+ line-height : 0.8em;
}
}
h2{
@@ -361,6 +361,6 @@
}
//Text indent right after table
table+p{
- text-indent: 1em;
+ text-indent : 1em;
}
}
\ No newline at end of file
diff --git a/phb.standalone.css b/phb.standalone.css
index 201329d..018d1da 100644
--- a/phb.standalone.css
+++ b/phb.standalone.css
@@ -199,6 +199,8 @@ table {
font-family: BookSanity;
font-size: 9pt;
text-rendering: optimizeLegibility;
+ page-break-before: always;
+ page-break-after: always;
}
.phb p {
padding-bottom: 0.8em;
diff --git a/server/homebrew.api.js b/server/homebrew.api.js
index 031a868..09e3c75 100644
--- a/server/homebrew.api.js
+++ b/server/homebrew.api.js
@@ -57,6 +57,28 @@ module.exports = function(app){
}
});
+ app.get('/homebrew/clear', function(req, res){
+ //if(req.query && req.query.admin_key == process.env.ADMIN_KEY){
+
+
+
+ HomebrewModel.find({text : ''}, function(err, objs){
+
+ return res.json(objs);
+
+
+ if(!objs.length || err) return res.status(404).send("Can not find homebrew with that id");
+ var resEntry = objs[0];
+ resEntry.remove(function(err){
+ if(err) return res.status(500).send("Error while removing");
+ return res.status(200).send();
+ })
+ });
+ //}else{
+ // return res.status(401).send('Access denied');
+ //}
+ });
+
//Edit Page
app.get('/homebrew/edit/:id', function(req, res){