From 6a0a6c523839085c18c02d12c4d97a48c1a8d792 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 21 Jan 2019 11:30:14 +0100 Subject: Can now change portrait before battle. --- src/roster-editor/src/View/Character.elm | 35 +++++++++++++++++++--------- src/roster-editor/src/View/CharacterCard.elm | 4 ++-- 2 files changed, 26 insertions(+), 13 deletions(-) (limited to 'src/roster-editor') diff --git a/src/roster-editor/src/View/Character.elm b/src/roster-editor/src/View/Character.elm index 3f44a80..2ca3636 100644 --- a/src/roster-editor/src/View/Character.elm +++ b/src/roster-editor/src/View/Character.elm @@ -109,18 +109,31 @@ get_battle_index_html char = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_portrait_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) -get_portrait_html char = +get_portrait_html : ( + Struct.Character.Type -> + Bool -> + (Html.Html Struct.Event.Type) + ) +get_portrait_html char click_to_toggle = (Html.div - [ - (Html.Attributes.class "character-portrait"), - (Html.Attributes.class "character-portrait-team-0"), - (Html.Events.onClick - (Struct.Event.ToggleCharacterBattleIndex - (Struct.Character.get_index char) - ) - ) - ] + ( + [ + (Html.Attributes.class "character-portrait"), + (Html.Attributes.class "character-portrait-team-0") + ] + ++ + if (click_to_toggle) + then + [ + (Html.Events.onClick + (Struct.Event.ToggleCharacterBattleIndex + (Struct.Character.get_index char) + ) + ) + ] + else + [] + ) [ (get_portrait_body_html char), (get_portrait_armor_html char), diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm index 4ced7d5..10348ad 100644 --- a/src/roster-editor/src/View/CharacterCard.elm +++ b/src/roster-editor/src/View/CharacterCard.elm @@ -429,7 +429,7 @@ get_minimal_html char = (Html.Attributes.class "info-card-picture") ] [ - (View.Character.get_portrait_html char) + (View.Character.get_portrait_html char True) ] ), (get_health_bar char), @@ -475,7 +475,7 @@ get_full_html char = ) ] [ - (View.Character.get_portrait_html char) + (View.Character.get_portrait_html char False) ] ), (get_health_bar char), -- cgit v1.2.3-70-g09d2