Skip to content

Commit

Permalink
notes
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomchak committed Jun 20, 2018
1 parent b78098b commit a8881a6
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/elm/Main.elm
Expand Up @@ -4,7 +4,7 @@ import Http
import Date exposing (..)
import Note exposing (Note, Image)
import Html exposing (Html, text, div, h1, img, li, ul, p, label, input)
import Html.Events exposing (onClick, onWithOptions)
import Html.Events exposing (onClick, onWithOptions, on)
import Html.Attributes exposing (src, class, for, type_, id, title)
import Bootstrap.ListGroup as Listgroup
import Bootstrap.Form as Form
Expand All @@ -23,14 +23,32 @@ type alias CreateNote =
, imageFile : Maybe Image
}

type alias UserData =
{
notes: List Note,
createNote : CreateNote
}

type Authenticated =
loggin : UserData
| annonyous
-- logged userData requires to be there for the user state

type alias Model =
{ notes : List Note
, isAuthenticated : Bool
, route : Route
, createNote : CreateNote
, createNote : CreateNote,
-- tag for each of the states
-- (authtenticated, annonyous),
}

-- type alias Mode =
{
authenticated : Authenticated,
route : Route
}


type alias Flags =
{ route : String
Expand Down Expand Up @@ -174,7 +192,7 @@ view model =
]
, Form.group []
[ Form.label [ for "file" ] [ text "Attachment" ]
, input [ type_ "file", id "imageFileInput" ] []
, input [ type_ "file", id "imageFileInput", on "change" (Json.Decode.succeed (SelectImageFile "imageFileInput"))] []
]
, Button.button [ Button.primary, Button.attrs [ onWithOptions "click" { stopPropagation = True, preventDefault = True } (Json.Decode.succeed (SelectImageFile "imageFileInput")) ] ] [ text "Create" ]
]
Expand Down

0 comments on commit a8881a6

Please sign in to comment.