Make source a quick link on card and detail

This commit is contained in:
Eike Kettner 2021-01-11 21:37:36 +01:00
parent 63535408c9
commit 38ae7a9027
5 changed files with 25 additions and 9 deletions

View File

@ -263,13 +263,11 @@ metaDataContent settings item =
]
]
, div [ class "right floated meta" ]
[ div [ class "ui horizontal list" ]
[ div
[ class "item"
, title "Source"
]
[ IT.render IT.source item |> text
]
[ div [ class "ui horizontal link list" ]
[ Comp.LinkTarget.makeSourceLink
[ ( "item", True ) ]
SetLinkTarget
(IT.render IT.source item)
, div
[ classList
[ ( "item", True )

View File

@ -38,7 +38,6 @@ import Html.Events exposing (onCheck, onClick, onInput)
import Markdown
import Page exposing (Page(..))
import Set
import Util.CustomField
import Util.File exposing (makeFileId)
import Util.Folder
import Util.List
@ -560,7 +559,8 @@ renderItemInfo settings model =
[ class "item"
, title "Source"
]
[ text model.item.source
[ Icons.sourceIcon ""
, Comp.LinkTarget.makeSourceLink [] SetLinkTarget model.item.source
]
, True
)

View File

@ -4,6 +4,7 @@ module Comp.LinkTarget exposing
, makeCorrLink
, makeCustomFieldLink
, makeFolderLink
, makeSourceLink
, makeTagLink
)
@ -23,6 +24,7 @@ type LinkTarget
| LinkFolder IdName
| LinkTag IdName
| LinkCustomField ItemFieldValue
| LinkSource String
| LinkNone
@ -90,6 +92,15 @@ makeCustomFieldLink cv classes tagger =
cv
makeSourceLink :
List ( String, Bool )
-> (LinkTarget -> msg)
-> String
-> Html msg
makeSourceLink classes tagger str =
makeLink classes (.name >> LinkSource >> tagger) (IdName "" str)
--- Helpers

View File

@ -358,6 +358,7 @@ type Msg
| SetCustomField ItemFieldValue
| CustomFieldMsg Comp.CustomFieldMultiInput.Msg
| SetSource String
| ResetToSource String
| GetStatsResp (Result Http.Error SearchStats)
| GetAllTagsResp (Result Http.Error SearchStats)
@ -877,6 +878,9 @@ updateDrop ddm flags settings msg model =
, dragDrop = DD.DragDropData ddm Nothing
}
ResetToSource str ->
resetAndSet (SetSource str)
-- View

View File

@ -716,6 +716,9 @@ linkTargetMsg linkTarget =
Comp.LinkTarget.LinkCustomField id ->
Just <| SearchMenuMsg (Comp.SearchMenu.SetCustomField id)
Comp.LinkTarget.LinkSource str ->
Just <| SearchMenuMsg (Comp.SearchMenu.ResetToSource str)
doSearchMore : Flags -> UiSettings -> Model -> ( Model, Cmd Msg )
doSearchMore flags settings model =