UI: Repo, Loom: Update collaborators view & buttons, similar to Deck
This commit is contained in:
parent
5c6e73a3d4
commit
97dee05af8
6 changed files with 121 additions and 28 deletions
|
@ -928,8 +928,6 @@ instance YesodBreadcrumbs App where
|
||||||
RepoNewR -> ("New Repo", Just HomeR)
|
RepoNewR -> ("New Repo", Just HomeR)
|
||||||
RepoDeleteR r -> ("", Nothing)
|
RepoDeleteR r -> ("", Nothing)
|
||||||
RepoEditR r -> ("Edit", Just $ RepoR r)
|
RepoEditR r -> ("Edit", Just $ RepoR r)
|
||||||
RepoFollowR r -> ("", Nothing)
|
|
||||||
RepoUnfollowR r -> ("", Nothing)
|
|
||||||
|
|
||||||
PostReceiveR -> ("", Nothing)
|
PostReceiveR -> ("", Nothing)
|
||||||
|
|
||||||
|
@ -938,6 +936,8 @@ instance YesodBreadcrumbs App where
|
||||||
RepoStampR r k -> ("Stamp #" <> keyHashidText k, Just $ RepoR r)
|
RepoStampR r k -> ("Stamp #" <> keyHashidText k, Just $ RepoR r)
|
||||||
|
|
||||||
RepoCollabsR r -> ("Collaborators", Just $ RepoR r)
|
RepoCollabsR r -> ("Collaborators", Just $ RepoR r)
|
||||||
|
RepoInviteR _ -> ("", Nothing)
|
||||||
|
RepoRemoveR _ _ -> ("", Nothing)
|
||||||
RepoProjectsR r -> ("Projects", Just $ RepoR r)
|
RepoProjectsR r -> ("Projects", Just $ RepoR r)
|
||||||
|
|
||||||
RepoTeamsR r -> ("Teams", Just $ RepoR r)
|
RepoTeamsR r -> ("Teams", Just $ RepoR r)
|
||||||
|
@ -965,7 +965,7 @@ instance YesodBreadcrumbs App where
|
||||||
|
|
||||||
DeckCollabsR d -> ("Collaborators", Just $ DeckR d)
|
DeckCollabsR d -> ("Collaborators", Just $ DeckR d)
|
||||||
|
|
||||||
DeckInviteR d -> ("Invite", Just $ DeckR d)
|
DeckInviteR _ -> ("", Nothing)
|
||||||
DeckRemoveR _ _ -> ("", Nothing)
|
DeckRemoveR _ _ -> ("", Nothing)
|
||||||
|
|
||||||
DeckProjectsR d -> ("Projects", Just $ DeckR d)
|
DeckProjectsR d -> ("Projects", Just $ DeckR d)
|
||||||
|
@ -1006,12 +1006,12 @@ instance YesodBreadcrumbs App where
|
||||||
LoomMessageR l m -> ("Message #" <> keyHashidText m, Just $ LoomR l)
|
LoomMessageR l m -> ("Message #" <> keyHashidText m, Just $ LoomR l)
|
||||||
|
|
||||||
LoomNewR -> ("New Patch Tracker", Just HomeR)
|
LoomNewR -> ("New Patch Tracker", Just HomeR)
|
||||||
LoomFollowR _ -> ("", Nothing)
|
|
||||||
LoomUnfollowR _ -> ("", Nothing)
|
|
||||||
|
|
||||||
LoomStampR l k -> ("Stamp #" <> keyHashidText k, Just $ LoomR l)
|
LoomStampR l k -> ("Stamp #" <> keyHashidText k, Just $ LoomR l)
|
||||||
|
|
||||||
LoomCollabsR l -> ("Collaborators", Just $ LoomR l)
|
LoomCollabsR l -> ("Collaborators", Just $ LoomR l)
|
||||||
|
LoomInviteR _ -> ("", Nothing)
|
||||||
|
LoomRemoveR _ _ -> ("", Nothing)
|
||||||
LoomProjectsR l -> ("Projects", Just $ LoomR l)
|
LoomProjectsR l -> ("Projects", Just $ LoomR l)
|
||||||
|
|
||||||
LoomTeamsR l -> ("Teams", Just $ LoomR l)
|
LoomTeamsR l -> ("Teams", Just $ LoomR l)
|
||||||
|
|
|
@ -27,12 +27,12 @@ module Vervis.Handler.Loom
|
||||||
|
|
||||||
, getLoomNewR
|
, getLoomNewR
|
||||||
, postLoomNewR
|
, postLoomNewR
|
||||||
, postLoomFollowR
|
|
||||||
, postLoomUnfollowR
|
|
||||||
|
|
||||||
, getLoomStampR
|
, getLoomStampR
|
||||||
|
|
||||||
, getLoomCollabsR
|
, getLoomCollabsR
|
||||||
|
, postLoomInviteR
|
||||||
|
, postLoomRemoveR
|
||||||
, getLoomProjectsR
|
, getLoomProjectsR
|
||||||
|
|
||||||
, getLoomTeamsR
|
, getLoomTeamsR
|
||||||
|
@ -366,17 +366,36 @@ postLoomNewR = do
|
||||||
setMessage "New patch tracker created"
|
setMessage "New patch tracker created"
|
||||||
redirect $ LoomR loomHash
|
redirect $ LoomR loomHash
|
||||||
|
|
||||||
postLoomFollowR :: KeyHashid Loom -> Handler ()
|
|
||||||
postLoomFollowR _ = error "Temporarily disabled"
|
|
||||||
|
|
||||||
postLoomUnfollowR :: KeyHashid Loom -> Handler ()
|
|
||||||
postLoomUnfollowR _ = error "Temporarily disabled"
|
|
||||||
|
|
||||||
getLoomStampR :: KeyHashid Loom -> KeyHashid SigKey -> Handler TypedContent
|
getLoomStampR :: KeyHashid Loom -> KeyHashid SigKey -> Handler TypedContent
|
||||||
getLoomStampR = servePerActorKey loomActor LocalActorLoom
|
getLoomStampR = servePerActorKey loomActor LocalActorLoom
|
||||||
|
|
||||||
getLoomCollabsR :: KeyHashid Loom -> Handler TypedContent
|
getLoomCollabsR :: KeyHashid Loom -> Handler TypedContent
|
||||||
getLoomCollabsR loomHash = error "TODO"
|
getLoomCollabsR loomHash = do
|
||||||
|
loomID <- decodeKeyHashid404 loomHash
|
||||||
|
(loom, actor) <- runDB $ do
|
||||||
|
loom <- get404 loomID
|
||||||
|
actor <- getJust $ loomActor loom
|
||||||
|
return (loom, actor)
|
||||||
|
serveCollabs
|
||||||
|
AP.RelHasCollab
|
||||||
|
(loomResource loom)
|
||||||
|
(LoomR loomHash)
|
||||||
|
(LoomCollabsR loomHash)
|
||||||
|
(LoomRemoveR loomHash)
|
||||||
|
(LoomInviteR loomHash)
|
||||||
|
(loomNavW (Entity loomID loom) actor)
|
||||||
|
|
||||||
|
postLoomInviteR :: KeyHashid Loom -> Handler Html
|
||||||
|
postLoomInviteR loomHash = do
|
||||||
|
loomID <- decodeKeyHashid404 loomHash
|
||||||
|
resourceID <- runDB $ loomResource <$> get404 loomID
|
||||||
|
serveInviteCollab resourceID (LoomCollabsR loomHash)
|
||||||
|
|
||||||
|
postLoomRemoveR :: KeyHashid Loom -> CollabId -> Handler Html
|
||||||
|
postLoomRemoveR loomHash collabID = do
|
||||||
|
loomID <- decodeKeyHashid404 loomHash
|
||||||
|
resourceID <- runDB $ loomResource <$> get404 loomID
|
||||||
|
serveRemoveCollab resourceID (LoomCollabsR loomHash) collabID
|
||||||
|
|
||||||
getLoomProjectsR :: KeyHashid Loom -> Handler Html
|
getLoomProjectsR :: KeyHashid Loom -> Handler Html
|
||||||
getLoomProjectsR loomHash = do
|
getLoomProjectsR loomHash = do
|
||||||
|
|
|
@ -40,8 +40,6 @@ module Vervis.Handler.Repo
|
||||||
, postRepoDeleteR
|
, postRepoDeleteR
|
||||||
, getRepoEditR
|
, getRepoEditR
|
||||||
, postRepoEditR
|
, postRepoEditR
|
||||||
, postRepoFollowR
|
|
||||||
, postRepoUnfollowR
|
|
||||||
|
|
||||||
, postPostReceiveR
|
, postPostReceiveR
|
||||||
|
|
||||||
|
@ -50,6 +48,8 @@ module Vervis.Handler.Repo
|
||||||
, getRepoStampR
|
, getRepoStampR
|
||||||
|
|
||||||
, getRepoCollabsR
|
, getRepoCollabsR
|
||||||
|
, postRepoInviteR
|
||||||
|
, postRepoRemoveR
|
||||||
, getRepoProjectsR
|
, getRepoProjectsR
|
||||||
|
|
||||||
, getRepoTeamsR
|
, getRepoTeamsR
|
||||||
|
@ -199,6 +199,7 @@ import Vervis.Web.Collab
|
||||||
import Vervis.Web.Darcs
|
import Vervis.Web.Darcs
|
||||||
import Vervis.Web.Delivery
|
import Vervis.Web.Delivery
|
||||||
import Vervis.Web.Git
|
import Vervis.Web.Git
|
||||||
|
import Vervis.Widget.Repo
|
||||||
import Vervis.Widget.Tracker
|
import Vervis.Widget.Tracker
|
||||||
|
|
||||||
import qualified Vervis.Client as C
|
import qualified Vervis.Client as C
|
||||||
|
@ -552,12 +553,6 @@ postRepoEditR repoHash = do
|
||||||
defaultLayout $(widgetFile "repo/edit")
|
defaultLayout $(widgetFile "repo/edit")
|
||||||
-}
|
-}
|
||||||
|
|
||||||
postRepoFollowR :: KeyHashid Repo -> Handler ()
|
|
||||||
postRepoFollowR _ = error "Temporarily disabled"
|
|
||||||
|
|
||||||
postRepoUnfollowR :: KeyHashid Repo -> Handler ()
|
|
||||||
postRepoUnfollowR _ = error "Temporarily disabled"
|
|
||||||
|
|
||||||
postPostReceiveR :: Handler Text
|
postPostReceiveR :: Handler Text
|
||||||
postPostReceiveR = do
|
postPostReceiveR = do
|
||||||
-- Parse the push object that the hook sent
|
-- Parse the push object that the hook sent
|
||||||
|
@ -797,7 +792,32 @@ getRepoStampR :: KeyHashid Repo -> KeyHashid SigKey -> Handler TypedContent
|
||||||
getRepoStampR = servePerActorKey repoActor LocalActorRepo
|
getRepoStampR = servePerActorKey repoActor LocalActorRepo
|
||||||
|
|
||||||
getRepoCollabsR :: KeyHashid Repo -> Handler TypedContent
|
getRepoCollabsR :: KeyHashid Repo -> Handler TypedContent
|
||||||
getRepoCollabsR repoHash = error "TODO getRepoCollabsR"
|
getRepoCollabsR repoHash = do
|
||||||
|
repoID <- decodeKeyHashid404 repoHash
|
||||||
|
(repo, actor) <- runDB $ do
|
||||||
|
repo <- get404 repoID
|
||||||
|
actor <- getJust $ repoActor repo
|
||||||
|
return (repo, actor)
|
||||||
|
serveCollabs
|
||||||
|
AP.RelHasCollab
|
||||||
|
(repoResource repo)
|
||||||
|
(RepoR repoHash)
|
||||||
|
(RepoCollabsR repoHash)
|
||||||
|
(RepoRemoveR repoHash)
|
||||||
|
(RepoInviteR repoHash)
|
||||||
|
(repoNavW (Entity repoID repo) actor)
|
||||||
|
|
||||||
|
postRepoInviteR :: KeyHashid Repo -> Handler Html
|
||||||
|
postRepoInviteR repoHash = do
|
||||||
|
repoID <- decodeKeyHashid404 repoHash
|
||||||
|
resourceID <- runDB $ repoResource <$> get404 repoID
|
||||||
|
serveInviteCollab resourceID (RepoCollabsR repoHash)
|
||||||
|
|
||||||
|
postRepoRemoveR :: KeyHashid Repo -> CollabId -> Handler Html
|
||||||
|
postRepoRemoveR repoHash collabID = do
|
||||||
|
repoID <- decodeKeyHashid404 repoHash
|
||||||
|
resourceID <- runDB $ repoResource <$> get404 repoID
|
||||||
|
serveRemoveCollab resourceID (RepoCollabsR repoHash) collabID
|
||||||
|
|
||||||
addProjectForm = renderDivs $
|
addProjectForm = renderDivs $
|
||||||
areq fedUriField "(URI) Project" Nothing
|
areq fedUriField "(URI) Project" Nothing
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{- This file is part of Vervis.
|
{- This file is part of Vervis.
|
||||||
-
|
-
|
||||||
- Written in 2016, 2018, 2020 by fr33domlover <fr33domlover@riseup.net>.
|
- Written in 2016, 2018, 2020, 2024 by fr33domlover <fr33domlover@riseup.net>.
|
||||||
-
|
-
|
||||||
- ♡ Copying is an act of love. Please copy, reuse and share.
|
- ♡ Copying is an act of love. Please copy, reuse and share.
|
||||||
-
|
-
|
||||||
|
@ -17,6 +17,7 @@ module Vervis.Widget.Repo
|
||||||
( refSelectW
|
( refSelectW
|
||||||
, changesW
|
, changesW
|
||||||
, inlineDiffW
|
, inlineDiffW
|
||||||
|
, repoNavW
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ import Data.List.NonEmpty (NonEmpty)
|
||||||
import Data.Set (Set)
|
import Data.Set (Set)
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Data.Vector (Vector)
|
import Data.Vector (Vector)
|
||||||
|
import Database.Persist
|
||||||
import Yesod.Core.Handler (getsYesod)
|
import Yesod.Core.Handler (getsYesod)
|
||||||
|
|
||||||
import qualified Data.List.NonEmpty as N
|
import qualified Data.List.NonEmpty as N
|
||||||
|
@ -131,3 +133,9 @@ inlineDiffW orig hunks = do
|
||||||
ctx <- getsYesod $ appDiffContextLines . appSettings
|
ctx <- getsYesod $ appDiffContextLines . appSettings
|
||||||
let diffs = addContext ctx orig $ hunkLines hunks
|
let diffs = addContext ctx orig $ hunkLines hunks
|
||||||
$(widgetFile "repo/widget/inline-diff")
|
$(widgetFile "repo/widget/inline-diff")
|
||||||
|
|
||||||
|
repoNavW :: Entity Repo -> Actor -> Widget
|
||||||
|
repoNavW (Entity repoID repo) actor = do
|
||||||
|
repoHash <- encodeKeyHashid repoID
|
||||||
|
hashLoom <- getEncodeKeyHashid
|
||||||
|
$(widgetFile "repo/widget/nav")
|
||||||
|
|
46
templates/repo/widget/nav.hamlet
Normal file
46
templates/repo/widget/nav.hamlet
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
$# This file is part of Vervis.
|
||||||
|
$#
|
||||||
|
$# Written in 2019, 2022, 2023, 2024 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/>.
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
[[ 🗃
|
||||||
|
<a href=@{RepoR repoHash}>
|
||||||
|
=#{keyHashidText repoHash} #{actorName actor}
|
||||||
|
]] ::
|
||||||
|
<span>
|
||||||
|
<a href=@{RepoInboxR repoHash}>
|
||||||
|
[📥 Inbox]
|
||||||
|
<span>
|
||||||
|
<a href=@{RepoOutboxR repoHash}>
|
||||||
|
[📤 Outbox]
|
||||||
|
<span>
|
||||||
|
<a href=@{RepoErrboxR repoHash}>
|
||||||
|
[💥 Errbox]
|
||||||
|
<span>
|
||||||
|
<a href=@{RepoFollowersR repoHash}>
|
||||||
|
[🐤 Followers]
|
||||||
|
<span>
|
||||||
|
<a href=@{RepoCollabsR repoHash}>
|
||||||
|
[🤝 Collaborators]
|
||||||
|
<span>
|
||||||
|
<a href=@{RepoProjectsR repoHash}>
|
||||||
|
[🏗 Projects]
|
||||||
|
<a href=@{RepoR repoHash}>
|
||||||
|
<span>
|
||||||
|
<a href=@{RepoCommitsR repoHash}>
|
||||||
|
[🛠 Commits]
|
||||||
|
$maybe loomID <- repoLoom repo
|
||||||
|
<span>
|
||||||
|
<a href=@{LoomClothsR $ hashLoom loomID}>
|
||||||
|
[🧩 Merge Requests]
|
|
@ -222,8 +222,6 @@
|
||||||
/new-repo RepoNewR GET POST
|
/new-repo RepoNewR GET POST
|
||||||
/repos/#RepoKeyHashid/delete RepoDeleteR POST
|
/repos/#RepoKeyHashid/delete RepoDeleteR POST
|
||||||
/repos/#RepoKeyHashid/edit RepoEditR GET POST
|
/repos/#RepoKeyHashid/edit RepoEditR GET POST
|
||||||
/repos/#RepoKeyHashid/follow RepoFollowR POST
|
|
||||||
/repos/#RepoKeyHashid/unfollow RepoUnfollowR POST
|
|
||||||
|
|
||||||
/post-receive PostReceiveR POST
|
/post-receive PostReceiveR POST
|
||||||
|
|
||||||
|
@ -232,6 +230,8 @@
|
||||||
/repos/#RepoKeyHashid/stamps/#SigKeyKeyHashid RepoStampR GET
|
/repos/#RepoKeyHashid/stamps/#SigKeyKeyHashid RepoStampR GET
|
||||||
|
|
||||||
/repos/#RepoKeyHashid/collabs RepoCollabsR GET
|
/repos/#RepoKeyHashid/collabs RepoCollabsR GET
|
||||||
|
/repos/#RepoKeyHashid/invite RepoInviteR POST
|
||||||
|
/repos/#RepoKeyHashid/remove/#CollabId RepoRemoveR POST
|
||||||
/repos/#RepoKeyHashid/projects RepoProjectsR GET
|
/repos/#RepoKeyHashid/projects RepoProjectsR GET
|
||||||
|
|
||||||
/repos/#RepoKeyHashid/teams RepoTeamsR GET
|
/repos/#RepoKeyHashid/teams RepoTeamsR GET
|
||||||
|
@ -321,12 +321,12 @@
|
||||||
/new-loom LoomNewR GET POST
|
/new-loom LoomNewR GET POST
|
||||||
-- /looms/#LoomKeyHashid/delete LoomDeleteR POST
|
-- /looms/#LoomKeyHashid/delete LoomDeleteR POST
|
||||||
-- /looms/#LoomKeyHashid/edit LoomEditR GET POST
|
-- /looms/#LoomKeyHashid/edit LoomEditR GET POST
|
||||||
/looms/#LoomKeyHashid/follow LoomFollowR POST
|
|
||||||
/looms/#LoomKeyHashid/unfollow LoomUnfollowR POST
|
|
||||||
|
|
||||||
/looms/#LoomKeyHashid/stamps/#SigKeyKeyHashid LoomStampR GET
|
/looms/#LoomKeyHashid/stamps/#SigKeyKeyHashid LoomStampR GET
|
||||||
|
|
||||||
/looms/#LoomKeyHashid/collabs LoomCollabsR GET
|
/looms/#LoomKeyHashid/collabs LoomCollabsR GET
|
||||||
|
/looms/#LoomKeyHashid/invite LoomInviteR POST
|
||||||
|
/looms/#LoomKeyHashid/remove/#CollabId LoomRemoveR POST
|
||||||
/looms/#LoomKeyHashid/projects LoomProjectsR GET
|
/looms/#LoomKeyHashid/projects LoomProjectsR GET
|
||||||
|
|
||||||
/looms/#LoomKeyHashid/teams LoomTeamsR GET
|
/looms/#LoomKeyHashid/teams LoomTeamsR GET
|
||||||
|
|
Loading…
Reference in a new issue