2014-09-14 03:03:13 +00:00
|
|
|
module Handler.Tag where
|
|
|
|
|
|
|
|
import Import
|
|
|
|
import Data.Maybe
|
|
|
|
|
|
|
|
getTagR :: Text -> Handler Html
|
|
|
|
getTagR tag = do
|
2014-09-21 16:42:07 +00:00
|
|
|
tempMedia <- runDB $ selectList [] [Asc MediumTitle]
|
2014-09-14 03:03:13 +00:00
|
|
|
almostMedia <- mapM (\a -> do
|
|
|
|
case tag `elem` (mediumTags $ entityVal a) of
|
|
|
|
True -> return (Just a)
|
|
|
|
False -> return Nothing
|
|
|
|
) tempMedia
|
|
|
|
media <- return $ removeItem Nothing almostMedia
|
|
|
|
defaultLayout $ do
|
|
|
|
$(widgetFile "tagMedia")
|