From 840495e12f5cf7863b3ec2fc93d8032b1a440d9f Mon Sep 17 00:00:00 2001 From: Taka Date: Fri, 21 Feb 2020 15:40:06 +0000 Subject: [PATCH] Added a menu item to show all publishers. --- asl_articles/search.py | 9 +++++++++ web/src/App.js | 3 +++ 2 files changed, 12 insertions(+) diff --git a/asl_articles/search.py b/asl_articles/search.py index e99ee4e..011d962 100644 --- a/asl_articles/search.py +++ b/asl_articles/search.py @@ -108,6 +108,15 @@ def search(): # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +@app.route( "/search/publishers", methods=["POST","GET"] ) +def search_publishers(): + """Return all publishers.""" + publs = sorted( Publisher.query.all(), key=lambda p: p.publ_name.lower() ) + results = [ get_publisher_vals( p, True ) for p in publs ] + return jsonify( results ) + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @app.route( "/search/publisher/", methods=["POST","GET"] ) def search_publisher( publ_id ): """Search for a publisher.""" diff --git a/web/src/App.js b/web/src/App.js index 930cad7..14671d8 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -73,6 +73,9 @@ export default class App extends React.Component const menu = ( + this._onSpecialSearch( "/search/publishers" ) } + >Show publishers this._onSpecialSearch( "/search/tag/technique", {randomize:1} ) } >Show technique