From 2390a747085741c60a1746ae83d0bff57c7621a0 Mon Sep 17 00:00:00 2001 From: Taka Date: Mon, 2 Mar 2020 12:58:29 +0000 Subject: [PATCH] Preserve URL parameters when a link is clicked. --- web/src/App.js | 7 +++++++ web/src/ArticleSearchResult.js | 10 +++++----- web/src/PublicationSearchResult.js | 10 +++++----- web/src/PublisherSearchResult.js | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/web/src/App.js b/web/src/App.js index 8281967..bce5779 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -427,6 +427,13 @@ export class App extends React.Component return [ tagList, allTags ] ; } + makeAppUrl( url ) { + // FUDGE! The test suite needs any URL parameters to passed on to the next page if a link is clicked. + if ( this.isTestMode() ) + url += window.location.search ; + return url ; + } + makeFlaskUrl( url, args ) { // generate a URL for the Flask backend server url = this._flaskBaseUrl + url ; diff --git a/web/src/ArticleSearchResult.js b/web/src/ArticleSearchResult.js index 92ce744..34ef83c 100644 --- a/web/src/ArticleSearchResult.js +++ b/web/src/ArticleSearchResult.js @@ -41,7 +41,7 @@ export class ArticleSearchResult extends React.Component for ( let i=0 ; i < this.props.data["authors!"].length ; ++i ) { const author_id = this.props.data.article_authors[ i ] ; authors.push( ) ; } @@ -50,7 +50,7 @@ export class ArticleSearchResult extends React.Component for ( let i=0 ; i < this.props.data.article_authors.length ; ++i ) { const author_id = this.props.data.article_authors[ i ] ; authors.push( ) ; } @@ -84,7 +84,7 @@ export class ArticleSearchResult extends React.Component for ( let i=0 ; i < this.props.data["tags!"].length ; ++i ) { const tag = this.props.data.article_tags[ i ] ; // nb: this is the actual tag (without highlights) tags.push( ) ; } @@ -92,7 +92,7 @@ export class ArticleSearchResult extends React.Component if ( this.props.data.article_tags ) { this.props.data.article_tags.map( tag => tags.push( {tag} ) ) ; } @@ -121,7 +121,7 @@ export class ArticleSearchResult extends React.Component {menu} { pub_display_name && } diff --git a/web/src/PublicationSearchResult.js b/web/src/PublicationSearchResult.js index c8cb6b4..a57dd89 100644 --- a/web/src/PublicationSearchResult.js +++ b/web/src/PublicationSearchResult.js @@ -36,7 +36,7 @@ export class PublicationSearchResult extends React.Component for ( let i=0 ; i < this.props.data["tags!"].length ; ++i ) { const tag = this.props.data.pub_tags[ i ] ; // nb: this is the actual tag (without highlights) tags.push( ) ; } @@ -44,7 +44,7 @@ export class PublicationSearchResult extends React.Component if ( this.props.data.pub_tags ) { this.props.data.pub_tags.map( tag => tags.push( {tag} ) ) ; } @@ -56,7 +56,7 @@ export class PublicationSearchResult extends React.Component for ( let i=0 ; i < this.props.data.articles.length ; ++i ) { const article = this.props.data.articles[ i ] ; articles.push( ) ; } @@ -82,12 +82,12 @@ export class PublicationSearchResult extends React.Component {menu} { publ && {publ.publ_name} } { pub_url && diff --git a/web/src/PublisherSearchResult.js b/web/src/PublisherSearchResult.js index c50f2a2..1b9c80f 100644 --- a/web/src/PublisherSearchResult.js +++ b/web/src/PublisherSearchResult.js @@ -30,7 +30,7 @@ export class PublisherSearchResult extends React.Component } pubs.sort( (lhs,rhs) => rhs.time_created - lhs.time_created ) ; pubs = pubs.map( p => ) ;