Fix searching on share page if fulltext search is disabled

This commit is contained in:
eikek 2021-11-16 22:22:00 +01:00
parent 0651db9901
commit d2b7c37dfc
4 changed files with 17 additions and 13 deletions

View File

@ -24,6 +24,7 @@ type alias Texts =
, authFailed : String , authFailed : String
, fulltextPlaceholder : String , fulltextPlaceholder : String
, powerSearchPlaceholder : String , powerSearchPlaceholder : String
, normalSearchPlaceholder : String
, extendedSearch : String , extendedSearch : String
} }
@ -39,6 +40,7 @@ gb =
, fulltextPlaceholder = "Fulltext search" , fulltextPlaceholder = "Fulltext search"
, powerSearchPlaceholder = "Extended search" , powerSearchPlaceholder = "Extended search"
, extendedSearch = "Extended search query" , extendedSearch = "Extended search query"
, normalSearchPlaceholder = "Search"
} }
@ -53,4 +55,5 @@ de =
, fulltextPlaceholder = "Volltextsuche" , fulltextPlaceholder = "Volltextsuche"
, powerSearchPlaceholder = "Erweiterte Suche" , powerSearchPlaceholder = "Erweiterte Suche"
, extendedSearch = "Erweiterte Suchanfrage" , extendedSearch = "Erweiterte Suchanfrage"
, normalSearchPlaceholder = "Suche"
} }

View File

@ -10,7 +10,7 @@ module Page.Share.Menubar exposing (view)
import Comp.Basic as B import Comp.Basic as B
import Comp.MenuBar as MB import Comp.MenuBar as MB
import Comp.PowerSearchInput import Comp.PowerSearchInput
import Comp.SearchMenu import Data.Flags exposing (Flags)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput) import Html.Events exposing (onClick, onInput)
@ -20,16 +20,9 @@ import Styles as S
import Util.Html import Util.Html
view : Texts -> Model -> Html Msg view : Texts -> Flags -> Model -> Html Msg
view texts model = view texts flags model =
let let
btnStyle =
S.secondaryBasicButton ++ " text-sm"
searchInput =
Comp.SearchMenu.textSearchString
model.searchMenuModel.textSearchModel
powerSearchBar = powerSearchBar =
div [ class "flex-grow flex flex-col relative" ] div [ class "flex-grow flex flex-col relative" ]
[ div [ div
@ -67,7 +60,11 @@ view texts model =
[ type_ "text" [ type_ "text"
, class S.textInput , class S.textInput
, class "text-sm" , class "text-sm"
, placeholder texts.fulltextPlaceholder , if flags.config.fullTextSearchEnabled then
placeholder texts.fulltextPlaceholder
else
placeholder texts.normalSearchPlaceholder
, onInput SetContentSearch , onInput SetContentSearch
, value (Maybe.withDefault "" model.contentSearch) , value (Maybe.withDefault "" model.contentSearch)
, Util.Html.onKeyUpCode ContentSearchKey , Util.Html.onKeyUpCode ContentSearchKey

View File

@ -214,7 +214,11 @@ makeSearchCmd flags model =
model.powerSearchInput.input model.powerSearchInput.input
SearchBarContent -> SearchBarContent ->
if flags.config.fullTextSearchEnabled then
Maybe.map (Q.Contents >> Q.render) model.contentSearch Maybe.map (Q.Contents >> Q.render) model.contentSearch
else
Maybe.map (Q.AllNames >> Q.render) model.contentSearch
] ]
request mq = request mq =

View File

@ -80,7 +80,7 @@ mainContent texts flags settings shareId model =
] ]
[ text <| Maybe.withDefault "" model.verifyResult.name [ text <| Maybe.withDefault "" model.verifyResult.name
] ]
, Menubar.view texts model , Menubar.view texts flags model
, errorMessage texts model , errorMessage texts model
, Results.view texts settings flags shareId model , Results.view texts settings flags shareId model
] ]