2014-09-14 03:03:13 +00:00
|
|
|
module Handler.Tag where
|
|
|
|
|
|
|
|
import Import
|
2014-09-24 21:03:18 +00:00
|
|
|
import qualified Data.Text as T
|
2014-09-14 03:03:13 +00:00
|
|
|
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
|
2014-09-24 21:03:18 +00:00
|
|
|
setTitle $ toHtml ("Eidolon :: Tag " `T.append` tag)
|
2014-09-14 03:03:13 +00:00
|
|
|
$(widgetFile "tagMedia")
|