Permalink for bookmark searches

This commit is contained in:
eikek
2022-01-26 21:21:36 +01:00
parent 631450cb16
commit cb3005211b
14 changed files with 114 additions and 81 deletions

View File

@ -42,10 +42,7 @@ import Comp.ItemDetail.Model
, UpdateResult
, ViewMode(..)
, initSelectViewModel
, initShowQrModel
, isEditNotes
, isShowQrAttach
, isShowQrItem
, resultModel
, resultModelCmd
, resultModelCmdSub
@ -741,7 +738,7 @@ update key flags inav settings msg model =
resultModelCmd ( model, Page.set key (ItemDetailPage id) )
Nothing ->
resultModelCmd ( model, Page.set key SearchPage )
resultModelCmd ( model, Page.set key (SearchPage Nothing) )
in
{ result_ | removedItem = Just removedId }

View File

@ -80,7 +80,7 @@ menuBar texts inav settings model =
[ MB.CustomElement <|
a
[ class S.secondaryBasicButton
, Page.href SearchPage
, Page.href (SearchPage Nothing)
, title texts.backToSearchResults
]
[ i [ class "fa fa-arrow-left" ] []

View File

@ -35,6 +35,7 @@ type LinkTarget
| LinkTag IdName
| LinkCustomField ItemFieldValue
| LinkSource String
| LinkBookmark String
| LinkNone

View File

@ -59,7 +59,7 @@ import Data.UiSettings exposing (UiSettings)
import DatePicker exposing (DatePicker)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput)
import Html.Events exposing (onInput)
import Http
import Messages.Comp.SearchMenu exposing (Texts)
import Set exposing (Set)
@ -385,6 +385,7 @@ type Msg
| SetConcEquip IdName
| SetFolder IdName
| SetTag String
| SetBookmark String
| SetCustomField ItemFieldValue
| CustomFieldMsg Comp.CustomFieldMultiInput.Msg
| SetSource String
@ -432,6 +433,9 @@ linkTargetMsg linkTarget =
Comp.LinkTarget.LinkSource str ->
Just <| ResetToSource str
Comp.LinkTarget.LinkBookmark id ->
Just <| SetBookmark id
type alias NextState =
{ model : Model
@ -556,6 +560,22 @@ updateDrop ddm flags settings msg model =
SetTag id ->
resetAndSet (TagSelectMsg (Comp.TagSelect.toggleTag id))
SetBookmark id ->
let
nextModel =
resetModel model
sel =
{ bookmarks = Set.singleton id
, shares = Set.empty
}
in
{ model = { nextModel | selectedBookmarks = sel }
, cmd = Cmd.none
, stateChange = sel /= model.selectedBookmarks
, dragDrop = DD.DragDropData ddm Nothing
}
GetAllTagsResp (Ok stats) ->
let
tagSel =
@ -1064,7 +1084,7 @@ updateDrop ddm flags settings msg model =
AllBookmarksResp (Ok bm) ->
{ model = { model | allBookmarks = Comp.BookmarkChooser.init bm }
, cmd = Cmd.none
, stateChange = False
, stateChange = model.allBookmarks /= Comp.BookmarkChooser.init bm
, dragDrop = DD.DragDropData ddm Nothing
}
@ -1082,7 +1102,7 @@ updateDrop ddm flags settings msg model =
in
{ model = { model | allBookmarks = next, selectedBookmarks = sel }
, cmd = Cmd.none
, stateChange = sel /= model.selectedBookmarks
, stateChange = sel /= model.selectedBookmarks || model.allBookmarks /= next
, dragDrop = DD.DragDropData ddm Nothing
}