summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-12-05 18:38:17 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-12-05 18:38:17 +0100
commit2e12b4991208af99f590ded22a0c47989daa9312 (patch)
treeda7d3d1219fc73280710df75765cf1cb349475f8
parent837dbf4ac00e76076e557ab6b04cc41f3d827dad (diff)
...
-rw-r--r--src/main-menu/src/Struct/InvasionRequest.elm64
-rw-r--r--src/main-menu/src/View/CurrentTab.elm2
-rw-r--r--src/main-menu/src/View/Tab/NewInvasion.elm38
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")
+ ]
+ )
)
--------------------------------------------------------------------------------