2017-05-02 02:27:01 -04:00
|
|
|
|
module View.Error
|
|
|
|
|
exposing
|
|
|
|
|
( errorView
|
|
|
|
|
, errorsListView
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
import Html exposing (..)
|
|
|
|
|
import Html.Attributes exposing (..)
|
2017-05-05 17:36:16 -04:00
|
|
|
|
import Html.Events exposing (..)
|
2017-05-02 02:27:01 -04:00
|
|
|
|
import Types exposing (..)
|
|
|
|
|
|
|
|
|
|
|
2017-05-05 17:36:16 -04:00
|
|
|
|
errorView : Int -> String -> Html Msg
|
|
|
|
|
errorView index error =
|
|
|
|
|
div [ class "alert alert-danger" ]
|
|
|
|
|
[ button
|
|
|
|
|
[ type_ "button"
|
|
|
|
|
, class "close"
|
|
|
|
|
, onClick <| ClearError index
|
|
|
|
|
]
|
|
|
|
|
[ text "×" ]
|
|
|
|
|
, text error
|
|
|
|
|
]
|
2017-05-02 02:27:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorsListView : Model -> Html Msg
|
|
|
|
|
errorsListView model =
|
|
|
|
|
case model.errors of
|
|
|
|
|
[] ->
|
|
|
|
|
text ""
|
|
|
|
|
|
|
|
|
|
errors ->
|
2017-05-05 17:36:16 -04:00
|
|
|
|
div [ class "error-list" ] <| List.indexedMap errorView model.errors
|