[UI] Agit: Add AGit label to AGit-created PRs

Adds a label to Pull Requests that were created using AGit-Flow,
in order to prevent situations where a contributor uses AGit-Flow
to push new changes - only to realize that they did not use AGit-Flow
in the first place, and that they just opened a new PR accidentally
(that was me).

Also intended to raise general awareness about the feature. Some
additional work, such as adding a tooltip, still needs to be
done.

A small typo fix for a comment and (exclusively) formatting fixes
in the copyright header are also included.

Refs: https://codeberg.org/forgejo/forgejo/issues/2433
This commit is contained in:
Panagiotis "Ivory" Vasilopoulos 2024-02-23 01:26:17 +01:00
parent c47e6ceb82
commit bf7fb89178
4 changed files with 43 additions and 4 deletions

View file

@ -47,7 +47,9 @@
{{if .HeadBranchLink}}
{{$headHref = printf `<a href="%s">%s</a>` (.HeadBranchLink | Escape) $headHref}}
{{end}}
{{$headHref = printf `%s <button class="btn interact-fg" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` $headHref (ctx.Locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}}
{{if not .MadeUsingAGit}}
{{$headHref = printf `%s <button class="btn interact-fg" data-tooltip-content="%s" data-clipboard-text="%s">%s</button>` $headHref (ctx.Locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}}
{{end}}
{{$baseHref := .BaseTarget|Escape}}
{{if .BaseBranchLink}}
{{$baseHref = printf `<a href="%s">%s</a>` (.BaseBranchLink | Escape) $baseHref}}
@ -70,6 +72,12 @@
{{ctx.Locale.Tr "repo.pulls.title_desc" .NumCommits ($headHref|Safe) ($baseHref|Safe)}}
</span>
{{end}}
{{if .MadeUsingAGit}}
{{/* TODO: Add tooltip and a link to the documentation */}}
<span id="agit-label" class="ui small label">
{{ctx.Locale.Tr "repo.pulls.made_using_agit"}}
</span>
{{end}}
<span id="pull-desc-edit" class="gt-hidden flex-text-block">
<div class="ui floating filter dropdown">
<div class="ui basic small button gt-mr-0">