1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-28 23:24:53 +09:00

Display project/repo sharer nav, and project nav in repo page

This commit is contained in:
fr33domlover 2019-12-28 16:34:44 +00:00
parent 7654655bcf
commit d8fabbdfc5
13 changed files with 163 additions and 59 deletions

View file

@ -65,6 +65,7 @@ import Vervis.Model
import Vervis.Model.Ident import Vervis.Model.Ident
import Vervis.Model.Repo import Vervis.Model.Repo
import Vervis.Settings import Vervis.Settings
import Vervis.Widget.Project
import Vervis.Widget.Sharer import Vervis.Widget.Sharer
import Vervis.Widget.Workflow import Vervis.Widget.Workflow

View file

@ -208,14 +208,16 @@ getRepoNewR user = do
((_result, widget), enctype) <- runFormPost $ newRepoForm sid Nothing ((_result, widget), enctype) <- runFormPost $ newRepoForm sid Nothing
defaultLayout $(widgetFile "repo/new") defaultLayout $(widgetFile "repo/new")
selectRepo :: ShrIdent -> RpIdent -> AppDB (Maybe (Sharer, Project), Repo) selectRepo :: ShrIdent -> RpIdent -> AppDB (Maybe (Sharer, Project, Workflow, Sharer), Repo)
selectRepo shar repo = do selectRepo shar repo = do
Entity sid _s <- getBy404 $ UniqueSharer shar Entity sid _s <- getBy404 $ UniqueSharer shar
Entity _rid r <- getBy404 $ UniqueRepo repo sid Entity _rid r <- getBy404 $ UniqueRepo repo sid
mj <- for (repoProject r) $ \ jid -> do mj <- for (repoProject r) $ \ jid -> do
j <- get404 jid j <- get404 jid
s <- get404 $ projectSharer j s <- get404 $ projectSharer j
return (s, j) w <- get404 $ projectWorkflow j
sw <- get404 $ workflowSharer w
return (s, j, w, sw)
return (mj, r) return (mj, r)
getRepoR :: ShrIdent -> RpIdent -> Handler TypedContent getRepoR :: ShrIdent -> RpIdent -> Handler TypedContent

View file

@ -74,12 +74,13 @@ import Vervis.SourceTree
import Vervis.Style import Vervis.Style
import Vervis.Time import Vervis.Time
import Vervis.Widget (buttonW) import Vervis.Widget (buttonW)
import Vervis.Widget.Project
import Vervis.Widget.Repo import Vervis.Widget.Repo
import Vervis.Widget.Sharer import Vervis.Widget.Sharer
import qualified Vervis.Darcs as D (readSourceView, readChangesView, readPatch) import qualified Vervis.Darcs as D (readSourceView, readChangesView, readPatch)
getDarcsRepoSource :: (Maybe (Sharer, Project), Repo) -> ShrIdent -> RpIdent -> [Text] -> Handler Html getDarcsRepoSource :: (Maybe (Sharer, Project, Workflow, Sharer), Repo) -> ShrIdent -> RpIdent -> [Text] -> Handler Html
getDarcsRepoSource (mproject, repository) user repo dir = do getDarcsRepoSource (mproject, repository) user repo dir = do
path <- askRepoDir user repo path <- askRepoDir user repo
msv <- liftIO $ D.readSourceView path dir msv <- liftIO $ D.readSourceView path dir

View file

@ -88,13 +88,14 @@ import Vervis.SourceTree
import Vervis.Style import Vervis.Style
import Vervis.Time (showDate) import Vervis.Time (showDate)
import Vervis.Widget (buttonW) import Vervis.Widget (buttonW)
import Vervis.Widget.Project
import Vervis.Widget.Repo import Vervis.Widget.Repo
import Vervis.Widget.Sharer import Vervis.Widget.Sharer
import qualified Data.ByteString.Lazy as BL (ByteString) import qualified Data.ByteString.Lazy as BL (ByteString)
import qualified Vervis.Git as G (readSourceView, readChangesView, listRefs, readPatch) import qualified Vervis.Git as G (readSourceView, readChangesView, listRefs, readPatch)
getGitRepoSource :: (Maybe (Sharer, Project), Repo) -> ShrIdent -> RpIdent -> Text -> [Text] -> Handler Html getGitRepoSource :: (Maybe (Sharer, Project, Workflow, Sharer), Repo) -> ShrIdent -> RpIdent -> Text -> [Text] -> Handler Html
getGitRepoSource (mproject, repository) user repo ref dir = do getGitRepoSource (mproject, repository) user repo ref dir = do
path <- askRepoDir user repo path <- askRepoDir user repo
(branches, tags, msv) <- liftIO $ G.readSourceView path ref dir (branches, tags, msv) <- liftIO $ G.readSourceView path ref dir

View file

@ -0,0 +1,29 @@
{- This file is part of Vervis.
-
- Written in 2019 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/>.
-}
module Vervis.Widget.Project
( projectNavW
)
where
import Vervis.Foundation
import Vervis.Model
import Vervis.Model.Ident
import Vervis.Settings
import Vervis.Widget.Workflow
projectNavW :: Project -> Workflow -> Sharer -> ShrIdent -> PrjIdent -> Widget
projectNavW project workflow wsharer shar proj =
$(widgetFile "project/widget/nav")

View file

@ -17,6 +17,7 @@ module Vervis.Widget.Sharer
( sharerLinkW ( sharerLinkW
, sharerLinkFedW , sharerLinkFedW
, followW , followW
, personNavW
) )
where where
@ -34,6 +35,7 @@ import Database.Persist.Local
import Vervis.Foundation import Vervis.Foundation
import Vervis.Model import Vervis.Model
import Vervis.Model.Ident import Vervis.Model.Ident
import Vervis.Settings
import Vervis.Widget import Vervis.Widget
sharerLinkW :: Sharer -> Widget sharerLinkW :: Sharer -> Widget
@ -69,3 +71,6 @@ followW followRoute unfollowRoute getFsid = do
case mfollow of case mfollow of
Nothing -> buttonW POST "Follow" followRoute Nothing -> buttonW POST "Follow" followRoute
Just _ -> buttonW POST "Unfollow" unfollowRoute Just _ -> buttonW POST "Unfollow" unfollowRoute
personNavW :: ShrIdent -> Widget
personNavW shr = $(widgetFile "person/widget/nav")

View file

@ -18,25 +18,4 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<p>#{personAbout person} <p>#{personAbout person}
<div> ^{personNavW shr}
<span>
<a href=@{SharerInboxR shr}>
[📥 Inbox]
<span>
<a href=@{SharerOutboxR shr}>
[📤 Outbox]
<span>
<a href=@{SharerFollowersR shr}>
[🐤 Followers]
<span>
<a href=@{SharerFollowingR shr}>
[🐔 Following]
<span>
<a href=@{ProjectsR shr}>
[🏗 Projects]
<span>
<a href=@{ReposR shr}>
[🗃 Repositories]
<span>
<a href=@{WorkflowsR shr}>
[🔁 Workflows]

View file

@ -0,0 +1,41 @@
$# This file is part of Vervis.
$#
$# Written in 2019 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=@{SharerR shr}>
#{shr2text shr}
]] ::
<span>
<a href=@{SharerInboxR shr}>
[📥 Inbox]
<span>
<a href=@{SharerOutboxR shr}>
[📤 Outbox]
<span>
<a href=@{SharerFollowersR shr}>
[🐤 Followers]
<span>
<a href=@{SharerFollowingR shr}>
[🐔 Following]
<span>
<a href=@{ProjectsR shr}>
[🏗 Projects]
<span>
<a href=@{ReposR shr}>
[🗃 Repositories]
<span>
<a href=@{WorkflowsR shr}>
[🔁 Workflows]

View file

@ -22,37 +22,9 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
- -
<span>#{desc} <span>#{desc}
<div> ^{personNavW shar}
<span>
<a href=@{ProjectInboxR shar proj}> ^{projectNavW project workflow wsharer shar proj}
[📥 Inbox]
<span>
<a href=@{ProjectOutboxR shar proj}>
[📤 Outbox]
<span>
<a href=@{ProjectFollowersR shar proj}>
[🐤 Followers]
<span>
<a href=@{ProjectDevsR shar proj}>
[🤝 Collaborators]
<span>
<a href=@{TicketsR shar proj}>
[🐛 Tickets]
<span>
<a href=@{ClaimRequestsProjectR shar proj}>
[✋ Ticket claim requests]
<span>
[🔁 Ticket workflow:
^{workflowLinkW wsharer workflow}]
<span>
$maybe _wiki <- projectWiki project
<a href=@{WikiPageR shar proj []}>
[📖 Wiki]
$nothing
[No wiki]
<span>
<a href=@{ProjectEditR shar proj}>
[✏ Edit]
^{followButton} ^{followButton}

View file

@ -0,0 +1,50 @@
$# This file is part of Vervis.
$#
$# Written in 2019 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=@{ProjectR shar proj}>
#{prj2text proj}
]] ::
<span>
<a href=@{ProjectInboxR shar proj}>
[📥 Inbox]
<span>
<a href=@{ProjectOutboxR shar proj}>
[📤 Outbox]
<span>
<a href=@{ProjectFollowersR shar proj}>
[🐤 Followers]
<span>
<a href=@{ProjectDevsR shar proj}>
[🤝 Collaborators]
<span>
<a href=@{TicketsR shar proj}>
[🐛 Tickets]
<span>
<a href=@{ClaimRequestsProjectR shar proj}>
[✋ Ticket claim requests]
<span>
[🔁 Ticket workflow:
^{workflowLinkW wsharer workflow}]
<span>
$maybe _wiki <- projectWiki project
<a href=@{WikiPageR shar proj []}>
[📖 Wiki]
$nothing
[No wiki]
<span>
<a href=@{ProjectEditR shar proj}>
[✏ Edit]

View file

@ -12,7 +12,7 @@ $# You should have received a copy of the CC0 Public Domain Dedication along
$# with this software. If not, see $# with this software. If not, see
$# <http://creativecommons.org/publicdomain/zero/1.0/>. $# <http://creativecommons.org/publicdomain/zero/1.0/>.
$maybe (s, j) <- mproject $maybe (s, j, w, sw) <- mproject
<p> <p>
Belongs to project Belongs to project
<a href=@{ProjectR (sharerIdent s) (projectIdent j)}> <a href=@{ProjectR (sharerIdent s) (projectIdent j)}>
@ -21,10 +21,21 @@ $maybe (s, j) <- mproject
$nothing $nothing
#{prj2text $ projectIdent j} #{prj2text $ projectIdent j}
^{personNavW $ sharerIdent s}
^{projectNavW j w sw (sharerIdent s) (projectIdent j)}
$maybe desc <- repoDesc repository $maybe desc <- repoDesc repository
<p>#{desc} <p>#{desc}
^{personNavW user}
<div> <div>
<span>
[[ 🗃
<a href=@{RepoR user repo}>
#{rp2text repo}
]] ::
<span> <span>
<a href=@{RepoInboxR user repo}> <a href=@{RepoInboxR user repo}>
[📥 Inbox] [📥 Inbox]

View file

@ -12,7 +12,7 @@ $# You should have received a copy of the CC0 Public Domain Dedication along
$# with this software. If not, see $# with this software. If not, see
$# <http://creativecommons.org/publicdomain/zero/1.0/>. $# <http://creativecommons.org/publicdomain/zero/1.0/>.
$maybe (s, j) <- mproject $maybe (s, j, w, sw) <- mproject
<p> <p>
Belongs to project Belongs to project
<a href=@{ProjectR (sharerIdent s) (projectIdent j)}> <a href=@{ProjectR (sharerIdent s) (projectIdent j)}>
@ -21,10 +21,21 @@ $maybe (s, j) <- mproject
$nothing $nothing
#{prj2text $ projectIdent j} #{prj2text $ projectIdent j}
^{personNavW $ sharerIdent s}
^{projectNavW j w sw (sharerIdent s) (projectIdent j)}
$maybe desc <- repoDesc repository $maybe desc <- repoDesc repository
<p>#{desc} <p>#{desc}
^{personNavW user}
<div> <div>
<span>
[[ 🗃
<a href=@{RepoR user repo}>
#{rp2text repo}
]] ::
<span> <span>
<a href=@{RepoInboxR user repo}> <a href=@{RepoInboxR user repo}>
[📥 Inbox] [📥 Inbox]

View file

@ -207,6 +207,7 @@ library
Vervis.Time Vervis.Time
Vervis.Widget Vervis.Widget
Vervis.Widget.Discussion Vervis.Widget.Discussion
Vervis.Widget.Project
Vervis.Widget.Repo Vervis.Widget.Repo
Vervis.Widget.Role Vervis.Widget.Role
Vervis.Widget.Sharer Vervis.Widget.Sharer