1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

Substitute COA for placeholder text in print

This commit is contained in:
Brett Sun 2015-12-23 09:46:30 +01:00
parent 6c9e108b72
commit 1eea6c2cb2
2 changed files with 57 additions and 47 deletions

View File

@ -231,31 +231,30 @@ let CoaDetails = React.createClass({
}, },
render() { render() {
if(this.props.coaError) { const { coa = {}, coaError } = this.props;
return (
<div className="text-center"> let coaDetailElement;
<p>{getLangText('There was an error generating your Certificate of Authenticity.')}</p> if (coaError) {
coaDetailElement = [
<p>{getLangText('There was an error generating your Certificate of Authenticity.')}</p>,
<p> <p>
{getLangText('Try to refresh the page. If this happens repeatedly, please ')} {getLangText('Try to refresh the page. If this happens repeatedly, please ')}
<a style={{ cursor: 'pointer' }} onClick={this.contactOnIntercom}>{getLangText('contact us')}</a>. <a style={{ cursor: 'pointer' }} onClick={this.contactOnIntercom}>{getLangText('contact us')}</a>.
</p> </p>
</div> ];
); } else if (coa.url_safe) {
} coaDetailElement = [
if(this.props.coa && this.props.coa.url_safe) {
return (
<div>
<div <div
className="notification-contract-pdf" className="notification-contract-pdf"
style={{paddingBottom: '1em'}}> style={{paddingBottom: '1em'}}>
<embed <embed
className="embed-form" className="embed-form"
src={this.props.coa.url_safe} src={coa.url_safe}
alt="pdf" alt="pdf"
pluginspage="http://www.adobe.com/products/acrobat/readstep2.html"/> pluginspage="http://www.adobe.com/products/acrobat/readstep2.html"/>
</div> </div>,
<div className="text-center ascribe-button-list"> <div className="text-center ascribe-button-list">
<a href={this.props.coa.url_safe} target="_blank"> <a href={coa.url_safe} target="_blank">
<button className="btn btn-default btn-xs"> <button className="btn btn-default btn-xs">
{getLangText('Download')} <Glyphicon glyph="cloud-download"/> {getLangText('Download')} <Glyphicon glyph="cloud-download"/>
</button> </button>
@ -265,22 +264,27 @@ let CoaDetails = React.createClass({
{getLangText('Verify')} <Glyphicon glyph="check"/> {getLangText('Verify')} <Glyphicon glyph="check"/>
</button> </button>
</Link> </Link>
</div> </div>
</div> ];
); } else if (typeof coa === 'string') {
} else if(typeof this.props.coa === 'string'){ coaDetailElement = coa;
return ( } else {
<div className="text-center"> coaDetailElement = [
{this.props.coa} <AscribeSpinner color='dark-blue' size='md'/>,
</div> <p>{getLangText("Just a sec, we're generating your COA")}</p>,
);
}
return (
<div className="text-center">
<AscribeSpinner color='dark-blue' size='md'/>
<p>{getLangText("Just a sec, we\'re generating your COA")}</p>
<p>{getLangText('(you may leave the page)')}</p> <p>{getLangText('(you may leave the page)')}</p>
];
}
return (
<div>
<div className="text-center hidden-print">
{coaDetailElement}
</div>
{/* Hide the COA and just show that it's a seperate document when printing */}
<div className="visible-print ascribe-coa-print-placeholder">
{getLangText('The COA is available as a seperate document')}
</div>
</div> </div>
); );
} }

View File

@ -24,4 +24,10 @@
width: 50% !important; width: 50% !important;
float: right !important; float: right !important;
} }
// Restyle COA
.ascribe-coa-print-placeholder {
padding: 0 1.5em 1em 1.5em;
margin: 0;
}
} }