From cac1a06891a47c78dacd4c1002e1893fec5be270 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Wed, 5 Sep 2018 17:33:12 +0200 Subject: Adds map listing. --- src/main-menu/src/ElmModule/View.elm | 4 +- src/main-menu/src/View/MapListing.elm | 74 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/main-menu/src/View/MapListing.elm (limited to 'src/main-menu') diff --git a/src/main-menu/src/ElmModule/View.elm b/src/main-menu/src/ElmModule/View.elm index b37116c..7adf573 100644 --- a/src/main-menu/src/ElmModule/View.elm +++ b/src/main-menu/src/ElmModule/View.elm @@ -15,6 +15,7 @@ import Struct.UI import Util.Html import View.BattleListing +import View.MapListing import View.Header -------------------------------------------------------------------------------- @@ -50,7 +51,8 @@ view model = "Events" "main-menu-events" (Struct.Player.get_events model.player) - ) + ), + (View.MapListing.get_html (Struct.Player.get_maps model.player)) ] ) ] diff --git a/src/main-menu/src/View/MapListing.elm b/src/main-menu/src/View/MapListing.elm new file mode 100644 index 0000000..79c39b4 --- /dev/null +++ b/src/main-menu/src/View/MapListing.elm @@ -0,0 +1,74 @@ +module View.MapListing exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes +-- import Html.Events + +-- Map ------------------------------------------------------------------- +import Struct.MapSummary +import Struct.Event + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_item_html : Struct.MapSummary.Type -> (Html.Html Struct.Event.Type) +get_item_html item = + (Html.a + [ + (Html.Attributes.href + ( + "/map-editor/?id=" + ++ (Struct.MapSummary.get_id item) + ) + ) + ] + [ + (Html.div + [ + (Html.Attributes.class "main-menu-map-summary-name") + ] + [ + (Html.text (Struct.MapSummary.get_name item)) + ] + ) + ] + ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : ( + (List Struct.MapSummary.Type) -> + (Html.Html Struct.Event.Type) + ) +get_html map_summaries = + (Html.div + [ + (Html.Attributes.class "main-menu-map-listing") + ] + [ + (Html.div + [ + (Html.Attributes.class "main-menu-map-listing-header") + ] + [ + (Html.text "Territories") + ] + ), + (Html.div + [ + (Html.Attributes.class "main-menu-map-listing-body") + ] + (List.map (get_item_html) map_summaries) + ), + (Html.div + [ + (Html.Attributes.class "main-menu-map-listing-add-new") + ] + [ + (Html.text "New") + ] + ) + ] + ) -- cgit v1.2.3-70-g09d2