Added menu items to show technique and tips.

master
Pacman Ghost 4 years ago
parent 8d3ba9e887
commit 5007f87e8c
  1. 5
      asl_articles/search.py
  2. 1
      web/src/App.css
  3. 13
      web/src/App.js

@ -4,6 +4,7 @@ import os
import sqlite3
import configparser
import itertools
import random
import tempfile
import re
import logging
@ -286,6 +287,10 @@ def _do_fts_search( fts_query_string, col_names, results=None ): #pylint: disabl
# add the result to the list
results.append( result )
# check if we should randomize the results
if request.json and to_bool( request.json.get( "randomize" ) ):
random.shuffle( results )
return jsonify( results )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

@ -13,6 +13,7 @@
[data-reach-menu-list] { padding: 5px ; }
[data-reach-menu-item] { padding: 5px ; }
[data-reach-menu-item][data-selected] { background: #90caf9 ; color: black ; }
[data-reach-menu-list] .divider { height: 0 ; margin: 2px 0 ; border-top: 1px solid #aaa ; }
.MuiDialogTitle-root { padding: 10px 16px 6px 16px !important ; }
.MuiDialogContent-root>div { margin-bottom: 1em ; }

@ -73,6 +73,13 @@ export default class App extends React.Component
const menu = ( <Menu id="app">
<MenuButton />
<MenuList>
<MenuItem id="menu-search-technique"
onSelect = { () => this._onSpecialSearch( "/search/tag/technique", {randomize:1} ) }
>Show technique</MenuItem>
<MenuItem id="menu-search-tips"
onSelect = { () => this._onSpecialSearch( "/search/tag/tips", {randomize:1} ) }
>Show tips</MenuItem>
<div className="divider" />
<MenuItem id="menu-new-publisher"
onSelect = { () => PublisherSearchResult.onNewPublisher( this._onNewPublisher.bind(this) ) }
>New publisher</MenuItem>
@ -207,10 +214,12 @@ export default class App extends React.Component
searchForArticle( article_id ) { this._onSpecialSearch( "/search/article/" + article_id ) ; }
searchForAuthor( author_id ) { this._onSpecialSearch( "/search/author/" + author_id ) ; }
searchForTag( tag ) { this._onSpecialSearch( "/search/tag/" + encodeURIComponent(tag) ) ; }
_onSpecialSearch( url ) {
_onSpecialSearch( url, args ) {
// run the search
this._searchFormRef.current.setState( { queryString: "" } ) ;
this._doSearch( url, {} ) ;
if ( ! args )
args = {} ;
this._doSearch( url, args ) ;
}
_doSearch( url, args ) {
// do the search

Loading…
Cancel
Save