Commit 67c3219b authored by Cédric F.'s avatar Cédric F.

Rename location flag to overlay

parent 68cdd649
Pipeline #5434761 passed with stage
in 1 minute and 51 seconds
......@@ -2,3 +2,4 @@
/dist
/lifechart.js
/lifechart.min.js
/mine.json
......@@ -38,7 +38,7 @@ type alias Event =
, to : Date
, color : Color
, label : String
, location : Bool
, overlay : Bool
}
......@@ -47,7 +47,7 @@ type alias EventForm =
, to : String
, color : String
, label : String
, location : Bool
, overlay : Bool
}
......@@ -112,7 +112,7 @@ type Msg
| HideUnproductiveYears Bool
| ShowEventForm Int
| UpdateEvent NewEventField String
| UpdateEventLocation Bool
| UpdateEventOverlay Bool
| SaveEvent
| DeleteEvent
| NewConfig String
......
......@@ -79,7 +79,7 @@ encodeEvent event =
, ( "to", encodeDate event.to )
, ( "color", encodeColor event.color )
, ( "label", Encode.string event.label )
, ( "location", Encode.bool event.location )
, ( "overlay", Encode.bool event.overlay )
]
......@@ -90,7 +90,7 @@ eventDecoder =
(Decode.field "to" dateDecoder)
(Decode.field "color" colorDecoder)
(Decode.field "label" Decode.string)
(Decode.field "location" Decode.bool)
(Decode.field "overlay" Decode.bool)
encodeDate : Date -> Encode.Value
......
......@@ -102,7 +102,7 @@ update msg model =
, to = DateExtra.toISOString <| Date.fromTime model.now
, color = Color.Convert.colorToHex fallbackColor
, label = ""
, location = False
, overlay = False
}
Just event ->
......@@ -110,7 +110,7 @@ update msg model =
, to = DateExtra.toISOString event.to
, color = Color.Convert.colorToHex event.color
, label = event.label
, location = event.location
, overlay = event.overlay
}
in
( { model | eventFormOpen = newId, eventForm = eventForm }, Cmd.none )
......@@ -137,13 +137,13 @@ update msg model =
in
( { model | eventForm = newForm }, Cmd.none )
UpdateEventLocation bool ->
UpdateEventOverlay bool ->
let
form =
model.eventForm
newForm =
{ form | location = bool }
{ form | overlay = bool }
in
( { model | eventForm = newForm }, Cmd.none )
......@@ -160,7 +160,7 @@ update msg model =
, color =
Color.Convert.hexToColor eventForm.color |> Maybe.withDefault fallbackColor
, label = eventForm.label
, location = eventForm.location
, overlay = eventForm.overlay
}
newEvents =
......
......@@ -206,13 +206,8 @@ week model year week =
(Date.toTime event.from <= time)
&& (Date.toTime event.to >= time)
events =
List.filter match model.events
|> List.filter (\event -> not event.location)
locations =
List.filter match model.events
|> List.filter .location
( overlays, events ) =
List.filter match model.events |> List.partition .overlay
colors =
List.map .color events
......@@ -238,11 +233,11 @@ week model year week =
Collage.square weekWidth |> Collage.filled color
letter =
List.head locations
List.head overlays
|> Maybe.andThen
(\location ->
(\overlay ->
Just
(location.label
(overlay.label
|> String.left 1
|> String.toUpper
|> Text.fromString
......
......@@ -67,7 +67,7 @@ links : Model -> List (Html Msg)
links model =
let
demo =
"ewogICJiaXJ0aC1kYXRlIjogIjE5ODgtMDctMjQiLAogICJsaWZlLWV4cGVjdGFuY3kiOiA4MCwKICAia2lkLXVudGlsIjogMTgsCiAgIm9sZC1mcm9tIjogNzAsCiAgImhpZGUtdW5wcm9kdWN0aXZlLXllYXJzIjogZmFsc2UsCiAgImV2ZW50cyI6IFsKICAgIHsKICAgICAgImZyb20iOiAiMjAxMC0wOS0xNCIsCiAgICAgICJ0byI6ICIyMDE0LTAyLTAxIiwKICAgICAgImNvbG9yIjogIiNmNTc5MDAiLAogICAgICAibGFiZWwiOiAiY29sbGVnZSIsCiAgICAgICJsb2NhdGlvbiI6IGZhbHNlCiAgICB9LAogICAgewogICAgICAiZnJvbSI6ICIyMDE1LTA2LTAxIiwKICAgICAgInRvIjogIjIwMTYtMDUtMzEiLAogICAgICAiY29sb3IiOiAiIzczZDIxNiIsCiAgICAgICJsYWJlbCI6ICJ0cmlwIiwKICAgICAgImxvY2F0aW9uIjogZmFsc2UKICAgIH0KICBdCn0K"
"ewogICJiaXJ0aC1kYXRlIjogIjE5ODgtMDctMjQiLAogICJsaWZlLWV4cGVjdGFuY3kiOiA4MCwKICAia2lkLXVudGlsIjogMTgsCiAgIm9sZC1mcm9tIjogNzAsCiAgImhpZGUtdW5wcm9kdWN0aXZlLXllYXJzIjogZmFsc2UsCiAgImV2ZW50cyI6IFsKICAgIHsKICAgICAgImZyb20iOiAiMjAxMC0wOS0xNCIsCiAgICAgICJ0byI6ICIyMDE0LTAyLTAxIiwKICAgICAgImNvbG9yIjogIiNmNTc5MDAiLAogICAgICAibGFiZWwiOiAiY29sbGVnZSIsCiAgICAgICJvdmVybGF5IjogZmFsc2UKICAgIH0sCiAgICB7CiAgICAgICJmcm9tIjogIjIwMTUtMDYtMDEiLAogICAgICAidG8iOiAiMjAxNi0wNS0zMSIsCiAgICAgICJjb2xvciI6ICIjNzNkMjE2IiwKICAgICAgImxhYmVsIjogInRyaXAiLAogICAgICAib3ZlcmxheSI6IGZhbHNlCiAgICB9CiAgXQp9Cg=="
current =
Serializer.serialize model
......@@ -271,16 +271,16 @@ eventForm model index =
[ input
[ class "form-check-input"
, type_ "checkbox"
, checked event.location
, onCheck UpdateEventLocation
, checked event.overlay
, onCheck UpdateEventOverlay
]
[]
, text " location (overlay)"
, text " overlay (e.g. country)"
]
, input
[ class <|
"float-xs-right"
++ if event.location then
++ if event.overlay then
" hidden-xs-up"
else
""
......@@ -321,13 +321,13 @@ events model =
, ( "color", "#FFFFFF" )
, ( "margin", "3px 0.5rem 0 0" )
, ( "padding"
, if event.location then
, if event.overlay then
"0 0 3px 3px"
else
"0"
)
, ( "background-color"
, if event.location then
, if event.overlay then
"#000000"
else
Color.Convert.colorToHex event.color
......@@ -335,7 +335,7 @@ events model =
]
]
[ text <|
if event.location then
if event.overlay then
String.left 1 event.label
else
""
......
......@@ -10,14 +10,14 @@
"to": "2014-02-01",
"color": "#f57900",
"label": "college",
"location": false
"overlay": false
},
{
"from": "2015-06-01",
"to": "2016-05-31",
"color": "#73d216",
"label": "trip",
"location": false
"overlay": false
}
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment