1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2025-03-20 04:46:22 +09:00

Repo page is root repo source page, remove duplication

This commit is contained in:
fr33domlover 2016-04-12 23:38:21 +00:00
parent d37108fa6f
commit 2323ec3fc0
3 changed files with 17 additions and 61 deletions
src/Vervis/Handler

View file

@ -127,25 +127,10 @@ getRepoR user repo = do
Entity sid _s <- getBy404 $ UniqueSharerIdent user
Entity _rid r <- getBy404 $ UniqueRepo repo sid
return r
path <- askRepoDir user repo
view <- liftIO $ withRepo (fromString path) $ \ git -> do
oid <- resolveName git $ unpack $ repoMainBranch repository
commit <- getCommit git $ unObjId oid
tree <- getTree git $ commitTreeish commit
viewTree git tree
let toText = decodeUtf8With lenientDecode
mkrow (_perm, name, isTree) =
( if isTree then "[D]" else "[F]" :: Text
, toText $ toBytes name
)
rows = map mkrow view
defaultLayout $ do
setTitle $ toHtml $ intercalate " > "
["Vervis", "People", user, "Repos", repo]
$(widgetFile "repo/repo")
getRepoSource repository user repo (repoMainBranch repository) []
getRepoSourceR :: Text -> Text -> Text -> [Text] -> Handler Html
getRepoSourceR user repo ref dir = do
getRepoSource :: Repo -> Text -> Text -> Text -> [Text] -> Handler Html
getRepoSource repository user repo ref dir = do
path <- askRepoDir user repo
let toText = decodeUtf8With lenientDecode
toTextL = L.decodeUtf8With lenientDecode
@ -216,6 +201,14 @@ getRepoSourceR user repo ref dir = do
["Vervis", "People", user, "Repos", repo]
$(widgetFile "repo/source")
getRepoSourceR :: Text -> Text -> Text -> [Text] -> Handler Html
getRepoSourceR user repo ref dir = do
repository <- runDB $ do
Entity sid _s <- getBy404 $ UniqueSharerIdent user
Entity _rid r <- getBy404 $ UniqueRepo repo sid
return r
getRepoSource repository user repo ref dir
getRepoCommitsR :: Text -> Text -> Handler Html
getRepoCommitsR user repo = do
repository <- runDB $ do