From 7e5eabd807e2a4bcc4f7f436322ba6857f673078 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Sun, 1 Jun 2025 13:08:14 +0100 Subject: [PATCH] appview: pages: refactor pullStack fragment Change-Id: sxlmnswxxwlxnmwkmwsxyqnvtumvrnzy break out summarizedHeader and summarizedPullState into resuable fragments. Signed-off-by: oppiliappan --- .../repo/pulls/fragments/pullStack.html | 54 +------------------ .../pulls/fragments/summarizedPullHeader.html | 32 +++++++++++ .../pulls/fragments/summarizedPullState.html | 20 +++++++ 3 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 appview/pages/templates/repo/pulls/fragments/summarizedPullHeader.html create mode 100644 appview/pages/templates/repo/pulls/fragments/summarizedPullState.html diff --git a/appview/pages/templates/repo/pulls/fragments/pullStack.html b/appview/pages/templates/repo/pulls/fragments/pullStack.html index 4b2693c..e9468d3 100644 --- a/appview/pages/templates/repo/pulls/fragments/pullStack.html +++ b/appview/pages/templates/repo/pulls/fragments/pullStack.html @@ -8,58 +8,6 @@ {{ end }} {{ end }} -{{ define "summarizedHeader" }} -
-
-
- {{ block "summarizedPullState" . }} {{ end }} -
- - #{{ .PullId }} - {{ .Title }} - -
- -
- {{ $latestRound := .LastRoundNumber }} - {{ $lastSubmission := index .Submissions $latestRound }} - {{ $commentCount := len $lastSubmission.Comments }} - -
- {{ i "message-square" "w-3 h-3 md:hidden" }} - {{ $commentCount }} - -
-
- - - - #{{ $latestRound }} - -
-
-{{ end }} - -{{ define "summarizedPullState" }} - {{ $fgColor := "text-gray-600 dark:text-gray-300" }} - {{ $icon := "ban" }} - - {{ if .State.IsOpen }} - {{ $fgColor = "text-green-600 dark:text-green-500" }} - {{ $icon = "git-pull-request" }} - {{ else if .State.IsMerged }} - {{ $fgColor = "text-purple-600 dark:text-purple-500" }} - {{ $icon = "git-merge" }} - {{ else if .State.IsDeleted }} - {{ $fgColor = "text-red-600 dark:text-red-500" }} - {{ $icon = "git-pull-request-closed" }} - {{ end }} - - {{ $style := printf "w-4 h-4 %s" $fgColor }} - - {{ i $icon $style }} -{{ end }} - {{ define "pullList" }} {{ $list := index . 0 }} {{ $root := index . 1 }} @@ -77,7 +25,7 @@ {{ end }}
- {{ block "summarizedHeader" $pull }} {{ end }} + {{ template "repo/pulls/fragments/summarizedHeader" $pull }}
diff --git a/appview/pages/templates/repo/pulls/fragments/summarizedPullHeader.html b/appview/pages/templates/repo/pulls/fragments/summarizedPullHeader.html new file mode 100644 index 0000000..ca855b1 --- /dev/null +++ b/appview/pages/templates/repo/pulls/fragments/summarizedPullHeader.html @@ -0,0 +1,32 @@ +{{ define "repo/pulls/fragments/summarizedHeader" }} +
+
+
+ {{ template "repo/pulls/fragments/summarizedPullState" .State }} +
+ + #{{ .PullId }} + {{ .Title }} + +
+ +
+ {{ $latestRound := .LastRoundNumber }} + {{ $lastSubmission := index .Submissions $latestRound }} + {{ $commentCount := len $lastSubmission.Comments }} + +
+ {{ i "message-square" "w-3 h-3 md:hidden" }} + {{ $commentCount }} + +
+
+ + + + #{{ $latestRound }} + +
+
+{{ end }} + diff --git a/appview/pages/templates/repo/pulls/fragments/summarizedPullState.html b/appview/pages/templates/repo/pulls/fragments/summarizedPullState.html new file mode 100644 index 0000000..c87eb0c --- /dev/null +++ b/appview/pages/templates/repo/pulls/fragments/summarizedPullState.html @@ -0,0 +1,20 @@ +{{ define "repo/pulls/fragments/summarizedPullState" }} + {{ $fgColor := "text-gray-600 dark:text-gray-300" }} + {{ $icon := "ban" }} + + {{ if .IsOpen }} + {{ $fgColor = "text-green-600 dark:text-green-500" }} + {{ $icon = "git-pull-request" }} + {{ else if .IsMerged }} + {{ $fgColor = "text-purple-600 dark:text-purple-500" }} + {{ $icon = "git-merge" }} + {{ else if .IsDeleted }} + {{ $fgColor = "text-red-600 dark:text-red-500" }} + {{ $icon = "git-pull-request-closed" }} + {{ end }} + + {{ $style := printf "w-4 h-4 %s" $fgColor }} + + {{ i $icon $style }} +{{ end }} + -- 2.43.0