···11module Abroad.View exposing (..)
2233+import Abroad.Ports
34import Abroad.Types exposing (Msg(..))
45import Authentication.UserData
56import Color.Convert exposing (colorToCssRgb)
66-import FileReader exposing (onFileChange)
77import Html exposing (..)
88import Html.Attributes exposing (..)
99-import Html.Events exposing (onSubmit)
99+import Html.Events exposing (on, onSubmit)
1010+import Json.Decode
1011import Material.Icons.Navigation as Icons
1112import Navigation.View as Navigation
1213import Routing.Types
···5253 """
5354 ]
5455 , Html.form
5555- [ onSubmit (AbroadMsg UploadFiles)
5656+ [ onSubmit (AbroadMsg Import)
5657 ]
5758 [ importView model
5859 , exportView model
···7273 [ label
7374 []
7475 [ text "Import" ]
7676+7777+ -- Input
7878+ --
7579 , input
7676- [ type_ "file"
7777- , name "fileInput"
7878- , id "fileInput"
7979- , accept ".json"
8080- , onFileChange (SetFiles >> AbroadMsg)
8080+ [ accept ".json"
8181+ , id Abroad.Ports.importFileInputId
8282+ , name Abroad.Ports.importFileInputId
8383+ , on "change" (Json.Decode.succeed <| AbroadMsg FileSelectedForImport)
8484+ , type_ "file"
8185 ]
8286 []
8787+8888+ -- Label
8989+ --
8390 , label
8484- [ for "fileInput"
9191+ [ for Abroad.Ports.importFileInputId
8592 , cssClasses [ Button, ButtonSubtle ]
8693 ]
8794 [ text "Choose file" ]
8888- , if List.isEmpty model.abroad.files then
8989- text ""
9090- else
9595+ , if model.abroad.fileSelected then
9196 button
9297 [ cssClasses [ Button ]
9398 , type_ "submit"
9499 ]
95100 [ text "Import" ]
101101+ else
102102+ text ""
103103+104104+ -- Message
105105+ --
96106 , em
97107 [ style
98108 [ ( "display", "block" )
···102112 ]
103113 [ case model.abroad.importMessage of
104114 Ok "" ->
105105- if List.isEmpty model.abroad.files == False then
115115+ if model.abroad.fileSelected then
106116 span
107117 []
108118 [ text "Click on the "
+1-1
src/App/Authentication/Demo.elm
···33import Base64
445566-{-| Demo user data which is used on first sign-in (encode as base64).
66+{-| Demo user data which is used on first sign-in (encoded as base64).
77-}
88data : String
99data =