Reorganize search menu items

This commit is contained in:
Eike Kettner 2020-06-13 16:18:24 +02:00
parent 617487f5b3
commit 6e4aeb512d
4 changed files with 32 additions and 33 deletions

View File

@ -209,7 +209,7 @@ viewItem settings item =
[ class "item" [ class "item"
, title "Correspondent" , title "Correspondent"
] ]
[ Icons.correspondentIcon [ Icons.correspondentIcon ""
, text " " , text " "
, Util.String.withDefault "-" corr |> text , Util.String.withDefault "-" corr |> text
] ]

View File

@ -1787,7 +1787,7 @@ renderItemInfo settings model =
[ class "item" [ class "item"
, title "Correspondent" , title "Correspondent"
] ]
[ Icons.correspondentIcon [ Icons.correspondentIcon ""
, List.filterMap identity [ model.item.corrOrg, model.item.corrPerson ] , List.filterMap identity [ model.item.corrOrg, model.item.corrPerson ]
|> List.map .name |> List.map .name
|> String.join ", " |> String.join ", "
@ -1994,7 +1994,7 @@ renderEditForm settings model =
, renderDueDateSuggestions model , renderDueDateSuggestions model
] ]
, h4 [ class "ui dividing header" ] , h4 [ class "ui dividing header" ]
[ Icons.correspondentIcon [ Icons.correspondentIcon ""
, text "Correspondent" , text "Correspondent"
] ]
, div [ class "field" ] , div [ class "field" ]

View File

@ -20,12 +20,14 @@ import Comp.DatePicker
import Comp.Dropdown exposing (isDropdownChangeMsg) import Comp.Dropdown exposing (isDropdownChangeMsg)
import Data.Direction exposing (Direction) import Data.Direction exposing (Direction)
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Data.Icons as Icons
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import DatePicker exposing (DatePicker) import DatePicker exposing (DatePicker)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onCheck, onInput) import Html.Events exposing (onCheck, onInput)
import Http import Http
import Util.Maybe
import Util.Tag import Util.Tag
import Util.Update import Util.Update
@ -444,11 +446,7 @@ update flags settings msg model =
SetName str -> SetName str ->
let let
next = next =
if str == "" then Util.Maybe.fromString str
Nothing
else
Just str
in in
NextState NextState
( { model | nameModel = next } ( { model | nameModel = next }
@ -463,6 +461,15 @@ update flags settings msg model =
view : UiSettings -> Model -> Html Msg view : UiSettings -> Model -> Html Msg
view settings model = view settings model =
let
formHeader icon headline =
div [ class "ui small dividing header" ]
[ icon
, div [ class "content" ]
[ text headline
]
]
in
div [ class "ui form" ] div [ class "ui form" ]
[ div [ class "inline field" ] [ div [ class "inline field" ]
[ div [ class "ui checkbox" ] [ div [ class "ui checkbox" ]
@ -491,13 +498,7 @@ view settings model =
, text " at beginning or end" , text " at beginning or end"
] ]
] ]
, div [ class "field" ] , formHeader (Icons.tagsIcon "") "Tags"
[ label [] [ text "Direction" ]
, Html.map DirectionMsg (Comp.Dropdown.view settings model.directionModel)
]
, h3 [ class "ui header" ]
[ text "Tags"
]
, div [ class "field" ] , div [ class "field" ]
[ label [] [ text "Include (and)" ] [ label [] [ text "Include (and)" ]
, Html.map TagIncMsg (Comp.Dropdown.view settings model.tagInclModel) , Html.map TagIncMsg (Comp.Dropdown.view settings model.tagInclModel)
@ -506,17 +507,17 @@ view settings model =
[ label [] [ text "Exclude (or)" ] [ label [] [ text "Exclude (or)" ]
, Html.map TagExcMsg (Comp.Dropdown.view settings model.tagExclModel) , Html.map TagExcMsg (Comp.Dropdown.view settings model.tagExclModel)
] ]
, h3 [ class "ui header" ] , formHeader (Icons.correspondentIcon "")
[ case getDirection model of (case getDirection model of
Just Data.Direction.Incoming -> Just Data.Direction.Incoming ->
text "Sender" "Sender"
Just Data.Direction.Outgoing -> Just Data.Direction.Outgoing ->
text "Recipient" "Recipient"
Nothing -> Nothing ->
text "Correspondent" "Correspondent"
] )
, div [ class "field" ] , div [ class "field" ]
[ label [] [ text "Organization" ] [ label [] [ text "Organization" ]
, Html.map OrgMsg (Comp.Dropdown.view settings model.orgModel) , Html.map OrgMsg (Comp.Dropdown.view settings model.orgModel)
@ -525,9 +526,7 @@ view settings model =
[ label [] [ text "Person" ] [ label [] [ text "Person" ]
, Html.map CorrPersonMsg (Comp.Dropdown.view settings model.corrPersonModel) , Html.map CorrPersonMsg (Comp.Dropdown.view settings model.corrPersonModel)
] ]
, h3 [ class "ui header" ] , formHeader Icons.concernedIcon "Concerned"
[ text "Concerned"
]
, div [ class "field" ] , div [ class "field" ]
[ label [] [ text "Person" ] [ label [] [ text "Person" ]
, Html.map ConcPersonMsg (Comp.Dropdown.view settings model.concPersonModel) , Html.map ConcPersonMsg (Comp.Dropdown.view settings model.concPersonModel)
@ -536,9 +535,7 @@ view settings model =
[ label [] [ text "Equipment" ] [ label [] [ text "Equipment" ]
, Html.map ConcEquipmentMsg (Comp.Dropdown.view settings model.concEquipmentModel) , Html.map ConcEquipmentMsg (Comp.Dropdown.view settings model.concEquipmentModel)
] ]
, h3 [ class "ui header" ] , formHeader (Icons.dateIcon "") "Date"
[ text "Date"
]
, div [ class "fields" ] , div [ class "fields" ]
[ div [ class "field" ] [ div [ class "field" ]
[ label [] [ label []
@ -561,9 +558,7 @@ view settings model =
) )
] ]
] ]
, h3 [ class "ui header" ] , formHeader (Icons.dueDateIcon "") "Due Date"
[ text "Due Date"
]
, div [ class "fields" ] , div [ class "fields" ]
[ div [ class "field" ] [ div [ class "field" ]
[ label [] [ label []
@ -586,4 +581,8 @@ view settings model =
) )
] ]
] ]
, formHeader (Icons.directionIcon "") "Direction"
, div [ class "field" ]
[ Html.map DirectionMsg (Comp.Dropdown.view settings model.directionModel)
]
] ]

View File

@ -44,9 +44,9 @@ correspondent =
"address card outline icon" "address card outline icon"
correspondentIcon : Html msg correspondentIcon : String -> Html msg
correspondentIcon = correspondentIcon classes =
i [ class correspondent ] [] i [ class (correspondent ++ " " ++ classes) ] []
date : String date : String