Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow week to start at Monday or Sunday
Signed-off-by: Martin Schimandl <martin.schimandl@gmail.com>
- Loading branch information
Showing
18 changed files
with
228 additions
and
40 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Views.Settings.Parsing exposing (settingsViewParser) | ||
|
||
import Url.Parser exposing (Parser, s) | ||
|
||
|
||
settingsViewParser : Parser a a | ||
settingsViewParser = | ||
s "settings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Views.Settings.Types exposing (..) | ||
|
||
|
||
type alias Model = | ||
{ startOfWeek : Int | ||
} | ||
|
||
|
||
type SettingsMsg | ||
= UpdateStartWeekAtMonday String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
port module Views.Settings.Updates exposing (..) | ||
|
||
import Maybe | ||
import String | ||
import Task | ||
import Types exposing (Msg(..)) | ||
import Views.Settings.Types exposing (..) | ||
import Views.SilenceForm.Types exposing (SilenceFormMsg(..)) | ||
|
||
|
||
update : SettingsMsg -> Model -> ( Model, Cmd Msg ) | ||
update msg model = | ||
case msg of | ||
UpdateStartWeekAtMonday startOfWeekString -> | ||
let | ||
monday = | ||
startOfWeekString == "1" | ||
|
||
startOfWeek = | ||
Maybe.withDefault 7 | ||
(String.toInt | ||
startOfWeekString | ||
) | ||
in | ||
( { model | startOfWeek = startOfWeek } | ||
, Cmd.batch | ||
[ Task.perform identity | ||
(Task.succeed | ||
(MsgForSilenceForm | ||
(UpdateFirstDayOfWeek | ||
startOfWeek | ||
) | ||
) | ||
) | ||
, persistStartWeekAtMonday monday | ||
] | ||
) | ||
|
||
|
||
port persistStartWeekAtMonday : Bool -> Cmd msg |
Oops, something went wrong.