{-# LANGUAGE NoImplicitPrelude #-}
module Panda.View.Atom.Album where
  
import Panda.Helper.Env hiding (name, id)
import Panda.Model.Album
import qualified Panda.Config.Global as G
import Panda.Helper.Html

instance DataRenderer Album where
  render_data = show_album


show_album x = case x.album_type of
  Fade -> show_fade x
  Galleria -> show_galleria x
  SlideViewer -> show_slide_viewer x
  Popeye -> show_popeye x

show_popeye x = c "popeye" << ul << x.data_list.map picture_li where 
    picture_li (l, t, i) = li << 
      link l << img ! [src i, alt t]

show_slide_viewer x = ul ! [id "slide-viewer", klass "svw"] << x.data_list.map picture_li where 
  picture_li (l, t, i) = li << 
    img ! [src i, alt t]

show_galleria x = ul ! [klass "gallery"] << x.data_list.map picture_li where 
  picture_li (l, t, i) = li << 
    img ! [src i, alt t]

show_fade x = ul ! [klass "fade-album"] << x.data_list.map picture_li where 
  picture_li (l, t, i) = li << 
    [ toHtml $ link l << img ! [src i, alt t]
    , if x.show_description then p << t else empty_html
    ]