Show speaker name and instances in EventDetail. Also playing with Html.Lazy

This commit is contained in:
Vidir Valberg Gudmundsson 2017-07-17 17:59:38 +02:00
parent 23d94145b7
commit 733c36d00c
3 changed files with 40 additions and 5 deletions

View file

@ -12,6 +12,7 @@ import Views exposing (view)
-- External modules
import Html.Lazy exposing (lazy)
import WebSocket exposing (listen)
import Navigation exposing (Location)
@ -21,7 +22,7 @@ main =
Navigation.programWithFlags
OnLocationChange
{ init = init
, view = view
, view = lazy view
, update = update
, subscriptions = subscriptions
}

View file

@ -32,7 +32,7 @@ eventDetailView eventSlug model =
, h4 [] [ text event.title ]
, p [] [ Markdown.toHtml [] event.abstract ]
, hr [] []
, h4 [] [ text "TODO: Show all instances here!" ]
, eventInstancesList eventSlug model.eventInstances
]
, div
[ classList
@ -40,6 +40,39 @@ eventDetailView eventSlug model =
, ( "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)
]

View file

@ -10,6 +10,7 @@ import Views.FilterView exposing (filterSidebar)
-- External modules
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)
@ -23,7 +24,7 @@ scheduleOverviewView model =
, ( "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 []
[ text day.repr ]
, div [ class "schedule-day-row" ]
(List.map dayEventInstanceView filteredEventInstances)
(List.map (lazy dayEventInstanceView) filteredEventInstances)
]