added visible links to feeds

This commit is contained in:
neko 2015-08-18 23:57:50 +02:00
parent ca3e4c2f28
commit 5c6ff28132
4 changed files with 49 additions and 0 deletions

View file

@ -66,6 +66,7 @@ type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
renderLayout :: Widget -> Handler Html
renderLayout widget = do
master <- getYesod
route <- getCurrentRoute
mmsg <- getMessage
msu <- lookupSession "userId"
username <- case msu of

View file

@ -214,6 +214,24 @@ getUserFeedAtomR = getUserFeedR
getUserFeedRssR :: UserId -> Handler RepRss
getUserFeedRssR = getUserFeedR
getNameFeedAtomR :: Text -> Handler RepAtom
getNameFeedAtomR name = do
muser <- runDB $ getBy $ UniqueUser name
case muser of
Just (Entity uId _) ->
getUserFeedR uId
Nothing ->
notFound
getNameFeedRssR :: Text -> Handler RepRss
getNameFeedRssR name = do
muser <- runDB $ getBy $ UniqueUser name
case muser of
Just (Entity uId _) ->
getUserFeedR uId
Nothing ->
notFound
getUserFeedR :: RepFeed a => UserId -> Handler a
getUserFeedR userId = do
user <- runDB $ get404 userId

View file

@ -68,3 +68,5 @@
/feed/medium/#MediumId/rss.xml CommentFeedRssR GET
/feed/user/#UserId/atom.xml UserFeedAtomR GET
/feed/user/#UserId/rss.xml UserFeedRssR GET
!/feed/user/#Text/atom.xml NameFeedAtomR GET
!/feed/user/#Text/rss.xml NameFeedRssR GET

View file

@ -29,3 +29,31 @@ $maybe msg <- mmsg
<div id="footer">
<div class="left">
#{appCopyright $ appSettings master}
<div class="right">
$case route
$of Just HomeR
get a Feed from This:
<a href=@{RootFeedAtomR}>Atom
|
<a href=@{RootFeedRssR}>RSS
$of Just (PageR _)
get a Feed from This:
<a href=@{RootFeedAtomR}>Atom
|
<a href=@{RootFeedRssR}>RSS
$of Just (ProfileR uId)
get a Feed from This:
<a href=@{UserFeedAtomR uId}>Atom
|
<a href=@{UserFeedRssR uId}>RSS
$of Just (UserR name)
get a Feed from This:
<a href=@{NameFeedAtomR name}>Atom
|
<a href=@{NameFeedRssR name}>RSS
$of Just (AlbumR aId)
get a Feed from This:
<a href=@{AlbumFeedAtomR aId}>Atom
|
<a href=@{AlbumFeedRssR aId}>RSS
$of _