Commit 97f8238e authored by Emmanuel Raviart's avatar Emmanuel Raviart

Show an error instead of a rotating cursor when card doesn't exits.

parent 801b1ee1
......@@ -6,9 +6,11 @@ import Configuration
import Dict exposing (Dict)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Attributes.Aria exposing (..)
import Html.Events exposing (..)
import Html.Helpers exposing (aExternal, aForPath, aIfIsUrl)
import Http
import Http.Error
import I18n
import Json.Decode as Decode
import Properties.KeysAutocomplete.View
......@@ -36,8 +38,27 @@ view model =
viewCard model card
Nothing ->
div [ class "text-center" ]
[ viewLoading model.language ]
let
language =
model.language
in
case model.httpError of
Just httpError ->
div
[ class "alert alert-danger"
, role "alert"
]
[ strong []
[ text <|
I18n.translate language I18n.CardLoadingFailed
++ I18n.translate language I18n.Colon
]
, text <| Http.Error.toString language httpError
]
Nothing ->
div [ class "text-center" ]
[ viewLoading language ]
viewCard : Model -> Card -> Html Msg
......
......@@ -58,6 +58,7 @@ type TranslationId
| CardId
| CardIdArray
| CardIdField
| CardLoadingFailed
| CardPlaceholder
| ChangePassword
| ChangePasswordExplanation
......@@ -807,6 +808,14 @@ getTranslationSet translationId =
CardIdField ->
getTranslationSet CardId
CardLoadingFailed ->
{ emptyTranslationSet
| dutch = todo
, english = s "Card retrieval failed"
, french = s "Échec de la récupération de la fiche"
, spanish = todo
}
CardPlaceholder ->
{ emptyTranslationSet
| dutch = s "Kaartnaam"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment