Commit d2dae68c authored by Emmanuel Raviart's avatar Emmanuel Raviart

Improve rendering of arguments in cards.

parent a021466c
......@@ -22,6 +22,13 @@ import Values.ViewsHelpers exposing (viewValueIdLine, viewValueTypeLine)
import Views exposing (viewCardListItem, viewLoading)
keyIdLabelCouples : List ( String, I18n.TranslationId )
keyIdLabelCouples =
[ ( "pros", I18n.DebateArgumentFor )
, ( "cons", I18n.DebateArgumentAgainst )
]
view : Model -> Html Msg
view model =
case Dict.get model.cardId model.data.cards of
......@@ -331,28 +338,33 @@ viewCardContent model card =
]
]
, div [ class "panel-body" ]
[ ul []
[ ul [ class "list-unstyled" ]
(List.map
(\argument ->
let
keyLabel =
Dict.get
argument.keyId
(Dict.fromList Properties.New.View.keyIdLabelCouples)
|> Maybe.map (I18n.translate language)
|> Maybe.withDefault argument.keyId
in
li []
[ text keyLabel
, text " "
, text (toString argument.ratingSum)
li []
[ div []
[ span
[ attribute "aria-hidden" "true"
, class
("glyphicon "
++ if argument.keyId == "cons" then
"glyphicon-minus"
else if argument.keyId == "pros" then
"glyphicon-plus"
else
"glyphicon-triangle-right"
)
]
[]
, text " "
, viewValueIdLine
language
(Just navigate)
data
False
argument.valueId
, div [ style [ ( "display", "inline-block" ) ] ]
[ viewValueIdLine
language
(Just navigate)
data
False
argument.valueId
]
, text " "
, button
[ attribute "data-target" "#debate-content"
......@@ -368,6 +380,7 @@ viewCardContent model card =
]
[ text (I18n.translate language (I18n.Debate)) ]
]
]
)
card.arguments
)
......@@ -705,12 +718,6 @@ viewDebateModal model card debatedIds =
viewProperty index property =
let
keyIdLabelCouples : List ( String, I18n.TranslationId )
keyIdLabelCouples =
[ ( "pros", I18n.DebateArgumentFor )
, ( "cons", I18n.DebateArgumentAgainst )
]
keyLabel =
Dict.get property.keyId (Dict.fromList keyIdLabelCouples)
|> Maybe.map (I18n.translate language)
......@@ -754,8 +761,8 @@ viewDebateModal model card debatedIds =
)
, style
[ ( "margin-top", "4px" )
, ( "border", "2px solid #25b5ff" )
, ( "color", "#25b5ff" )
, ( "border", "2px solid #a7a7a7" )
, ( "color", "grey" )
, ( "background", "none" )
, ( "text-shadow", "none" )
]
......
......@@ -97,19 +97,22 @@ viewValueTypeLineContent language navigate data showDetails valueType =
]
LocalizedStringValue values ->
let
viewString languageCode string =
if showDetails || Dict.size values > 1 then
[ dt [] [ text languageCode ]
, dd [] [ aIfIsUrl [] string ]
]
else
[ aIfIsUrl [] string ]
in
if showDetails || Dict.size values > 1 then
dl []
(values
|> Dict.toList
|> List.concatMap (\( languageCode, childValue ) -> viewString languageCode childValue)
|> List.concatMap
(\( languageCode, childValue ) ->
[ dt [] [ text languageCode ]
, dd [] [ aIfIsUrl [] childValue ]
]
)
)
else
div []
(values
|> Dict.toList
|> List.map (\( languageCode, childValue ) -> aIfIsUrl [] childValue)
)
NumberValue float ->
......
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