mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-25 16:45:05 +00:00
commit
9ce4330b94
@ -4756,7 +4756,7 @@ components:
|
|||||||
$ref: "#/components/schemas/IdName"
|
$ref: "#/components/schemas/IdName"
|
||||||
concPerson:
|
concPerson:
|
||||||
$ref: "#/components/schemas/IdName"
|
$ref: "#/components/schemas/IdName"
|
||||||
concEquip:
|
concEquipment:
|
||||||
$ref: "#/components/schemas/IdName"
|
$ref: "#/components/schemas/IdName"
|
||||||
folder:
|
folder:
|
||||||
$ref: "#/components/schemas/IdName"
|
$ref: "#/components/schemas/IdName"
|
||||||
|
@ -7,6 +7,7 @@ import Api
|
|||||||
import App.Data exposing (..)
|
import App.Data exposing (..)
|
||||||
import Browser exposing (UrlRequest(..))
|
import Browser exposing (UrlRequest(..))
|
||||||
import Browser.Navigation as Nav
|
import Browser.Navigation as Nav
|
||||||
|
import Comp.LinkTarget
|
||||||
import Data.Flags
|
import Data.Flags
|
||||||
import Page exposing (Page(..))
|
import Page exposing (Page(..))
|
||||||
import Page.CollectiveSettings.Data
|
import Page.CollectiveSettings.Data
|
||||||
@ -193,7 +194,7 @@ updateItemDetail lmsg model =
|
|||||||
inav =
|
inav =
|
||||||
Page.Home.Data.itemNav model.itemDetailModel.detail.item.id model.homeModel
|
Page.Home.Data.itemNav model.itemDetailModel.detail.item.id model.homeModel
|
||||||
|
|
||||||
( lm, lc, ls ) =
|
result =
|
||||||
Page.ItemDetail.Update.update
|
Page.ItemDetail.Update.update
|
||||||
model.key
|
model.key
|
||||||
model.flags
|
model.flags
|
||||||
@ -201,12 +202,18 @@ updateItemDetail lmsg model =
|
|||||||
model.uiSettings
|
model.uiSettings
|
||||||
lmsg
|
lmsg
|
||||||
model.itemDetailModel
|
model.itemDetailModel
|
||||||
|
|
||||||
|
model_ =
|
||||||
|
{ model
|
||||||
|
| itemDetailModel = result.model
|
||||||
|
}
|
||||||
|
|
||||||
|
( hm, hc, hs ) =
|
||||||
|
updateHome (Page.Home.Data.SetLinkTarget result.linkTarget) model_
|
||||||
in
|
in
|
||||||
( { model
|
( hm
|
||||||
| itemDetailModel = lm
|
, Cmd.batch [ Cmd.map ItemDetailMsg result.cmd, hc ]
|
||||||
}
|
, Sub.batch [ Sub.map ItemDetailMsg result.sub, hs ]
|
||||||
, Cmd.map ItemDetailMsg lc
|
|
||||||
, Sub.map ItemDetailMsg ls
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
module Comp.FolderSelect exposing
|
module Comp.FolderSelect exposing
|
||||||
( Model
|
( Model
|
||||||
, Msg
|
, Msg
|
||||||
|
, deselect
|
||||||
, init
|
, init
|
||||||
|
, setSelected
|
||||||
, update
|
, update
|
||||||
, updateDrop
|
, updateDrop
|
||||||
, view
|
, view
|
||||||
@ -32,6 +34,23 @@ init selected all =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setSelected : String -> Model -> Maybe Msg
|
||||||
|
setSelected id model =
|
||||||
|
List.filter (\fi -> fi.id == id) model.all
|
||||||
|
|> List.head
|
||||||
|
|> Maybe.map Toggle
|
||||||
|
|
||||||
|
|
||||||
|
deselect : Model -> Maybe Msg
|
||||||
|
deselect model =
|
||||||
|
case model.selected of
|
||||||
|
Just id ->
|
||||||
|
setSelected id model
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Update
|
--- Update
|
||||||
|
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
module Comp.ItemCard exposing (..)
|
module Comp.ItemCard exposing
|
||||||
|
( Model
|
||||||
|
, Msg
|
||||||
|
, UpdateResult
|
||||||
|
, ViewConfig
|
||||||
|
, init
|
||||||
|
, update
|
||||||
|
, view
|
||||||
|
)
|
||||||
|
|
||||||
import Api
|
import Api
|
||||||
import Api.Model.AttachmentLight exposing (AttachmentLight)
|
import Api.Model.AttachmentLight exposing (AttachmentLight)
|
||||||
import Api.Model.HighlightEntry exposing (HighlightEntry)
|
import Api.Model.HighlightEntry exposing (HighlightEntry)
|
||||||
|
import Api.Model.IdName exposing (IdName)
|
||||||
import Api.Model.ItemLight exposing (ItemLight)
|
import Api.Model.ItemLight exposing (ItemLight)
|
||||||
import Data.BasicSize
|
import Comp.LinkTarget exposing (LinkTarget(..))
|
||||||
import Data.Direction
|
import Data.Direction
|
||||||
import Data.Fields
|
import Data.Fields
|
||||||
import Data.Icons as Icons
|
import Data.Icons as Icons
|
||||||
@ -16,7 +25,6 @@ import Html.Events exposing (onClick)
|
|||||||
import Markdown
|
import Markdown
|
||||||
import Page exposing (Page(..))
|
import Page exposing (Page(..))
|
||||||
import Set exposing (Set)
|
import Set exposing (Set)
|
||||||
import Util.Html
|
|
||||||
import Util.ItemDragDrop as DD
|
import Util.ItemDragDrop as DD
|
||||||
import Util.List
|
import Util.List
|
||||||
import Util.Maybe
|
import Util.Maybe
|
||||||
@ -33,6 +41,7 @@ type Msg
|
|||||||
= CyclePreview ItemLight
|
= CyclePreview ItemLight
|
||||||
| ToggleSelectItem (Set String) String
|
| ToggleSelectItem (Set String) String
|
||||||
| ItemDDMsg DD.Msg
|
| ItemDDMsg DD.Msg
|
||||||
|
| SetLinkTarget LinkTarget
|
||||||
|
|
||||||
|
|
||||||
type alias ViewConfig =
|
type alias ViewConfig =
|
||||||
@ -45,6 +54,7 @@ type alias UpdateResult =
|
|||||||
{ model : Model
|
{ model : Model
|
||||||
, dragModel : DD.Model
|
, dragModel : DD.Model
|
||||||
, selection : ItemSelection
|
, selection : ItemSelection
|
||||||
|
, linkTarget : LinkTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +99,7 @@ update ddm msg model =
|
|||||||
ddd =
|
ddd =
|
||||||
DD.update lm ddm
|
DD.update lm ddm
|
||||||
in
|
in
|
||||||
UpdateResult model ddd.model Data.ItemSelection.Inactive
|
UpdateResult model ddd.model Data.ItemSelection.Inactive LinkNone
|
||||||
|
|
||||||
ToggleSelectItem ids id ->
|
ToggleSelectItem ids id ->
|
||||||
let
|
let
|
||||||
@ -100,7 +110,7 @@ update ddm msg model =
|
|||||||
else
|
else
|
||||||
Set.insert id ids
|
Set.insert id ids
|
||||||
in
|
in
|
||||||
UpdateResult model ddm (Data.ItemSelection.Active newSet)
|
UpdateResult model ddm (Data.ItemSelection.Active newSet) LinkNone
|
||||||
|
|
||||||
CyclePreview item ->
|
CyclePreview item ->
|
||||||
let
|
let
|
||||||
@ -113,6 +123,10 @@ update ddm msg model =
|
|||||||
UpdateResult { model | previewAttach = next }
|
UpdateResult { model | previewAttach = next }
|
||||||
ddm
|
ddm
|
||||||
Data.ItemSelection.Inactive
|
Data.ItemSelection.Inactive
|
||||||
|
LinkNone
|
||||||
|
|
||||||
|
SetLinkTarget target ->
|
||||||
|
UpdateResult model ddm Data.ItemSelection.Inactive target
|
||||||
|
|
||||||
|
|
||||||
view : ViewConfig -> UiSettings -> Model -> ItemLight -> Html Msg
|
view : ViewConfig -> UiSettings -> Model -> ItemLight -> Html Msg
|
||||||
@ -204,31 +218,15 @@ metaDataContent settings item =
|
|||||||
fieldHidden f =
|
fieldHidden f =
|
||||||
Data.UiSettings.fieldHidden settings f
|
Data.UiSettings.fieldHidden settings f
|
||||||
|
|
||||||
corr =
|
|
||||||
List.filterMap identity [ item.corrOrg, item.corrPerson ]
|
|
||||||
|> List.map .name
|
|
||||||
|> List.intersperse ", "
|
|
||||||
|> String.concat
|
|
||||||
|
|
||||||
conc =
|
|
||||||
List.filterMap identity [ item.concPerson, item.concEquip ]
|
|
||||||
|> List.map .name
|
|
||||||
|> List.intersperse ", "
|
|
||||||
|> String.concat
|
|
||||||
|
|
||||||
folder =
|
|
||||||
Maybe.map .name item.folder
|
|
||||||
|> Maybe.withDefault ""
|
|
||||||
|
|
||||||
dueDate =
|
dueDate =
|
||||||
Maybe.map Util.Time.formatDateShort item.dueDate
|
Maybe.map Util.Time.formatDateShort item.dueDate
|
||||||
|> Maybe.withDefault ""
|
|> Maybe.withDefault ""
|
||||||
in
|
in
|
||||||
div [ class "content" ]
|
div [ class "content" ]
|
||||||
[ div [ class "ui horizontal list" ]
|
[ div [ class "ui horizontal link list" ]
|
||||||
[ div
|
[ div
|
||||||
[ classList
|
[ classList
|
||||||
[ ( "item", True )
|
[ ( "link item", True )
|
||||||
, ( "invisible hidden"
|
, ( "invisible hidden"
|
||||||
, fieldHidden Data.Fields.CorrOrg
|
, fieldHidden Data.Fields.CorrOrg
|
||||||
&& fieldHidden Data.Fields.CorrPerson
|
&& fieldHidden Data.Fields.CorrPerson
|
||||||
@ -236,10 +234,9 @@ metaDataContent settings item =
|
|||||||
]
|
]
|
||||||
, title "Correspondent"
|
, title "Correspondent"
|
||||||
]
|
]
|
||||||
[ Icons.correspondentIcon ""
|
(Icons.correspondentIcon ""
|
||||||
, text " "
|
:: Comp.LinkTarget.makeCorrLink item SetLinkTarget
|
||||||
, Util.String.withDefault "-" corr |> text
|
)
|
||||||
]
|
|
||||||
, div
|
, div
|
||||||
[ classList
|
[ classList
|
||||||
[ ( "item", True )
|
[ ( "item", True )
|
||||||
@ -250,10 +247,9 @@ metaDataContent settings item =
|
|||||||
]
|
]
|
||||||
, title "Concerning"
|
, title "Concerning"
|
||||||
]
|
]
|
||||||
[ Icons.concernedIcon
|
(Icons.concernedIcon
|
||||||
, text " "
|
:: Comp.LinkTarget.makeConcLink item SetLinkTarget
|
||||||
, Util.String.withDefault "-" conc |> text
|
)
|
||||||
]
|
|
||||||
, div
|
, div
|
||||||
[ classList
|
[ classList
|
||||||
[ ( "item", True )
|
[ ( "item", True )
|
||||||
@ -262,8 +258,7 @@ metaDataContent settings item =
|
|||||||
, title "Folder"
|
, title "Folder"
|
||||||
]
|
]
|
||||||
[ Icons.folderIcon ""
|
[ Icons.folderIcon ""
|
||||||
, text " "
|
, Comp.LinkTarget.makeFolderLink item SetLinkTarget
|
||||||
, Util.String.withDefault "-" folder |> text
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, div [ class "right floated meta" ]
|
, div [ class "right floated meta" ]
|
||||||
@ -318,7 +313,7 @@ notesContent settings item =
|
|||||||
|
|
||||||
|
|
||||||
mainContent : Attribute Msg -> String -> Bool -> UiSettings -> ViewConfig -> ItemLight -> Html Msg
|
mainContent : Attribute Msg -> String -> Bool -> UiSettings -> ViewConfig -> ItemLight -> Html Msg
|
||||||
mainContent cardAction cardColor isConfirmed settings cfg item =
|
mainContent cardAction cardColor isConfirmed settings _ item =
|
||||||
let
|
let
|
||||||
dirIcon =
|
dirIcon =
|
||||||
i [ class (Data.Direction.iconFromMaybe item.direction) ] []
|
i [ class (Data.Direction.iconFromMaybe item.direction) ] []
|
||||||
@ -429,6 +424,7 @@ previewMenu model item mainAttach =
|
|||||||
[ class "ui compact basic icon button"
|
[ class "ui compact basic icon button"
|
||||||
, href attachUrl
|
, href attachUrl
|
||||||
, target "_self"
|
, target "_self"
|
||||||
|
, title "Open attachment file"
|
||||||
]
|
]
|
||||||
[ i [ class "eye icon" ] []
|
[ i [ class "eye icon" ] []
|
||||||
]
|
]
|
||||||
|
@ -14,6 +14,7 @@ import Api.Model.ItemLight exposing (ItemLight)
|
|||||||
import Api.Model.ItemLightGroup exposing (ItemLightGroup)
|
import Api.Model.ItemLightGroup exposing (ItemLightGroup)
|
||||||
import Api.Model.ItemLightList exposing (ItemLightList)
|
import Api.Model.ItemLightList exposing (ItemLightList)
|
||||||
import Comp.ItemCard
|
import Comp.ItemCard
|
||||||
|
import Comp.LinkTarget exposing (LinkTarget)
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.ItemSelection exposing (ItemSelection)
|
import Data.ItemSelection exposing (ItemSelection)
|
||||||
import Data.Items
|
import Data.Items
|
||||||
@ -75,6 +76,7 @@ type alias UpdateResult =
|
|||||||
, cmd : Cmd Msg
|
, cmd : Cmd Msg
|
||||||
, dragModel : DD.Model
|
, dragModel : DD.Model
|
||||||
, selection : ItemSelection
|
, selection : ItemSelection
|
||||||
|
, linkTarget : LinkTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,18 +93,30 @@ updateDrag dm _ msg model =
|
|||||||
newModel =
|
newModel =
|
||||||
{ model | results = list }
|
{ model | results = list }
|
||||||
in
|
in
|
||||||
UpdateResult newModel Cmd.none dm Data.ItemSelection.Inactive
|
UpdateResult newModel
|
||||||
|
Cmd.none
|
||||||
|
dm
|
||||||
|
Data.ItemSelection.Inactive
|
||||||
|
Comp.LinkTarget.LinkNone
|
||||||
|
|
||||||
AddResults list ->
|
AddResults list ->
|
||||||
if list.groups == [] then
|
if list.groups == [] then
|
||||||
UpdateResult model Cmd.none dm Data.ItemSelection.Inactive
|
UpdateResult model
|
||||||
|
Cmd.none
|
||||||
|
dm
|
||||||
|
Data.ItemSelection.Inactive
|
||||||
|
Comp.LinkTarget.LinkNone
|
||||||
|
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
newModel =
|
newModel =
|
||||||
{ model | results = Data.Items.concat model.results list }
|
{ model | results = Data.Items.concat model.results list }
|
||||||
in
|
in
|
||||||
UpdateResult newModel Cmd.none dm Data.ItemSelection.Inactive
|
UpdateResult newModel
|
||||||
|
Cmd.none
|
||||||
|
dm
|
||||||
|
Data.ItemSelection.Inactive
|
||||||
|
Comp.LinkTarget.LinkNone
|
||||||
|
|
||||||
ItemCardMsg item lm ->
|
ItemCardMsg item lm ->
|
||||||
let
|
let
|
||||||
@ -120,6 +134,7 @@ updateDrag dm _ msg model =
|
|||||||
Cmd.none
|
Cmd.none
|
||||||
result.dragModel
|
result.dragModel
|
||||||
result.selection
|
result.selection
|
||||||
|
result.linkTarget
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -134,7 +149,12 @@ type alias ViewConfig =
|
|||||||
|
|
||||||
view : ViewConfig -> UiSettings -> Model -> Html Msg
|
view : ViewConfig -> UiSettings -> Model -> Html Msg
|
||||||
view cfg settings model =
|
view cfg settings model =
|
||||||
div [ class "ui container" ]
|
div
|
||||||
|
[ classList
|
||||||
|
[ ( "ui container", True )
|
||||||
|
, ( "multi-select-mode", isMultiSelectMode cfg )
|
||||||
|
]
|
||||||
|
]
|
||||||
(List.map (viewGroup model cfg settings) model.results.groups)
|
(List.map (viewGroup model cfg settings) model.results.groups)
|
||||||
|
|
||||||
|
|
||||||
@ -171,3 +191,17 @@ viewItem model cfg settings item =
|
|||||||
Comp.ItemCard.view vvcfg settings cardModel item
|
Comp.ItemCard.view vvcfg settings cardModel item
|
||||||
in
|
in
|
||||||
Html.map (ItemCardMsg item) cardHtml
|
Html.map (ItemCardMsg item) cardHtml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Helpers
|
||||||
|
|
||||||
|
|
||||||
|
isMultiSelectMode : ViewConfig -> Bool
|
||||||
|
isMultiSelectMode cfg =
|
||||||
|
case cfg.selection of
|
||||||
|
Data.ItemSelection.Active _ ->
|
||||||
|
True
|
||||||
|
|
||||||
|
Data.ItemSelection.Inactive ->
|
||||||
|
False
|
||||||
|
@ -6,7 +6,7 @@ module Comp.ItemDetail exposing
|
|||||||
)
|
)
|
||||||
|
|
||||||
import Browser.Navigation as Nav
|
import Browser.Navigation as Nav
|
||||||
import Comp.ItemDetail.Model exposing (Msg(..))
|
import Comp.ItemDetail.Model exposing (Msg(..), UpdateResult)
|
||||||
import Comp.ItemDetail.Update
|
import Comp.ItemDetail.Update
|
||||||
import Comp.ItemDetail.View exposing (..)
|
import Comp.ItemDetail.View exposing (..)
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
@ -25,7 +25,7 @@ emptyModel =
|
|||||||
Comp.ItemDetail.Model.emptyModel
|
Comp.ItemDetail.Model.emptyModel
|
||||||
|
|
||||||
|
|
||||||
update : Nav.Key -> Flags -> ItemNav -> UiSettings -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
update : Nav.Key -> Flags -> ItemNav -> UiSettings -> Msg -> Model -> UpdateResult
|
||||||
update =
|
update =
|
||||||
Comp.ItemDetail.Update.update
|
Comp.ItemDetail.Update.update
|
||||||
|
|
||||||
|
@ -4,8 +4,12 @@ module Comp.ItemDetail.Model exposing
|
|||||||
, Msg(..)
|
, Msg(..)
|
||||||
, NotesField(..)
|
, NotesField(..)
|
||||||
, SaveNameState(..)
|
, SaveNameState(..)
|
||||||
|
, UpdateResult
|
||||||
, emptyModel
|
, emptyModel
|
||||||
, isEditNotes
|
, isEditNotes
|
||||||
|
, resultModel
|
||||||
|
, resultModelCmd
|
||||||
|
, resultModelCmdSub
|
||||||
)
|
)
|
||||||
|
|
||||||
import Api.Model.BasicResult exposing (BasicResult)
|
import Api.Model.BasicResult exposing (BasicResult)
|
||||||
@ -26,6 +30,7 @@ import Comp.Dropdown
|
|||||||
import Comp.Dropzone
|
import Comp.Dropzone
|
||||||
import Comp.ItemMail
|
import Comp.ItemMail
|
||||||
import Comp.KeyInput
|
import Comp.KeyInput
|
||||||
|
import Comp.LinkTarget exposing (LinkTarget)
|
||||||
import Comp.MarkdownInput
|
import Comp.MarkdownInput
|
||||||
import Comp.SentMails
|
import Comp.SentMails
|
||||||
import Comp.YesNoDimmer
|
import Comp.YesNoDimmer
|
||||||
@ -273,9 +278,33 @@ type Msg
|
|||||||
| KeyInputMsg Comp.KeyInput.Msg
|
| KeyInputMsg Comp.KeyInput.Msg
|
||||||
| ToggleAttachMenu
|
| ToggleAttachMenu
|
||||||
| UiSettingsUpdated
|
| UiSettingsUpdated
|
||||||
|
| SetLinkTarget LinkTarget
|
||||||
|
|
||||||
|
|
||||||
type SaveNameState
|
type SaveNameState
|
||||||
= Saving
|
= Saving
|
||||||
| SaveSuccess
|
| SaveSuccess
|
||||||
| SaveFailed
|
| SaveFailed
|
||||||
|
|
||||||
|
|
||||||
|
type alias UpdateResult =
|
||||||
|
{ model : Model
|
||||||
|
, cmd : Cmd Msg
|
||||||
|
, sub : Sub Msg
|
||||||
|
, linkTarget : LinkTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resultModel : Model -> UpdateResult
|
||||||
|
resultModel model =
|
||||||
|
UpdateResult model Cmd.none Sub.none Comp.LinkTarget.LinkNone
|
||||||
|
|
||||||
|
|
||||||
|
resultModelCmd : ( Model, Cmd Msg ) -> UpdateResult
|
||||||
|
resultModelCmd ( model, cmd ) =
|
||||||
|
UpdateResult model cmd Sub.none Comp.LinkTarget.LinkNone
|
||||||
|
|
||||||
|
|
||||||
|
resultModelCmdSub : ( Model, Cmd Msg, Sub Msg ) -> UpdateResult
|
||||||
|
resultModelCmdSub ( model, cmd, sub ) =
|
||||||
|
UpdateResult model cmd sub Comp.LinkTarget.LinkNone
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ module Comp.ItemDetail.View exposing (view)
|
|||||||
|
|
||||||
import Api
|
import Api
|
||||||
import Api.Model.Attachment exposing (Attachment)
|
import Api.Model.Attachment exposing (Attachment)
|
||||||
|
import Api.Model.IdName exposing (IdName)
|
||||||
import Comp.AttachmentMeta
|
import Comp.AttachmentMeta
|
||||||
import Comp.DatePicker
|
import Comp.DatePicker
|
||||||
import Comp.DetailEdit
|
import Comp.DetailEdit
|
||||||
@ -11,6 +12,7 @@ import Comp.ItemDetail.AttachmentTabMenu
|
|||||||
import Comp.ItemDetail.Model exposing (Model, Msg(..), NotesField(..), SaveNameState(..))
|
import Comp.ItemDetail.Model exposing (Model, Msg(..), NotesField(..), SaveNameState(..))
|
||||||
import Comp.ItemMail
|
import Comp.ItemMail
|
||||||
import Comp.KeyInput
|
import Comp.KeyInput
|
||||||
|
import Comp.LinkTarget
|
||||||
import Comp.MarkdownInput
|
import Comp.MarkdownInput
|
||||||
import Comp.SentMails
|
import Comp.SentMails
|
||||||
import Comp.YesNoDimmer
|
import Comp.YesNoDimmer
|
||||||
@ -519,13 +521,9 @@ renderItemInfo settings model =
|
|||||||
[ class "item"
|
[ class "item"
|
||||||
, title "Correspondent"
|
, title "Correspondent"
|
||||||
]
|
]
|
||||||
[ Icons.correspondentIcon ""
|
(Icons.correspondentIcon ""
|
||||||
, List.filterMap identity [ model.item.corrOrg, model.item.corrPerson ]
|
:: Comp.LinkTarget.makeCorrLink model.item SetLinkTarget
|
||||||
|> List.map .name
|
)
|
||||||
|> String.join ", "
|
|
||||||
|> Util.String.withDefault "(None)"
|
|
||||||
|> text
|
|
||||||
]
|
|
||||||
, Data.UiSettings.fieldVisible settings Data.Fields.CorrOrg
|
, Data.UiSettings.fieldVisible settings Data.Fields.CorrOrg
|
||||||
|| Data.UiSettings.fieldVisible settings Data.Fields.CorrPerson
|
|| Data.UiSettings.fieldVisible settings Data.Fields.CorrPerson
|
||||||
)
|
)
|
||||||
@ -535,13 +533,9 @@ renderItemInfo settings model =
|
|||||||
[ class "item"
|
[ class "item"
|
||||||
, title "Concerning"
|
, title "Concerning"
|
||||||
]
|
]
|
||||||
[ Icons.concernedIcon
|
(Icons.concernedIcon
|
||||||
, List.filterMap identity [ model.item.concPerson, model.item.concEquipment ]
|
:: Comp.LinkTarget.makeConcLink model.item SetLinkTarget
|
||||||
|> List.map .name
|
)
|
||||||
|> String.join ", "
|
|
||||||
|> Util.String.withDefault "(None)"
|
|
||||||
|> text
|
|
||||||
]
|
|
||||||
, Data.UiSettings.fieldVisible settings Data.Fields.ConcEquip
|
, Data.UiSettings.fieldVisible settings Data.Fields.ConcEquip
|
||||||
|| Data.UiSettings.fieldVisible settings Data.Fields.ConcPerson
|
|| Data.UiSettings.fieldVisible settings Data.Fields.ConcPerson
|
||||||
)
|
)
|
||||||
@ -552,9 +546,7 @@ renderItemInfo settings model =
|
|||||||
, title "Folder"
|
, title "Folder"
|
||||||
]
|
]
|
||||||
[ Icons.folderIcon ""
|
[ Icons.folderIcon ""
|
||||||
, Maybe.map .name model.item.folder
|
, Comp.LinkTarget.makeFolderLink model.item SetLinkTarget
|
||||||
|> Maybe.withDefault "-"
|
|
||||||
|> text
|
|
||||||
]
|
]
|
||||||
, Data.UiSettings.fieldVisible settings Data.Fields.Folder
|
, Data.UiSettings.fieldVisible settings Data.Fields.Folder
|
||||||
)
|
)
|
||||||
@ -592,7 +584,7 @@ renderItemInfo settings model =
|
|||||||
[ text "New!"
|
[ text "New!"
|
||||||
]
|
]
|
||||||
, div [ class "sub header" ]
|
, div [ class "sub header" ]
|
||||||
[ div [ class "ui horizontal bulleted list" ]
|
[ div [ class "ui horizontal bulleted link list" ]
|
||||||
(List.filter Tuple.second
|
(List.filter Tuple.second
|
||||||
[ date
|
[ date
|
||||||
, corr
|
, corr
|
||||||
@ -624,14 +616,12 @@ renderTags settings model =
|
|||||||
[ div [ class "ui right aligned fluid container" ] <|
|
[ div [ class "ui right aligned fluid container" ] <|
|
||||||
List.map
|
List.map
|
||||||
(\t ->
|
(\t ->
|
||||||
div
|
Comp.LinkTarget.makeTagLink
|
||||||
[ classList
|
(IdName t.id t.name)
|
||||||
[ ( "ui tag label", True )
|
[ ( "ui tag label", True )
|
||||||
, ( Data.UiSettings.tagColorString t settings, True )
|
, ( Data.UiSettings.tagColorString t settings, True )
|
||||||
]
|
|
||||||
]
|
|
||||||
[ text t.name
|
|
||||||
]
|
]
|
||||||
|
SetLinkTarget
|
||||||
)
|
)
|
||||||
model.item.tags
|
model.item.tags
|
||||||
]
|
]
|
||||||
|
105
modules/webapp/src/main/elm/Comp/LinkTarget.elm
Normal file
105
modules/webapp/src/main/elm/Comp/LinkTarget.elm
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
module Comp.LinkTarget exposing
|
||||||
|
( LinkTarget(..)
|
||||||
|
, makeConcLink
|
||||||
|
, makeCorrLink
|
||||||
|
, makeFolderLink
|
||||||
|
, makeTagLink
|
||||||
|
)
|
||||||
|
|
||||||
|
import Api.Model.IdName exposing (IdName)
|
||||||
|
import Html exposing (..)
|
||||||
|
import Html.Attributes exposing (..)
|
||||||
|
import Html.Events exposing (onClick)
|
||||||
|
|
||||||
|
|
||||||
|
type LinkTarget
|
||||||
|
= LinkCorrOrg IdName
|
||||||
|
| LinkCorrPerson IdName
|
||||||
|
| LinkConcPerson IdName
|
||||||
|
| LinkConcEquip IdName
|
||||||
|
| LinkFolder IdName
|
||||||
|
| LinkTag IdName
|
||||||
|
| LinkNone
|
||||||
|
|
||||||
|
|
||||||
|
makeCorrLink :
|
||||||
|
{ a | corrOrg : Maybe IdName, corrPerson : Maybe IdName }
|
||||||
|
-> (LinkTarget -> msg)
|
||||||
|
-> List (Html msg)
|
||||||
|
makeCorrLink item tagger =
|
||||||
|
let
|
||||||
|
makeOrg idname =
|
||||||
|
makeLink [] (LinkCorrOrg >> tagger) idname
|
||||||
|
|
||||||
|
makePerson idname =
|
||||||
|
makeLink [] (LinkCorrPerson >> tagger) idname
|
||||||
|
in
|
||||||
|
combine (Maybe.map makeOrg item.corrOrg) (Maybe.map makePerson item.corrPerson)
|
||||||
|
|
||||||
|
|
||||||
|
makeConcLink :
|
||||||
|
{ a | concPerson : Maybe IdName, concEquipment : Maybe IdName }
|
||||||
|
-> (LinkTarget -> msg)
|
||||||
|
-> List (Html msg)
|
||||||
|
makeConcLink item tagger =
|
||||||
|
let
|
||||||
|
makePerson idname =
|
||||||
|
makeLink [] (LinkConcPerson >> tagger) idname
|
||||||
|
|
||||||
|
makeEquip idname =
|
||||||
|
makeLink [] (LinkConcEquip >> tagger) idname
|
||||||
|
in
|
||||||
|
combine (Maybe.map makePerson item.concPerson) (Maybe.map makeEquip item.concEquipment)
|
||||||
|
|
||||||
|
|
||||||
|
makeFolderLink :
|
||||||
|
{ a | folder : Maybe IdName }
|
||||||
|
-> (LinkTarget -> msg)
|
||||||
|
-> Html msg
|
||||||
|
makeFolderLink item tagger =
|
||||||
|
let
|
||||||
|
makeFolder idname =
|
||||||
|
makeLink [] (LinkFolder >> tagger) idname
|
||||||
|
in
|
||||||
|
Maybe.map makeFolder item.folder
|
||||||
|
|> Maybe.withDefault (text "-")
|
||||||
|
|
||||||
|
|
||||||
|
makeTagLink :
|
||||||
|
IdName
|
||||||
|
-> List ( String, Bool )
|
||||||
|
-> (LinkTarget -> msg)
|
||||||
|
-> Html msg
|
||||||
|
makeTagLink tagId classes tagger =
|
||||||
|
makeLink classes (LinkTag >> tagger) tagId
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Helpers
|
||||||
|
|
||||||
|
|
||||||
|
combine : Maybe (Html msg) -> Maybe (Html msg) -> List (Html msg)
|
||||||
|
combine ma mb =
|
||||||
|
case ( ma, mb ) of
|
||||||
|
( Just a, Just b ) ->
|
||||||
|
[ a, text ", ", b ]
|
||||||
|
|
||||||
|
( Just a, Nothing ) ->
|
||||||
|
[ a ]
|
||||||
|
|
||||||
|
( Nothing, Just b ) ->
|
||||||
|
[ b ]
|
||||||
|
|
||||||
|
( Nothing, Nothing ) ->
|
||||||
|
[ text "-" ]
|
||||||
|
|
||||||
|
|
||||||
|
makeLink : List ( String, Bool ) -> (IdName -> msg) -> IdName -> Html msg
|
||||||
|
makeLink classes tagger idname =
|
||||||
|
a
|
||||||
|
[ onClick (tagger idname)
|
||||||
|
, href "#"
|
||||||
|
, classList classes
|
||||||
|
]
|
||||||
|
[ text idname.name
|
||||||
|
]
|
@ -191,6 +191,40 @@ getItemSearch model =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resetModel : Model -> Model
|
||||||
|
resetModel model =
|
||||||
|
let
|
||||||
|
emptyDropdown dm =
|
||||||
|
Comp.Dropdown.update (Comp.Dropdown.SetSelection []) dm
|
||||||
|
|> Tuple.first
|
||||||
|
|
||||||
|
emptyFolder fm =
|
||||||
|
Comp.FolderSelect.deselect fm
|
||||||
|
|> Maybe.map (\msg -> Comp.FolderSelect.update msg fm)
|
||||||
|
|> Maybe.map Tuple.first
|
||||||
|
|> Maybe.withDefault fm
|
||||||
|
in
|
||||||
|
{ model
|
||||||
|
| tagSelection = Comp.TagSelect.emptySelection
|
||||||
|
, tagSelectModel = Comp.TagSelect.reset model.tagSelectModel
|
||||||
|
, directionModel = emptyDropdown model.directionModel
|
||||||
|
, orgModel = emptyDropdown model.orgModel
|
||||||
|
, corrPersonModel = emptyDropdown model.corrPersonModel
|
||||||
|
, concPersonModel = emptyDropdown model.concPersonModel
|
||||||
|
, concEquipmentModel = emptyDropdown model.concEquipmentModel
|
||||||
|
, folderList = emptyFolder model.folderList
|
||||||
|
, selectedFolder = Nothing
|
||||||
|
, inboxCheckbox = False
|
||||||
|
, fromDate = Nothing
|
||||||
|
, untilDate = Nothing
|
||||||
|
, fromDueDate = Nothing
|
||||||
|
, untilDueDate = Nothing
|
||||||
|
, nameModel = Nothing
|
||||||
|
, allNameModel = Nothing
|
||||||
|
, fulltextModel = Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Update
|
-- Update
|
||||||
|
|
||||||
@ -220,6 +254,12 @@ type Msg
|
|||||||
| ToggleNameHelp
|
| ToggleNameHelp
|
||||||
| FolderSelectMsg Comp.FolderSelect.Msg
|
| FolderSelectMsg Comp.FolderSelect.Msg
|
||||||
| GetFolderResp (Result Http.Error FolderList)
|
| GetFolderResp (Result Http.Error FolderList)
|
||||||
|
| SetCorrOrg IdName
|
||||||
|
| SetCorrPerson IdName
|
||||||
|
| SetConcPerson IdName
|
||||||
|
| SetConcEquip IdName
|
||||||
|
| SetFolder IdName
|
||||||
|
| SetTag String
|
||||||
|
|
||||||
|
|
||||||
type alias NextState =
|
type alias NextState =
|
||||||
@ -237,6 +277,26 @@ update =
|
|||||||
|
|
||||||
updateDrop : DD.Model -> Flags -> UiSettings -> Msg -> Model -> NextState
|
updateDrop : DD.Model -> Flags -> UiSettings -> Msg -> Model -> NextState
|
||||||
updateDrop ddm flags settings msg model =
|
updateDrop ddm flags settings msg model =
|
||||||
|
let
|
||||||
|
resetAndSet : Msg -> NextState
|
||||||
|
resetAndSet m =
|
||||||
|
let
|
||||||
|
reset =
|
||||||
|
resetModel model
|
||||||
|
|
||||||
|
set =
|
||||||
|
updateDrop ddm
|
||||||
|
flags
|
||||||
|
settings
|
||||||
|
m
|
||||||
|
reset
|
||||||
|
in
|
||||||
|
{ model = set.model
|
||||||
|
, cmd = set.cmd
|
||||||
|
, stateChange = True
|
||||||
|
, dragDrop = set.dragDrop
|
||||||
|
}
|
||||||
|
in
|
||||||
case msg of
|
case msg of
|
||||||
Init ->
|
Init ->
|
||||||
let
|
let
|
||||||
@ -278,11 +338,42 @@ updateDrop ddm flags settings msg model =
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResetForm ->
|
ResetForm ->
|
||||||
|
{ model = resetModel model
|
||||||
|
, cmd = Cmd.none
|
||||||
|
, stateChange = True
|
||||||
|
, dragDrop = DD.DragDropData ddm Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCorrOrg id ->
|
||||||
|
resetAndSet (OrgMsg (Comp.Dropdown.SetSelection [ id ]))
|
||||||
|
|
||||||
|
SetCorrPerson id ->
|
||||||
|
resetAndSet (CorrPersonMsg (Comp.Dropdown.SetSelection [ id ]))
|
||||||
|
|
||||||
|
SetConcPerson id ->
|
||||||
|
resetAndSet (ConcPersonMsg (Comp.Dropdown.SetSelection [ id ]))
|
||||||
|
|
||||||
|
SetFolder id ->
|
||||||
|
case Comp.FolderSelect.setSelected id.id model.folderList of
|
||||||
|
Just lm ->
|
||||||
|
resetAndSet (FolderSelectMsg lm)
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
{ model = model
|
||||||
|
, cmd = Cmd.none
|
||||||
|
, stateChange = False
|
||||||
|
, dragDrop = DD.DragDropData ddm Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
SetConcEquip id ->
|
||||||
let
|
let
|
||||||
next =
|
equip =
|
||||||
update flags settings Init init
|
Equipment id.id id.name 0
|
||||||
in
|
in
|
||||||
{ next | stateChange = True }
|
resetAndSet (ConcEquipmentMsg (Comp.Dropdown.SetSelection [ equip ]))
|
||||||
|
|
||||||
|
SetTag id ->
|
||||||
|
resetAndSet (TagSelectMsg (Comp.TagSelect.toggleTag id))
|
||||||
|
|
||||||
GetTagsResp (Ok tags) ->
|
GetTagsResp (Ok tags) ->
|
||||||
let
|
let
|
||||||
|
@ -5,6 +5,8 @@ module Comp.TagSelect exposing
|
|||||||
, Selection
|
, Selection
|
||||||
, emptySelection
|
, emptySelection
|
||||||
, init
|
, init
|
||||||
|
, reset
|
||||||
|
, toggleTag
|
||||||
, update
|
, update
|
||||||
, updateDrop
|
, updateDrop
|
||||||
, viewCats
|
, viewCats
|
||||||
@ -75,6 +77,19 @@ init sel tags =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
reset : Model -> Model
|
||||||
|
reset model =
|
||||||
|
{ model
|
||||||
|
| selectedTags = Dict.empty
|
||||||
|
, selectedCats = Dict.empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
toggleTag : String -> Msg
|
||||||
|
toggleTag id =
|
||||||
|
ToggleTag id
|
||||||
|
|
||||||
|
|
||||||
sumCategories : List TagCount -> List Category
|
sumCategories : List TagCount -> List Category
|
||||||
sumCategories tags =
|
sumCategories tags =
|
||||||
let
|
let
|
||||||
|
@ -25,6 +25,7 @@ import Comp.FixedDropdown
|
|||||||
import Comp.ItemCardList
|
import Comp.ItemCardList
|
||||||
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
||||||
import Comp.ItemDetail.FormChange exposing (FormChange)
|
import Comp.ItemDetail.FormChange exposing (FormChange)
|
||||||
|
import Comp.LinkTarget exposing (LinkTarget)
|
||||||
import Comp.SearchMenu
|
import Comp.SearchMenu
|
||||||
import Comp.YesNoDimmer
|
import Comp.YesNoDimmer
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
@ -174,6 +175,7 @@ type Msg
|
|||||||
| ReplaceChangedItemsResp (Result Http.Error ItemLightList)
|
| ReplaceChangedItemsResp (Result Http.Error ItemLightList)
|
||||||
| DeleteAllResp (Result Http.Error BasicResult)
|
| DeleteAllResp (Result Http.Error BasicResult)
|
||||||
| UiSettingsUpdated
|
| UiSettingsUpdated
|
||||||
|
| SetLinkTarget LinkTarget
|
||||||
|
|
||||||
|
|
||||||
type SearchType
|
type SearchType
|
||||||
|
@ -6,9 +6,11 @@ import Api.Model.ItemLightList exposing (ItemLightList)
|
|||||||
import Api.Model.ItemSearch
|
import Api.Model.ItemSearch
|
||||||
import Browser.Navigation as Nav
|
import Browser.Navigation as Nav
|
||||||
import Comp.FixedDropdown
|
import Comp.FixedDropdown
|
||||||
|
import Comp.ItemCard
|
||||||
import Comp.ItemCardList
|
import Comp.ItemCardList
|
||||||
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
||||||
import Comp.ItemDetail.FormChange exposing (FormChange(..))
|
import Comp.ItemDetail.FormChange exposing (FormChange(..))
|
||||||
|
import Comp.LinkTarget exposing (LinkTarget)
|
||||||
import Comp.SearchMenu
|
import Comp.SearchMenu
|
||||||
import Comp.YesNoDimmer
|
import Comp.YesNoDimmer
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
@ -46,6 +48,7 @@ update mId key flags settings msg model =
|
|||||||
{ model
|
{ model
|
||||||
| searchOffset = 0
|
| searchOffset = 0
|
||||||
, searchType = defaultSearchType flags
|
, searchType = defaultSearchType flags
|
||||||
|
, contentOnlySearch = Nothing
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
update mId key flags settings (SearchMenuMsg Comp.SearchMenu.ResetForm) nm
|
update mId key flags settings (SearchMenuMsg Comp.SearchMenu.ResetForm) nm
|
||||||
@ -85,6 +88,14 @@ update mId key flags settings msg model =
|
|||||||
, s2
|
, s2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SetLinkTarget lt ->
|
||||||
|
case linkTargetMsg lt of
|
||||||
|
Just m ->
|
||||||
|
update mId key flags settings m model
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
( model, Cmd.none, Sub.none )
|
||||||
|
|
||||||
ItemCardListMsg m ->
|
ItemCardListMsg m ->
|
||||||
let
|
let
|
||||||
result =
|
result =
|
||||||
@ -93,6 +104,10 @@ update mId key flags settings msg model =
|
|||||||
m
|
m
|
||||||
model.itemListModel
|
model.itemListModel
|
||||||
|
|
||||||
|
searchMsg =
|
||||||
|
Maybe.map Util.Update.cmdUnit (linkTargetMsg result.linkTarget)
|
||||||
|
|> Maybe.withDefault Cmd.none
|
||||||
|
|
||||||
nextView =
|
nextView =
|
||||||
case ( model.viewMode, result.selection ) of
|
case ( model.viewMode, result.selection ) of
|
||||||
( SelectView svm, Data.ItemSelection.Active ids ) ->
|
( SelectView svm, Data.ItemSelection.Active ids ) ->
|
||||||
@ -107,7 +122,7 @@ update mId key flags settings msg model =
|
|||||||
, viewMode = nextView
|
, viewMode = nextView
|
||||||
, dragDropData = DD.DragDropData result.dragModel Nothing
|
, dragDropData = DD.DragDropData result.dragModel Nothing
|
||||||
}
|
}
|
||||||
, Cmd.batch [ Cmd.map ItemCardListMsg result.cmd ]
|
, Cmd.batch [ Cmd.map ItemCardListMsg result.cmd, searchMsg ]
|
||||||
)
|
)
|
||||||
|
|
||||||
ItemSearchResp scroll (Ok list) ->
|
ItemSearchResp scroll (Ok list) ->
|
||||||
@ -642,6 +657,31 @@ doSearch flags settings scroll model =
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
linkTargetMsg : LinkTarget -> Maybe Msg
|
||||||
|
linkTargetMsg linkTarget =
|
||||||
|
case linkTarget of
|
||||||
|
Comp.LinkTarget.LinkNone ->
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
Comp.LinkTarget.LinkCorrOrg id ->
|
||||||
|
Just <| SearchMenuMsg (Comp.SearchMenu.SetCorrOrg id)
|
||||||
|
|
||||||
|
Comp.LinkTarget.LinkCorrPerson id ->
|
||||||
|
Just <| SearchMenuMsg (Comp.SearchMenu.SetCorrPerson id)
|
||||||
|
|
||||||
|
Comp.LinkTarget.LinkConcPerson id ->
|
||||||
|
Just <| SearchMenuMsg (Comp.SearchMenu.SetConcPerson id)
|
||||||
|
|
||||||
|
Comp.LinkTarget.LinkConcEquip id ->
|
||||||
|
Just <| SearchMenuMsg (Comp.SearchMenu.SetConcEquip id)
|
||||||
|
|
||||||
|
Comp.LinkTarget.LinkFolder id ->
|
||||||
|
Just <| SearchMenuMsg (Comp.SearchMenu.SetFolder id)
|
||||||
|
|
||||||
|
Comp.LinkTarget.LinkTag id ->
|
||||||
|
Just <| SearchMenuMsg (Comp.SearchMenu.SetTag id.id)
|
||||||
|
|
||||||
|
|
||||||
doSearchMore : Flags -> UiSettings -> Model -> ( Model, Cmd Msg )
|
doSearchMore : Flags -> UiSettings -> Model -> ( Model, Cmd Msg )
|
||||||
doSearchMore flags settings model =
|
doSearchMore flags settings model =
|
||||||
let
|
let
|
||||||
|
@ -300,51 +300,74 @@ viewSearchBar flags model =
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
[ a
|
[ a
|
||||||
[ class "search-menu-toggle ui blue icon button"
|
[ classList
|
||||||
|
[ ( "search-menu-toggle ui icon button", True )
|
||||||
|
, ( "primary", not (searchMenuFilled model) )
|
||||||
|
, ( "secondary", searchMenuFilled model )
|
||||||
|
]
|
||||||
, onClick ToggleSearchMenu
|
, onClick ToggleSearchMenu
|
||||||
, href "#"
|
, href "#"
|
||||||
, title "Open search menu"
|
, title "Open search menu"
|
||||||
]
|
]
|
||||||
[ i [ class "filter icon" ] []
|
[ i [ class "filter icon" ] []
|
||||||
]
|
]
|
||||||
, div [ class "right fitted item" ]
|
, div [ class "right menu" ]
|
||||||
[ div [ class "ui left icon right action input" ]
|
[ div [ class "fitted item" ]
|
||||||
[ i
|
[ div [ class "ui left icon right action input" ]
|
||||||
[ classList
|
[ i
|
||||||
[ ( "search link icon", not model.searchInProgress )
|
[ classList
|
||||||
, ( "loading spinner icon", model.searchInProgress )
|
[ ( "search link icon", not model.searchInProgress )
|
||||||
]
|
, ( "loading spinner icon", model.searchInProgress )
|
||||||
, href "#"
|
|
||||||
, onClick DoSearch
|
|
||||||
]
|
|
||||||
(if hasMoreSearch model && model.searchTypeForm == BasicSearch then
|
|
||||||
[ i [ class "icons search-corner-icons" ]
|
|
||||||
[ i [ class "tiny blue circle icon" ] []
|
|
||||||
]
|
]
|
||||||
|
, href "#"
|
||||||
|
, onClick DoSearch
|
||||||
]
|
]
|
||||||
|
(if hasMoreSearch model && model.searchTypeForm == BasicSearch then
|
||||||
|
[ i [ class "icons search-corner-icons" ]
|
||||||
|
[ i [ class "tiny blue circle icon" ] []
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
else
|
else
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
, input
|
||||||
|
[ type_ "text"
|
||||||
|
, placeholder "Quick Search …"
|
||||||
|
, onInput SetBasicSearch
|
||||||
|
, Util.Html.onKeyUpCode KeyUpMsg
|
||||||
|
, Maybe.map value searchInput
|
||||||
|
|> Maybe.withDefault (value "")
|
||||||
|
]
|
||||||
[]
|
[]
|
||||||
)
|
, Html.map SearchTypeMsg
|
||||||
, input
|
(Comp.FixedDropdown.viewStyled searchTypeClass
|
||||||
[ type_ "text"
|
(Just searchTypeItem)
|
||||||
, placeholder "Quick Search …"
|
model.searchTypeDropdown
|
||||||
, onInput SetBasicSearch
|
)
|
||||||
, Util.Html.onKeyUpCode KeyUpMsg
|
, a
|
||||||
, Maybe.map value searchInput
|
[ class "ui icon basic button"
|
||||||
|> Maybe.withDefault (value "")
|
, href "#"
|
||||||
|
, onClick ResetSearch
|
||||||
|
, title "Reset search form"
|
||||||
|
]
|
||||||
|
[ i [ class "undo icon" ] []
|
||||||
|
]
|
||||||
]
|
]
|
||||||
[]
|
|
||||||
, Html.map SearchTypeMsg
|
|
||||||
(Comp.FixedDropdown.viewStyled searchTypeClass
|
|
||||||
(Just searchTypeItem)
|
|
||||||
model.searchTypeDropdown
|
|
||||||
)
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
searchMenuFilled : Model -> Bool
|
||||||
|
searchMenuFilled model =
|
||||||
|
let
|
||||||
|
is =
|
||||||
|
Comp.SearchMenu.getItemSearch model.searchMenuModel
|
||||||
|
in
|
||||||
|
is /= Api.Model.ItemSearch.empty
|
||||||
|
|
||||||
|
|
||||||
hasMoreSearch : Model -> Bool
|
hasMoreSearch : Model -> Bool
|
||||||
hasMoreSearch model =
|
hasMoreSearch model =
|
||||||
let
|
let
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
module Page.ItemDetail.Data exposing (Model, Msg(..), emptyModel)
|
module Page.ItemDetail.Data exposing
|
||||||
|
( Model
|
||||||
|
, Msg(..)
|
||||||
|
, UpdateResult
|
||||||
|
, emptyModel
|
||||||
|
)
|
||||||
|
|
||||||
import Api.Model.ItemDetail exposing (ItemDetail)
|
import Api.Model.ItemDetail exposing (ItemDetail)
|
||||||
import Browser.Dom as Dom
|
import Browser.Dom as Dom
|
||||||
import Comp.ItemDetail
|
import Comp.ItemDetail
|
||||||
import Comp.ItemDetail.Model
|
import Comp.ItemDetail.Model
|
||||||
|
import Comp.LinkTarget exposing (LinkTarget)
|
||||||
import Http
|
import Http
|
||||||
|
|
||||||
|
|
||||||
@ -24,3 +30,11 @@ type Msg
|
|||||||
| ItemResp (Result Http.Error ItemDetail)
|
| ItemResp (Result Http.Error ItemDetail)
|
||||||
| ScrollResult (Result Dom.Error ())
|
| ScrollResult (Result Dom.Error ())
|
||||||
| UiSettingsUpdated
|
| UiSettingsUpdated
|
||||||
|
|
||||||
|
|
||||||
|
type alias UpdateResult =
|
||||||
|
{ model : Model
|
||||||
|
, cmd : Cmd Msg
|
||||||
|
, sub : Sub Msg
|
||||||
|
, linkTarget : LinkTarget
|
||||||
|
}
|
||||||
|
@ -4,20 +4,22 @@ import Api
|
|||||||
import Browser.Navigation as Nav
|
import Browser.Navigation as Nav
|
||||||
import Comp.ItemDetail
|
import Comp.ItemDetail
|
||||||
import Comp.ItemDetail.Model
|
import Comp.ItemDetail.Model
|
||||||
|
import Comp.LinkTarget
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Data.ItemNav exposing (ItemNav)
|
import Data.ItemNav exposing (ItemNav)
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Page.ItemDetail.Data exposing (Model, Msg(..))
|
import Page exposing (Page(..))
|
||||||
|
import Page.ItemDetail.Data exposing (Model, Msg(..), UpdateResult)
|
||||||
import Scroll
|
import Scroll
|
||||||
import Task
|
import Task
|
||||||
|
|
||||||
|
|
||||||
update : Nav.Key -> Flags -> ItemNav -> UiSettings -> Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
|
update : Nav.Key -> Flags -> ItemNav -> UiSettings -> Msg -> Model -> UpdateResult
|
||||||
update key flags inav settings msg model =
|
update key flags inav settings msg model =
|
||||||
case msg of
|
case msg of
|
||||||
Init id ->
|
Init id ->
|
||||||
let
|
let
|
||||||
( lm, lc, ls ) =
|
result =
|
||||||
Comp.ItemDetail.update key
|
Comp.ItemDetail.update key
|
||||||
flags
|
flags
|
||||||
inav
|
inav
|
||||||
@ -28,24 +30,35 @@ update key flags inav settings msg model =
|
|||||||
task =
|
task =
|
||||||
Scroll.scroll "main-content" 0 0 0 0
|
Scroll.scroll "main-content" 0 0 0 0
|
||||||
in
|
in
|
||||||
( { model | detail = lm }
|
{ model = { model | detail = result.model }
|
||||||
, Cmd.batch
|
, cmd =
|
||||||
[ Api.itemDetail flags id ItemResp
|
Cmd.batch
|
||||||
, Cmd.map ItemDetailMsg lc
|
[ Api.itemDetail flags id ItemResp
|
||||||
, Task.attempt ScrollResult task
|
, Cmd.map ItemDetailMsg result.cmd
|
||||||
]
|
, Task.attempt ScrollResult task
|
||||||
, Sub.map ItemDetailMsg ls
|
]
|
||||||
)
|
, sub = Sub.map ItemDetailMsg result.sub
|
||||||
|
, linkTarget = result.linkTarget
|
||||||
|
}
|
||||||
|
|
||||||
ItemDetailMsg lmsg ->
|
ItemDetailMsg lmsg ->
|
||||||
let
|
let
|
||||||
( lm, lc, ls ) =
|
result =
|
||||||
Comp.ItemDetail.update key flags inav settings lmsg model.detail
|
Comp.ItemDetail.update key flags inav settings lmsg model.detail
|
||||||
|
|
||||||
|
pageSwitch =
|
||||||
|
case result.linkTarget of
|
||||||
|
Comp.LinkTarget.LinkNone ->
|
||||||
|
Cmd.none
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Page.set key HomePage
|
||||||
in
|
in
|
||||||
( { model | detail = lm }
|
{ model = { model | detail = result.model }
|
||||||
, Cmd.map ItemDetailMsg lc
|
, cmd = Cmd.batch [ pageSwitch, Cmd.map ItemDetailMsg result.cmd ]
|
||||||
, Sub.map ItemDetailMsg ls
|
, sub = Sub.map ItemDetailMsg result.sub
|
||||||
)
|
, linkTarget = result.linkTarget
|
||||||
|
}
|
||||||
|
|
||||||
ItemResp (Ok item) ->
|
ItemResp (Ok item) ->
|
||||||
let
|
let
|
||||||
@ -55,10 +68,10 @@ update key flags inav settings msg model =
|
|||||||
update key flags inav settings (ItemDetailMsg lmsg) model
|
update key flags inav settings (ItemDetailMsg lmsg) model
|
||||||
|
|
||||||
ItemResp (Err _) ->
|
ItemResp (Err _) ->
|
||||||
( model, Cmd.none, Sub.none )
|
UpdateResult model Cmd.none Sub.none Comp.LinkTarget.LinkNone
|
||||||
|
|
||||||
ScrollResult _ ->
|
ScrollResult _ ->
|
||||||
( model, Cmd.none, Sub.none )
|
UpdateResult model Cmd.none Sub.none Comp.LinkTarget.LinkNone
|
||||||
|
|
||||||
UiSettingsUpdated ->
|
UiSettingsUpdated ->
|
||||||
let
|
let
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
module Util.Update exposing (andThen1, andThen2)
|
module Util.Update exposing
|
||||||
|
( andThen1
|
||||||
|
, andThen2
|
||||||
|
, cmdUnit
|
||||||
|
)
|
||||||
|
|
||||||
|
import Task
|
||||||
|
|
||||||
|
|
||||||
andThen1 : List (a -> ( a, Cmd b )) -> a -> ( a, Cmd b )
|
andThen1 : List (a -> ( a, Cmd b )) -> a -> ( a, Cmd b )
|
||||||
@ -36,3 +42,8 @@ andThen2 fs m =
|
|||||||
in
|
in
|
||||||
List.foldl update init fs
|
List.foldl update init fs
|
||||||
|> combine
|
|> combine
|
||||||
|
|
||||||
|
|
||||||
|
cmdUnit : a -> Cmd a
|
||||||
|
cmdUnit a =
|
||||||
|
Task.perform (\_ -> a) (Task.succeed ())
|
||||||
|
@ -93,15 +93,18 @@
|
|||||||
padding: 0.8em;
|
padding: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.default-layout .ui.card .link.content:hover {
|
|
||||||
box-shadow: 0 0 0 1px #d4d4d5,0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
|
|
||||||
}
|
|
||||||
.default-layout .card .card-attachment-nav {
|
.default-layout .card .card-attachment-nav {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 4px;
|
left: 4px;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
z-index: 8;
|
z-index: 8;
|
||||||
}
|
}
|
||||||
|
.default-layout .multi-select-mode .ui.card {
|
||||||
|
border: 1px dashed rgba(34,36,38, .8);
|
||||||
|
}
|
||||||
|
.default-layout .ui.card:hover {
|
||||||
|
box-shadow: 0 0 0 1px #d4d4d5,0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
|
||||||
|
}
|
||||||
.default-layout .image.ds-card-image {
|
.default-layout .image.ds-card-image {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user