Skip to content

Instantly share code, notes, and snippets.

@frpaulas
Last active June 24, 2016 09:13
Show Gist options
  • Save frpaulas/65ee2eb620ec401cf76b5e390837e4fb to your computer and use it in GitHub Desktop.
Save frpaulas/65ee2eb620ec401cf76b5e390837e4fb to your computer and use it in GitHub Desktop.
select option
type Msg
= NoOp
| Checked Key String
| ChangeVersion String
| ChangeFootnote Bool
update: Msg -> Model -> Model
update msg model =
case msg of
NoOp -> model
Checked key val ->
let
foo = Debug.log "CONFIG CHANGE" (key, val)
newModel = case key of
OT -> {model | ot = val}
PS -> {model | ps = val}
NT -> {model | nt = val}
GS -> {model | gs = val}
Current -> {model | current = val}
in
newModel
ChangeVersion ver ->
let
newModel =
{ model | ot = ver
, ps = ver
, nt = ver
, gs = ver
, current = ver
}
in
newModel
ChangeFootnote bool -> {model | fnotes = if bool then "True" else "False"}
-- ...
versionSelect: Model -> Html Msg
versionSelect model =
let
thisVersion ver =
option
[ value ver
, selected (ver == model.current)
]
[text ver]
in
select [on "change" (Json.map ChangeVersion targetValue)] (List.map thisVersion model.vers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment