From c1ce13b41b595847f18d2f7232850b10cd677e66 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 16 Feb 2019 14:21:32 +0100 Subject: get better pdf url --- scraper/client/paper/paper.address.js | 44 +++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'scraper/client/paper/paper.address.js') diff --git a/scraper/client/paper/paper.address.js b/scraper/client/paper/paper.address.js index 09b20758..9256d4ad 100644 --- a/scraper/client/paper/paper.address.js +++ b/scraper/client/paper/paper.address.js @@ -19,6 +19,7 @@ const initialState = { institution_3_vetting: '', institution_4_vetting: '', notes: '', + pdf_index: 0, } class PaperAddress extends Component { state = { @@ -111,7 +112,25 @@ class PaperAddress extends Component { institution_4_vetting: this.state.institution_4_vetting, notes: this.state.notes, }) - history.push('/paper/' + this.props.api.paperInfo.dataset.key + '/random/') + this.next(false) + } + + next() { + const { key } = this.props.api.paperInfo.dataset + const { unknownCitations } = this.props.api + let citationIndex = (unknownCitations.citations || []) + .findIndex(f => f.id === this.state.citation.id) + if (citationIndex === -1) { + history.push('/paper/' + key + '/info/') + } else { + citationIndex += 1 + if (citationIndex >= unknownCitations.length) { + history.push('/paper/' + key + '/info/') + } else { + let nextId = unknownCitations.citations[citationIndex].id + history.push('/paper/' + key + '/address/' + nextId) + } + } } render() { @@ -229,9 +248,30 @@ class PaperAddress extends Component { onClick={this.save.bind(this)} ref={ref => this.button = ref} >Save Institutions + + + + +
+ {citation.pdf.map((pdf,i) => { + const pdf_partz = pdf.replace('www.','').split('/').slice(2,3)[0] || 'unknown' + let domain = '' + return ( + this.setState({ pdf_index: i })} + className={i === this.state.pdf_index ? 'selected' : ''} + > + {'[' + domain + ']'} + + ) + })}
-