mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-05 22:55:58 +00:00
Hide search menu by default and add search bar to top
Adds a search bar to the top of the listing page that is the same as the `All Names` search field in the search menu. Search menu can be toggled as before.
This commit is contained in:
parent
88234986e6
commit
e0c8c45061
@ -38,7 +38,7 @@ init _ =
|
|||||||
, itemListModel = Comp.ItemCardList.init
|
, itemListModel = Comp.ItemCardList.init
|
||||||
, searchInProgress = False
|
, searchInProgress = False
|
||||||
, viewMode = Listing
|
, viewMode = Listing
|
||||||
, menuCollapsed = False
|
, menuCollapsed = True
|
||||||
, searchOffset = 0
|
, searchOffset = 0
|
||||||
, moreAvailable = True
|
, moreAvailable = True
|
||||||
, moreInProgress = False
|
, moreInProgress = False
|
||||||
@ -57,6 +57,7 @@ type Msg
|
|||||||
| ToggleSearchMenu
|
| ToggleSearchMenu
|
||||||
| LoadMore
|
| LoadMore
|
||||||
| UpdateThrottle
|
| UpdateThrottle
|
||||||
|
| SetBasicSearch String
|
||||||
|
|
||||||
|
|
||||||
type ViewMode
|
type ViewMode
|
||||||
|
@ -143,6 +143,17 @@ update key flags settings msg model =
|
|||||||
in
|
in
|
||||||
withSub ( { model | throttle = newThrottle }, cmd )
|
withSub ( { model | throttle = newThrottle }, cmd )
|
||||||
|
|
||||||
|
SetBasicSearch str ->
|
||||||
|
let
|
||||||
|
m =
|
||||||
|
SearchMenuMsg (Comp.SearchMenu.SetAllName str)
|
||||||
|
in
|
||||||
|
update key flags settings m model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Helpers
|
||||||
|
|
||||||
|
|
||||||
doSearch : Flags -> UiSettings -> Model -> ( Model, Cmd Msg, Sub Msg )
|
doSearch : Flags -> UiSettings -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||||
doSearch flags settings model =
|
doSearch flags settings model =
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
module Page.Home.View exposing (view)
|
module Page.Home.View exposing (view)
|
||||||
|
|
||||||
|
import Api.Model.ItemSearch
|
||||||
import Comp.ItemCardList
|
import Comp.ItemCardList
|
||||||
import Comp.SearchMenu
|
import Comp.SearchMenu
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
import Html.Events exposing (onClick)
|
import Html.Events exposing (onClick, onInput)
|
||||||
import Page exposing (Page(..))
|
import Page exposing (Page(..))
|
||||||
import Page.Home.Data exposing (..)
|
import Page.Home.Data exposing (..)
|
||||||
|
|
||||||
@ -75,16 +76,44 @@ view settings model =
|
|||||||
[ div
|
[ div
|
||||||
[ classList
|
[ classList
|
||||||
[ ( "invisible hidden", not model.menuCollapsed )
|
[ ( "invisible hidden", not model.menuCollapsed )
|
||||||
, ( "ui segment container", True )
|
, ( "ui menu container", True )
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
[ a
|
[ a
|
||||||
[ class "ui basic large circular label"
|
[ class "item"
|
||||||
, onClick ToggleSearchMenu
|
, onClick ToggleSearchMenu
|
||||||
, href "#"
|
, href "#"
|
||||||
|
, title "Open search menu"
|
||||||
]
|
]
|
||||||
[ i [ class "search icon" ] []
|
[ i [ class "angle left icon" ] []
|
||||||
, text "Search Menu…"
|
, i [ class "icons" ]
|
||||||
|
[ i [ class "grey bars icon" ] []
|
||||||
|
, i [ class "bottom left corner search icon" ] []
|
||||||
|
, if hasMoreSearch model then
|
||||||
|
i [ class "top right blue corner circle icon" ] []
|
||||||
|
|
||||||
|
else
|
||||||
|
span [ class "hidden invisible" ] []
|
||||||
|
]
|
||||||
|
]
|
||||||
|
, div [ class "ui category search item" ]
|
||||||
|
[ div [ class "ui transparent icon input" ]
|
||||||
|
[ input
|
||||||
|
[ type_ "text"
|
||||||
|
, placeholder "Basic search…"
|
||||||
|
, onInput SetBasicSearch
|
||||||
|
, Maybe.map value model.searchMenuModel.allNameModel
|
||||||
|
|> Maybe.withDefault (value "")
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
, i
|
||||||
|
[ classList
|
||||||
|
[ ( "search link icon", not model.searchInProgress )
|
||||||
|
, ( "loading spinner icon", model.searchInProgress )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, case model.viewMode of
|
, case model.viewMode of
|
||||||
@ -126,3 +155,15 @@ view settings model =
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
hasMoreSearch : Model -> Bool
|
||||||
|
hasMoreSearch model =
|
||||||
|
let
|
||||||
|
is =
|
||||||
|
Comp.SearchMenu.getItemSearch model.searchMenuModel
|
||||||
|
|
||||||
|
is_ =
|
||||||
|
{ is | allNames = Nothing }
|
||||||
|
in
|
||||||
|
is_ /= Api.Model.ItemSearch.empty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user