Preserve URL parameters when a link is clicked.

master
Pacman Ghost 4 years ago
parent 3c22fae174
commit 2390a74708
  1. 7
      web/src/App.js
  2. 10
      web/src/ArticleSearchResult.js
  3. 10
      web/src/PublicationSearchResult.js
  4. 2
      web/src/PublisherSearchResult.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 ;

@ -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( <Link key={i} className="author" title="Show articles from this author."
to = { "/author/" + author_id }
to = { gAppRef.makeAppUrl( "/author/" + author_id ) }
dangerouslySetInnerHTML = {{ __html: this.props.data["authors!"][i] }}
/> ) ;
}
@ -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( <Link key={i} className="author" title="Show articles from this author."
to = { "/author/" + author_id }
to = { gAppRef.makeAppUrl( "/author/" + author_id ) }
dangerouslySetInnerHTML = {{ __html: gAppRef.caches.authors[ author_id ].author_name }}
/> ) ;
}
@ -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( <Link key={tag} className="tag" title="Search for this tag."
to = { "/tag/" + encodeURIComponent(tag) }
to = { gAppRef.makeAppUrl( "/tag/" + encodeURIComponent(tag) ) }
dangerouslySetInnerHTML = {{ __html: this.props.data["tags!"][i] }}
/> ) ;
}
@ -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( <Link key={tag} className="tag" title="Search for this tag."
to = { "/tag/" + encodeURIComponent(tag) }
to = { gAppRef.makeAppUrl( "/tag/" + encodeURIComponent(tag) ) }
> {tag} </Link> )
) ;
}
@ -121,7 +121,7 @@ export class ArticleSearchResult extends React.Component
{menu}
{ pub_display_name &&
<Link className="publication" title="Show this publication."
to = { "/publication/" + this.props.data.pub_id }
to = { gAppRef.makeAppUrl( "/publication/" + this.props.data.pub_id ) }
dangerouslySetInnerHTML = {{ __html: pub_display_name }}
/>
}

@ -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( <Link key={tag} className="tag" title="Search for this tag."
to = { "/tag/" + encodeURIComponent(tag) }
to = { gAppRef.makeAppUrl( "/tag/" + encodeURIComponent(tag) ) }
dangerouslySetInnerHTML = {{ __html: this.props.data["tags!"][i] }}
/> ) ;
}
@ -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( <Link key={tag} className="tag" title="Search for this tag."
to = { "/tag/" + encodeURIComponent(tag) }
to = { gAppRef.makeAppUrl( "/tag/" + encodeURIComponent(tag) ) }
> {tag} </Link> )
) ;
}
@ -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( <Link title="Show this article."
to = { "/article/" + article.article_id }
to = { gAppRef.makeAppUrl( "/article/" + article.article_id ) }
dangerouslySetInnerHTML = {{ __html: article.article_title }}
/> ) ;
}
@ -82,12 +82,12 @@ export class PublicationSearchResult extends React.Component
{menu}
{ publ &&
<Link className="publisher" title="Show this publisher."
to = { "/publisher/" + this.props.data.publ_id }
to = { gAppRef.makeAppUrl( "/publisher/" + this.props.data.publ_id ) }
> {publ.publ_name}
</Link>
}
<Link className="name" title="Show this publication."
to = { "/publication/" + this.props.data.pub_id }
to = { gAppRef.makeAppUrl( "/publication/" + this.props.data.pub_id ) }
dangerouslySetInnerHTML = {{ __html: this._makeDisplayName( true ) }}
/>
{ pub_url &&

@ -30,7 +30,7 @@ export class PublisherSearchResult extends React.Component
}
pubs.sort( (lhs,rhs) => rhs.time_created - lhs.time_created ) ;
pubs = pubs.map( p => <Link title="Show this publication."
to = { "/publication/" + p.pub_id }
to = { gAppRef.makeAppUrl( "/publication/" + p.pub_id ) }
dangerouslySetInnerHTML = {{ __html: PublicationSearchResult.makeDisplayName(p) }}
/> ) ;

Loading…
Cancel
Save