repopulate thumbnails function
This commit is contained in:
parent
2c17ed6797
commit
cbd441860e
4 changed files with 25 additions and 0 deletions
|
@ -167,6 +167,7 @@ instance Yesod App where
|
||||||
authRoute _ = Just $ AuthR LoginR
|
authRoute _ = Just $ AuthR LoginR
|
||||||
|
|
||||||
isAuthorized AdminR _ = getAdminAuth
|
isAuthorized AdminR _ = getAdminAuth
|
||||||
|
isAuthorized AdminRepopThumbsR _ = getAdminAuth
|
||||||
isAuthorized AdminProfilesR _ = getAdminAuth
|
isAuthorized AdminProfilesR _ = getAdminAuth
|
||||||
isAuthorized (AdminProfileSettingsR _) _ = getAdminAuth
|
isAuthorized (AdminProfileSettingsR _) _ = getAdminAuth
|
||||||
isAuthorized (AdminUserAlbumsR _) _ = getAdminAuth
|
isAuthorized (AdminUserAlbumsR _) _ = getAdminAuth
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
module Handler.Admin where
|
module Handler.Admin where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
|
import Data.List (tail)
|
||||||
import Handler.Commons
|
import Handler.Commons
|
||||||
-- import Database.Bloodhound
|
-- import Database.Bloodhound
|
||||||
|
|
||||||
|
@ -31,3 +32,21 @@ getAdminR = do
|
||||||
Left (errorMsg, route) -> do
|
Left (errorMsg, route) -> do
|
||||||
setMessage errorMsg
|
setMessage errorMsg
|
||||||
redirect route
|
redirect route
|
||||||
|
|
||||||
|
getAdminRepopThumbsR :: Handler Html
|
||||||
|
getAdminRepopThumbsR = do
|
||||||
|
adminCheck <- loginIsAdmin
|
||||||
|
case adminCheck of
|
||||||
|
Right _ -> do
|
||||||
|
media <- runDB $ selectList [] [Asc MediumId]
|
||||||
|
mapM_ (\(Entity _ m) -> generateThumbs
|
||||||
|
(tail $ mediumPath m)
|
||||||
|
(mediumOwner m)
|
||||||
|
(mediumAlbum m)
|
||||||
|
(mediumMime m)
|
||||||
|
) media
|
||||||
|
setMessage "Repopulation successfull"
|
||||||
|
redirect AdminR
|
||||||
|
Left (emsg, route) -> do
|
||||||
|
setMessage emsg
|
||||||
|
redirect route
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
/profile/#UserId/delete ProfileDeleteR GET POST
|
/profile/#UserId/delete ProfileDeleteR GET POST
|
||||||
|
|
||||||
/admin AdminR GET
|
/admin AdminR GET
|
||||||
|
/admin/repop AdminRepopThumbsR GET
|
||||||
/admin/profile AdminProfilesR GET
|
/admin/profile AdminProfilesR GET
|
||||||
/admin/profile/#UserId AdminProfileSettingsR GET POST
|
/admin/profile/#UserId AdminProfileSettingsR GET POST
|
||||||
/admin/profile/#UserId/albums AdminUserAlbumsR GET
|
/admin/profile/#UserId/albums AdminUserAlbumsR GET
|
||||||
|
|
|
@ -21,6 +21,10 @@ $newline always
|
||||||
<p>
|
<p>
|
||||||
<a href=@{AdminCommentR}>Comments
|
<a href=@{AdminCommentR}>Comments
|
||||||
|
|
||||||
|
<div .item>
|
||||||
|
<p>
|
||||||
|
<a href=@{AdminRepopThumbsR}>Repopulate Thumbnails
|
||||||
|
|
||||||
<!--<div .item>
|
<!--<div .item>
|
||||||
<p>
|
<p>
|
||||||
<a href=@{AdminSearchReloadR}>Repopulate search index-->
|
<a href=@{AdminSearchReloadR}>Repopulate search index-->
|
||||||
|
|
Loading…
Reference in a new issue