| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src/main-menu')
| -rw-r--r-- | src/main-menu/src/Struct/InvasionRequest.elm | 64 | ||||
| -rw-r--r-- | src/main-menu/src/View/CurrentTab.elm | 2 | ||||
| -rw-r--r-- | src/main-menu/src/View/Tab/NewInvasion.elm | 38 | 
3 files changed, 57 insertions, 47 deletions
| diff --git a/src/main-menu/src/Struct/InvasionRequest.elm b/src/main-menu/src/Struct/InvasionRequest.elm index 6a474a5..f1e25b2 100644 --- a/src/main-menu/src/Struct/InvasionRequest.elm +++ b/src/main-menu/src/Struct/InvasionRequest.elm @@ -71,44 +71,30 @@ get_map_id ir = ir.map_id  set_map_id : String -> Type -> Type  set_map_id id ir = {ir | map_id = id} -get_url_params : Type -> (Maybe String) +get_url_params : Type -> String  get_url_params ir = -   case (ir.category, ir.size) of -      (Struct.BattleSummary.InvasionEither, _) -> Nothing -      (_, Nothing) -> Nothing -      (Struct.BattleSummary.InvasionAttack, (Just size)) -> -         (Just -            ( -               "?m=a&ix=" -               ++ (toString ir.ix) -               ++ "&s=" -               ++ -               ( -                  case size of -                     Small -> "s" -                     Medium -> "m" -                     Large -> "l" -               ) -            ) -         ) - -      (Struct.BattleSummary.InvasionDefend, (Just size)) -> +   ( +      "?ix=" +      ++ (toString ir.ix) +      ++ +      ( +         case ir.category of +            Struct.BattleSummary.InvasionEither -> "" +            Struct.BattleSummary.InvasionAttack -> "&m=a" +            Struct.BattleSummary.InvasionDefend -> "&m=d" +      ) +      ++ +      ( +         case ir.size of +            Nothing -> "" +            (Just Small) -> "&s=s" +            (Just Medium) -> "&s=m" +            (Just Large) -> "&s=l" +      ) +      ++ +      (           if (ir.map_id == "") -         then Nothing -         else -            (Just -               ( -                  "?m=a&ix=" -                  ++ (toString ir.ix) -                  ++ "&map_id=" -                  ++ ir.map_id -                  ++ "&s=" -                  ++ -                  ( -                     case size of -                        Small -> "s" -                        Medium -> "m" -                        Large -> "l" -                  ) -               ) -            ) +         then "" +         else ("&map_id=" ++ ir.map_id) +      ) +   ) diff --git a/src/main-menu/src/View/CurrentTab.elm b/src/main-menu/src/View/CurrentTab.elm index a6c367d..e558b15 100644 --- a/src/main-menu/src/View/CurrentTab.elm +++ b/src/main-menu/src/View/CurrentTab.elm @@ -2,7 +2,7 @@ module View.CurrentTab exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Html -import Html.Attributes +--import Html.Attributes  -- Main Menu -------------------------------------------------------------------  import Struct.Event diff --git a/src/main-menu/src/View/Tab/NewInvasion.elm b/src/main-menu/src/View/Tab/NewInvasion.elm index f0195e1..b216b4c 100644 --- a/src/main-menu/src/View/Tab/NewInvasion.elm +++ b/src/main-menu/src/View/Tab/NewInvasion.elm @@ -2,7 +2,7 @@ module View.Tab.NewInvasion exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Html --- import Html.Attributes +import Html.Attributes  import Html.Events  -- Main Menu ------------------------------------------------------------------- @@ -114,9 +114,20 @@ get_actual_html inv_req =                 -- TODO: use roster size as upper limit.                 Nothing -> (select_size_html Struct.InvasionRequest.Large)                 _ -> -                  -- TODO: Should not happen, let the user go ahead by providing -                  -- a link. -                  (Html.text "Error.") +                  (Html.a +                     [ +                        (Html.Attributes.href +                           ( +                              "/roster-editor/" +                              ++ +                              (Struct.InvasionRequest.get_url_params inv_req) +                           ) +                        ) +                     ] +                     [ +                        (Html.text "Select Characters") +                     ] +                  )           )        Struct.BattleSummary.InvasionDefend ->           ( @@ -129,9 +140,22 @@ get_actual_html inv_req =                          -- TODO: use min(RosterSize, MapSize) as upper limit.                          (select_size_html Struct.InvasionRequest.Large)                       _ -> -                        -- TODO: Should not happen, let the user go ahead by -                        -- providing a link. -                        (Html.text "Error.") +                        (Html.a +                           [ +                              (Html.Attributes.href +                                 ( +                                    "/roster-editor/" +                                    ++ +                                    (Struct.InvasionRequest.get_url_params +                                       inv_req +                                    ) +                                 ) +                              ) +                           ] +                           [ +                              (Html.text "Select Characters") +                           ] +                        )           )  -------------------------------------------------------------------------------- | 


