Skip to content

Commit

Permalink
Change default to Sunday. Use radio buttons
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Schimandl <martin.schimandl@gmail.com>
  • Loading branch information
Git-Jiro committed Oct 18, 2022
1 parent 5cb449a commit 6319577
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
4 changes: 2 additions & 2 deletions asset/assets_vfsdata.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ui/app/src/Main.elm
Expand Up @@ -91,7 +91,7 @@ init flags url key =
firstDayOfWeek =
flags
|> Json.decodeValue (Json.field "firstDayOfWeek" Json.string)
|> Result.withDefault "Monday"
|> Result.withDefault "Sunday"
|> (\d ->
case d of
"Sunday" ->
Expand Down
33 changes: 16 additions & 17 deletions ui/app/src/Views/Settings/Views.elm
@@ -1,7 +1,7 @@
module Views.Settings.Views exposing (view)

import Html exposing (..)
import Html.Attributes exposing (class, for, id, selected, value)
import Html.Attributes exposing (checked, class, for, id, type_, value)
import Html.Events exposing (..)
import Utils.DateTimePicker.Utils exposing (FirstDayOfWeek(..))
import Views.Settings.Types exposing (Model, SettingsMsg(..))
Expand All @@ -10,27 +10,26 @@ import Views.Settings.Types exposing (Model, SettingsMsg(..))
view : Model -> Html SettingsMsg
view model =
div []
[ div [ class "row no-gutters" ]
[ div [ class "no-gutters" ]
[ label
[ for "select" ]
[ for "fieldset" ]
[ text "First day of the week:" ]
, select
[ onInput UpdateFirstDayOfWeek, id "select", class "form-control" ]
[ option
[ value "Monday"
, selected
(model.firstDayOfWeek == Monday)
]
[ text "Monday" ]
, option
[ value "Sunday"
, selected
(model.firstDayOfWeek == Sunday)
]
[ text "Sunday" ]
, fieldset [ id "fieldset" ]
[ radio "Monday" (model.firstDayOfWeek == Monday) UpdateFirstDayOfWeek
, radio "Sunday" (model.firstDayOfWeek == Sunday) UpdateFirstDayOfWeek
]
, small [ class "form-text text-muted" ]
[ text "Note: This setting is saved in local storage of your browser"
]
]
]


radio : String -> Bool -> (String -> msg) -> Html msg
radio radioValue isChecked msg =
div [ class "form-check" ]
[ input [ type_ "radio", onInput msg, class "form-check-input", id radioValue, checked isChecked, value radioValue ] []
, label [ class "form-check-label", for radioValue ]
[ text radioValue
]
]

0 comments on commit 6319577

Please sign in to comment.