mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-02-15 20:33:26 +00:00
Fix load more button
This commit is contained in:
parent
0883637e89
commit
cf3e051e83
@ -37,6 +37,7 @@ type alias Model =
|
||||
, throttle : Throttle Msg
|
||||
, searchTypeDropdown : Comp.FixedDropdown.Model SearchType
|
||||
, searchType : SearchType
|
||||
, searchTypeForm : SearchType
|
||||
, contentOnlySearch : Maybe String
|
||||
}
|
||||
|
||||
@ -63,7 +64,8 @@ init flags =
|
||||
, searchTypeDropdown =
|
||||
Comp.FixedDropdown.initMap searchTypeString
|
||||
searchTypeOptions
|
||||
, searchType = defaultSearchType flags
|
||||
, searchType = BasicSearch
|
||||
, searchTypeForm = defaultSearchType flags
|
||||
, contentOnlySearch = Nothing
|
||||
}
|
||||
|
||||
@ -134,19 +136,15 @@ itemNav id model =
|
||||
|
||||
doSearchCmd : Flags -> UiSettings -> Int -> Model -> Cmd Msg
|
||||
doSearchCmd flags settings offset model =
|
||||
if model.menuCollapsed then
|
||||
case model.searchType of
|
||||
BasicSearch ->
|
||||
doSearchDefaultCmd flags settings offset model
|
||||
case model.searchType of
|
||||
BasicSearch ->
|
||||
doSearchDefaultCmd flags settings offset model
|
||||
|
||||
ContentSearch ->
|
||||
doSearchDefaultCmd flags settings offset model
|
||||
ContentSearch ->
|
||||
doSearchDefaultCmd flags settings offset model
|
||||
|
||||
ContentOnlySearch ->
|
||||
doSearchIndexCmd flags settings offset model
|
||||
|
||||
else
|
||||
doSearchDefaultCmd flags settings offset model
|
||||
ContentOnlySearch ->
|
||||
doSearchIndexCmd flags settings offset model
|
||||
|
||||
|
||||
doSearchDefaultCmd : Flags -> UiSettings -> Int -> Model -> Cmd Msg
|
||||
|
@ -12,6 +12,7 @@ import Throttle
|
||||
import Time
|
||||
import Util.Html exposing (KeyCode(..))
|
||||
import Util.Maybe
|
||||
import Util.String
|
||||
import Util.Update
|
||||
|
||||
|
||||
@ -157,7 +158,7 @@ update key flags settings msg model =
|
||||
SetBasicSearch str ->
|
||||
let
|
||||
smMsg =
|
||||
case model.searchType of
|
||||
case model.searchTypeForm of
|
||||
BasicSearch ->
|
||||
SearchMenuMsg (Comp.SearchMenu.SetAllName str)
|
||||
|
||||
@ -183,7 +184,7 @@ update key flags settings msg model =
|
||||
withSub
|
||||
( { model
|
||||
| searchTypeDropdown = sm
|
||||
, searchType = Maybe.withDefault model.searchType mv
|
||||
, searchTypeForm = Maybe.withDefault model.searchTypeForm mv
|
||||
}
|
||||
, Cmd.none
|
||||
)
|
||||
@ -202,14 +203,27 @@ update key flags settings msg model =
|
||||
doSearch : Flags -> UiSettings -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||
doSearch flags settings model =
|
||||
let
|
||||
stype =
|
||||
if
|
||||
not model.menuCollapsed
|
||||
|| Util.String.isNothingOrBlank model.contentOnlySearch
|
||||
then
|
||||
BasicSearch
|
||||
|
||||
else
|
||||
model.searchTypeForm
|
||||
|
||||
model_ =
|
||||
{ model | searchType = stype }
|
||||
|
||||
searchCmd =
|
||||
doSearchCmd flags settings 0 model
|
||||
doSearchCmd flags settings 0 model_
|
||||
|
||||
( newThrottle, cmd ) =
|
||||
Throttle.try searchCmd model.throttle
|
||||
in
|
||||
withSub
|
||||
( { model
|
||||
( { model_
|
||||
| searchInProgress = cmd /= Cmd.none
|
||||
, viewMode = Listing
|
||||
, searchOffset = 0
|
||||
|
@ -122,11 +122,11 @@ viewSearchBar flags model =
|
||||
let
|
||||
searchTypeItem =
|
||||
Comp.FixedDropdown.Item
|
||||
model.searchType
|
||||
(searchTypeString model.searchType)
|
||||
model.searchTypeForm
|
||||
(searchTypeString model.searchTypeForm)
|
||||
|
||||
searchInput =
|
||||
case model.searchType of
|
||||
case model.searchTypeForm of
|
||||
BasicSearch ->
|
||||
model.searchMenuModel.allNameModel
|
||||
|
||||
@ -153,7 +153,7 @@ viewSearchBar flags model =
|
||||
[ class "item"
|
||||
, onClick ToggleSearchMenu
|
||||
, href "#"
|
||||
, if model.searchType == ContentOnlySearch then
|
||||
, if model.searchTypeForm == ContentOnlySearch then
|
||||
title "Search menu disabled"
|
||||
|
||||
else
|
||||
@ -163,7 +163,7 @@ viewSearchBar flags model =
|
||||
, i [ class "icons" ]
|
||||
[ i [ class "grey bars icon" ] []
|
||||
, i [ class "bottom left corner search icon" ] []
|
||||
, if model.searchType == ContentOnlySearch then
|
||||
, if model.searchTypeForm == ContentOnlySearch then
|
||||
i [ class "top right red corner delete icon" ] []
|
||||
|
||||
else if hasMoreSearch model then
|
||||
|
Loading…
Reference in New Issue
Block a user