summaryrefslogtreecommitdiff
blob: f975eef044494ea63426ef69e6201574a5bda6d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module View.SubMenu.Markers exposing (get_html)

-- Elm -------------------------------------------------------------------------
import Dict

import Html
import Html.Attributes
import Html.Events

-- Map Editor ------------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.Tile
import Struct.TileInstance

import View.Map.Tile

--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_marker_html : (
      (String, Struct.MapMarker.Type)
      -> (Html.Html Struct.Event.Type)
   )
get_marker_html (ref, marker) =
   (Html.div
      [
         (Html.Attributes.class "tile"),
         (Html.Attributes.class "tiled"),
         (Html.Attributes.class "clickable"),
         (Html.Attributes.class "tile-variant-0"),
         (Html.Events.onClick
            (Struct.Event.TemplateRequested ((Struct.Tile.get_id tile), "0"))
         )
      ]
      (View.Map.Tile.get_content_html (Struct.TileInstance.default tile))
   )

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
   (Html.div
      [
         (Html.Attributes.class "tabmenu-content"),
         (Html.Attributes.class "tabmenu-markers-tab")
      ]
      (List.map
         (get_marker_html)
         (Dict.toList (Struct.Map.get_markers model.map))
      )
   )