Show speaker name and instances in EventDetail. Also playing with Html.Lazy
This commit is contained in:
parent
23d94145b7
commit
733c36d00c
|
@ -12,6 +12,7 @@ import Views exposing (view)
|
||||||
|
|
||||||
-- External modules
|
-- External modules
|
||||||
|
|
||||||
|
import Html.Lazy exposing (lazy)
|
||||||
import WebSocket exposing (listen)
|
import WebSocket exposing (listen)
|
||||||
import Navigation exposing (Location)
|
import Navigation exposing (Location)
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ main =
|
||||||
Navigation.programWithFlags
|
Navigation.programWithFlags
|
||||||
OnLocationChange
|
OnLocationChange
|
||||||
{ init = init
|
{ init = init
|
||||||
, view = view
|
, view = lazy view
|
||||||
, update = update
|
, update = update
|
||||||
, subscriptions = subscriptions
|
, subscriptions = subscriptions
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ eventDetailView eventSlug model =
|
||||||
, h4 [] [ text event.title ]
|
, h4 [] [ text event.title ]
|
||||||
, p [] [ Markdown.toHtml [] event.abstract ]
|
, p [] [ Markdown.toHtml [] event.abstract ]
|
||||||
, hr [] []
|
, hr [] []
|
||||||
, h4 [] [ text "TODO: Show all instances here!" ]
|
, eventInstancesList eventSlug model.eventInstances
|
||||||
]
|
]
|
||||||
, div
|
, div
|
||||||
[ classList
|
[ classList
|
||||||
|
@ -40,6 +40,39 @@ eventDetailView eventSlug model =
|
||||||
, ( "schedule-sidebar", True )
|
, ( "schedule-sidebar", True )
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
[ h4 [] [ text "Speakers" ]
|
[ h4 []
|
||||||
|
[ text "Speakers" ]
|
||||||
|
, ul
|
||||||
|
[]
|
||||||
|
(List.map speakerDetail event.speakers)
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
speakerDetail : Speaker -> Html Msg
|
||||||
|
speakerDetail speaker =
|
||||||
|
li []
|
||||||
|
[ text speaker.name
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
eventInstancesList : String -> List EventInstance -> Html Msg
|
||||||
|
eventInstancesList eventSlug eventInstances =
|
||||||
|
let
|
||||||
|
instances =
|
||||||
|
List.filter (\instance -> instance.eventSlug == eventSlug) eventInstances
|
||||||
|
in
|
||||||
|
div []
|
||||||
|
[ h4 []
|
||||||
|
[ text "This event will occur at:" ]
|
||||||
|
, ul
|
||||||
|
[]
|
||||||
|
(List.map eventInstanceItem instances)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
eventInstanceItem : EventInstance -> Html Msg
|
||||||
|
eventInstanceItem eventInstance =
|
||||||
|
li []
|
||||||
|
[ text (eventInstance.from ++ " to " ++ eventInstance.to)
|
||||||
|
]
|
||||||
|
|
|
@ -10,6 +10,7 @@ import Views.FilterView exposing (filterSidebar)
|
||||||
-- External modules
|
-- External modules
|
||||||
|
|
||||||
import Html exposing (Html, text, div, ul, li, span, i, h4, p, small, a)
|
import Html exposing (Html, text, div, ul, li, span, i, h4, p, small, a)
|
||||||
|
import Html.Lazy exposing (lazy, lazy2)
|
||||||
import Html.Attributes exposing (class, classList, href, style)
|
import Html.Attributes exposing (class, classList, href, style)
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ scheduleOverviewView model =
|
||||||
, ( "col-sm-pull-3", True )
|
, ( "col-sm-pull-3", True )
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
(List.map (\day -> dayRowView day model) model.days)
|
(List.map (\day -> lazy2 dayRowView day model) model.days)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ dayRowView day model =
|
||||||
[ h4 []
|
[ h4 []
|
||||||
[ text day.repr ]
|
[ text day.repr ]
|
||||||
, div [ class "schedule-day-row" ]
|
, div [ class "schedule-day-row" ]
|
||||||
(List.map dayEventInstanceView filteredEventInstances)
|
(List.map (lazy dayEventInstanceView) filteredEventInstances)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue