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-07 04:01:11 -04:00
|
|
|
|
errorView : Int -> ErrorNotification -> Html Msg
|
2017-05-05 17:36:16 -04:00
|
|
|
|
errorView index error =
|
|
|
|
|
div [ class "alert alert-danger" ]
|
|
|
|
|
[ button
|
|
|
|
|
[ type_ "button"
|
|
|
|
|
, class "close"
|
|
|
|
|
, onClick <| ClearError index
|
|
|
|
|
]
|
|
|
|
|
[ text "×" ]
|
2017-05-07 04:01:11 -04:00
|
|
|
|
, text error.message
|
2017-05-05 17:36:16 -04:00
|
|
|
|
]
|
2017-05-02 02:27:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errorsListView : Model -> Html Msg
|
|
|
|
|
errorsListView model =
|
|
|
|
|
case model.errors of
|
|
|
|
|
[] ->
|
|
|
|
|
text ""
|
|
|
|
|
|
|
|
|
|
errors ->
|
2017-05-07 04:01:11 -04:00
|
|
|
|
div [ class "error-list" ] <|
|
|
|
|
|
List.indexedMap errorView model.errors
|