From aadc5dc0b250e1bd3dd54de8931f5a8ebb73bfe6 Mon Sep 17 00:00:00 2001 From: Taka Date: Wed, 18 Mar 2020 08:54:03 +0000 Subject: [PATCH] Added permalinks for the menu items. --- web/src/App.js | 45 ++++++++++++++++++++++++++------------------- web/src/index.js | 9 +++++++++ 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/web/src/App.js b/web/src/App.js index cc40bca..436c2c0 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -78,18 +78,9 @@ export class App extends React.Component const menu = ( - this.runSpecialSearch( "/search/publishers", null, - () => { this.setWindowTitle( "All publishers" ) } - ) } > Show publishers - this.runSpecialSearch( "/search/tag/technique", {randomize:1}, - () => { this.setWindowTitle( "Technique" ) } - ) } > Show technique - this.runSpecialSearch( "/search/tag/tips", {randomize:1}, - () => { this.setWindowTitle( "Tips" ) } - ) } > Show tips + Show publishers + Show technique + Show tips
PublisherSearchResult.onNewPublisher( this._onNewPublisher.bind(this) ) } @@ -231,13 +222,6 @@ export class App extends React.Component } this._doSearch( "/search", { query: query } ) ; } - runSpecialSearch( url, args, onDone ) { - // run the search - this._searchFormRef.current.setState( { queryString: "" } ) ; - if ( ! args ) - args = {} ; - this._doSearch( url, args, onDone ) ; - } _doSearch( url, args, onDone ) { // do the search this.setWindowTitle( null ) ; @@ -258,6 +242,29 @@ export class App extends React.Component } ) ; } + runSpecialSearch( url, args, onDone ) { + // run the search + this._searchFormRef.current.setState( { queryString: "" } ) ; + if ( ! args ) + args = {} ; + this._doSearch( url, args, onDone ) ; + } + _showPublishers() { + this.runSpecialSearch( "/search/publishers", null, + () => { this.setWindowTitle( "All publishers" ) } + ) + } + _showTechniqueArticles() { + this.runSpecialSearch( "/search/tag/technique", {randomize:1}, + () => { this.setWindowTitle( "Technique" ) } + ) + } + _showTipsArticles() { + this.runSpecialSearch( "/search/tag/tips", {randomize:1}, + () => { this.setWindowTitle( "Tips" ) } + ) + } + _onNewPublisher( publ_id, vals ) { this._addNewSearchResult( vals, "publisher", "publ_id", publ_id ) ; } _onNewPublication( pub_id, vals ) { this._addNewSearchResult( vals, "publication", "pub_id", pub_id ) ; } _onNewArticle( article_id, vals ) { this._addNewSearchResult( vals, "article", "article_id", article_id ) ; } diff --git a/web/src/index.js b/web/src/index.js index 68cf23c..a4df913 100644 --- a/web/src/index.js +++ b/web/src/index.js @@ -10,6 +10,15 @@ import "./index.css" ; ReactDOM.render( + gAppRef._showPublishers() } + /> } /> + gAppRef._showTechniqueArticles() } + /> } /> + gAppRef._showTipsArticles() } + /> } /> gAppRef.runSpecialSearch( "/search/publisher/"+gAppRef.props.match.params.publId, null, () => gAppRef.setWindowTitleFromSearchResults( "publisher", "publ_id", gAppRef.props.match.params.publId, "publ_name" )