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

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

View file

@ -1,43 +0,0 @@
$# This file is part of Vervis.
$#
$# Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
$#
$# The author(s) have dedicated all copyright and related and neighboring
$# rights to this software to the public domain worldwide. This software is
$# distributed without any warranty.
$#
$# You should have received a copy of the CC0 Public Domain Dedication along
$# with this software. If not, see
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
<h1>Vervis > People > #{user} > Repos > #{repo}
<h2>About
<p>
This is the repo page for <b>#{repo}</b>, shared by user <b>#{user}</b>.
<h2>Details
<table>
<tr>
<td>Description
<td>
$maybe desc <- repoDesc repository
#{desc}
$nothing
(none)
<h2>Commits
<p>
See <a href=@{RepoCommitsR user repo}>commits</a>.
<h2>Files
<table>
<tr>
<th>Type
<th>Name
$forall (type', name) <- rows
<tr>
<td>#{type'}
<td>#{name}

View file

@ -14,6 +14,12 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<h1>Vervis > People > #{user} > Repos > #{repo}
$maybe desc <- repoDesc repository
<p>#{desc}
<p>
<a href=@{RepoCommitsR user repo}>Commits
<h2>Branches
<ul>
$forall RefName branch <- branches