From ce89bded73c1ebe3509f7c2c50b3d2e4b9a8a87e Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Thu, 17 May 2018 15:46:57 +0000 Subject: [PATCH] Add a commit view route, nothing displayed yet --- config/routes | 1 + src/Vervis/Handler/Repo.hs | 8 ++++++++ src/Vervis/Handler/Repo/Darcs.hs | 2 +- src/Vervis/Handler/Repo/Git.hs | 2 +- src/Vervis/Widget/Repo.hs | 4 ++-- templates/repo/widget/changes.hamlet | 4 +++- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/config/routes b/config/routes index 91f0a74..8991d9b 100644 --- a/config/routes +++ b/config/routes @@ -77,6 +77,7 @@ /s/#ShrIdent/r/#RpIdent/s/+Texts RepoSourceR GET /s/#ShrIdent/r/#RpIdent/c RepoHeadChangesR GET /s/#ShrIdent/r/#RpIdent/c/#Text RepoChangesR GET +/s/#ShrIdent/r/#RpIdent/p/#Text RepoPatchR GET /s/#ShrIdent/r/#RpIdent/d RepoDevsR GET POST /s/#ShrIdent/r/#RpIdent/d/!new RepoDevNewR GET /s/#ShrIdent/r/#RpIdent/d/#ShrIdent RepoDevR GET DELETE POST diff --git a/src/Vervis/Handler/Repo.hs b/src/Vervis/Handler/Repo.hs index 0967cea..6999593 100644 --- a/src/Vervis/Handler/Repo.hs +++ b/src/Vervis/Handler/Repo.hs @@ -25,6 +25,7 @@ module Vervis.Handler.Repo , getRepoSourceR , getRepoHeadChangesR , getRepoChangesR + , getRepoPatchR , getRepoDevsR , postRepoDevsR , getRepoDevNewR @@ -258,6 +259,13 @@ getRepoChangesR shar repo ref = do VCSDarcs -> getDarcsRepoChanges shar repo ref VCSGit -> getGitRepoChanges shar repo ref +getRepoPatchR :: ShrIdent -> RpIdent -> Text -> Handler Html +getRepoPatchR shr rp ref = do + repository <- runDB $ selectRepo shr rp + case repoVcs repository of + VCSDarcs -> undefined -- getDarcsPatch shr rp ref + VCSGit -> undefined -- getGitRepoPatch shr rp ref + getRepoDevsR :: ShrIdent -> RpIdent -> Handler Html getRepoDevsR shr rp = do devs <- runDB $ do diff --git a/src/Vervis/Handler/Repo/Darcs.hs b/src/Vervis/Handler/Repo/Darcs.hs index ce55b42..a45f80f 100644 --- a/src/Vervis/Handler/Repo/Darcs.hs +++ b/src/Vervis/Handler/Repo/Darcs.hs @@ -86,7 +86,7 @@ getDarcsRepoHeadChanges shar repo = do case mv of Nothing -> notFound Just v -> return v - let changes = changesW entries + let changes = changesW shar repo entries pageNav = navWidget navModel feed = changeFeed shar repo Nothing VCSDarcs entries selectRep $ do diff --git a/src/Vervis/Handler/Repo/Git.hs b/src/Vervis/Handler/Repo/Git.hs index 57b1086..bb7be6d 100644 --- a/src/Vervis/Handler/Repo/Git.hs +++ b/src/Vervis/Handler/Repo/Git.hs @@ -100,7 +100,7 @@ getGitRepoChanges shar repo ref = do (entries, navModel) <- getPageAndNav $ \ o l -> liftIO $ G.readChangesView path ref o l let refSelect = refSelectW shar repo branches tags - changes = changesW entries + changes = changesW shar repo entries pageNav = navWidget navModel feed = changeFeed shar repo (Just ref) VCSGit entries selectRep $ do diff --git a/src/Vervis/Widget/Repo.hs b/src/Vervis/Widget/Repo.hs index 707ee93..81868d9 100644 --- a/src/Vervis/Widget/Repo.hs +++ b/src/Vervis/Widget/Repo.hs @@ -34,5 +34,5 @@ import Vervis.Settings (widgetFile) refSelectW :: ShrIdent -> RpIdent -> Set Text -> Set Text -> Widget refSelectW shar repo branches tags = $(widgetFile "repo/widget/ref-select") -changesW :: Foldable f => f LogEntry -> Widget -changesW entries = $(widgetFile "repo/widget/changes") +changesW :: Foldable f => ShrIdent -> RpIdent -> f LogEntry -> Widget +changesW shr rp entries = $(widgetFile "repo/widget/changes") diff --git a/templates/repo/widget/changes.hamlet b/templates/repo/widget/changes.hamlet index 64327e7..9fd68c0 100644 --- a/templates/repo/widget/changes.hamlet +++ b/templates/repo/widget/changes.hamlet @@ -21,6 +21,8 @@ $# . $forall LogEntry author hash message (_, time) <- entries #{author} - #{T.take 10 hash} + + + #{T.take 10 hash} #{message} #{time}