Allow to set item notes below or above the files

This commit is contained in:
Eike Kettner
2020-08-05 21:23:42 +02:00
parent 0453494cc6
commit baa25d0f2f
4 changed files with 117 additions and 29 deletions

View File

@ -12,7 +12,7 @@ import Comp.ColorTagger
import Comp.IntField
import Data.Color exposing (Color)
import Data.Flags exposing (Flags)
import Data.UiSettings exposing (UiSettings)
import Data.UiSettings exposing (Pos(..), UiSettings)
import Dict exposing (Dict)
import Html exposing (..)
import Html.Attributes exposing (..)
@ -29,6 +29,7 @@ type alias Model =
, nativePdfPreview : Bool
, itemSearchNoteLength : Maybe Int
, searchNoteLengthModel : Comp.IntField.Model
, itemDetailNotesPosition : Pos
}
@ -54,6 +55,7 @@ init flags settings =
(Just flags.config.maxNoteLength)
False
"Max. Note Length"
, itemDetailNotesPosition = settings.itemDetailNotesPosition
}
, Api.getTags flags "" GetTagsResp
)
@ -65,6 +67,7 @@ type Msg
| GetTagsResp (Result Http.Error TagList)
| TogglePdfPreview
| NoteLengthMsg Comp.IntField.Msg
| SetNotesPosition Pos
@ -106,6 +109,17 @@ update sett msg model =
in
( model_, nextSettings )
SetNotesPosition pos ->
let
model_ =
{ model | itemDetailNotesPosition = pos }
in
if model_.itemDetailNotesPosition == sett.itemDetailNotesPosition then
( model_, Nothing )
else
( model_, Just { sett | itemDetailNotesPosition = model_.itemDetailNotesPosition } )
TagColorMsg lm ->
let
( m_, d_ ) =
@ -207,6 +221,31 @@ view flags _ model =
]
]
]
, div [ class "grouped fields" ]
[ label [] [ text "Position of item notes" ]
, div [ class "field" ]
[ div [ class "ui radio checkbox" ]
[ input
[ type_ "radio"
, checked (model.itemDetailNotesPosition == Top)
, onCheck (\_ -> SetNotesPosition Top)
]
[]
, label [] [ text "Top" ]
]
]
, div [ class "field" ]
[ div [ class "ui radio checkbox" ]
[ input
[ type_ "radio"
, checked (model.itemDetailNotesPosition == Bottom)
, onCheck (\_ -> SetNotesPosition Bottom)
]
[]
, label [] [ text "Bottom" ]
]
]
]
, div [ class "ui dividing header" ]
[ text "Tag Category Colors"
]