diff options
author | Punit Inani <80308335+puni9869@users.noreply.github.com> | 2023-03-21 03:24:23 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-20 17:54:23 -0400 |
commit | a8c30a45fa49a3a551b1dca882960008c254bb3d (patch) | |
tree | 792d61da2590e2267cb7c8f896d671179069011d | |
parent | 8f3aaef3747e8c656cfe2562996dc1806b4d8a0f (diff) | |
download | gitea-a8c30a45fa49a3a551b1dca882960008c254bb3d.tar.gz gitea-a8c30a45fa49a3a551b1dca882960008c254bb3d.zip |
`Publish Review` buttons should indicate why they are disabled (#23598)
Adding tooltip on "Approve" and "Review Changes" buttons. is try to do
by them self on their PR.
Resolves https://github.com/go-gitea/gitea/issues/23547
`Approve` tootip text :- "Pull request authors can’t approve their own
pull request"
`Request Changes` tooltip text:- "Pull request authors can’t request
changes on their own pull request"
Before
https://user-images.githubusercontent.com/115237/225984020-306c048f-cb9b-4dee-8929-1c74c331518b.png
After
<img width="841" alt="image"
src="https://user-images.githubusercontent.com/80308335/226445845-b5f6f6c9-f0dc-4934-a282-3b8be06417a8.png">
-rw-r--r-- | options/locale/locale_en-US.ini | 2 | ||||
-rw-r--r-- | templates/repo/diff/new_review.tmpl | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e519258c6b..818a6bbef1 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2265,7 +2265,9 @@ diff.review.header = Submit review diff.review.placeholder = Review comment diff.review.comment = Comment diff.review.approve = Approve +diff.review.self_reject = Pull request authors can't request changes on their own pull request diff.review.reject = Request changes +diff.review.self_approve = Pull request authors can't approve their own pull request diff.committed_by = committed by diff.protected = Protected diff.image.side_by_side = Side by Side diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index af970a67b6..b4254bc397 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -22,9 +22,22 @@ </div> {{end}} <div class="ui divider"></div> - <button type="submit" name="type" value="approve" {{if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID)}} disabled {{end}} class="ui submit green tiny button btn-submit">{{$.locale.Tr "repo.diff.review.approve"}}</button> + {{$showSelfTooltip := (and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID))}} + {{if $showSelfTooltip}} + <span class="gt-dib tooltip" data-content="{{$.locale.Tr "repo.diff.review.self_approve"}}"> + <button type="submit" name="type" value="approve" disabled class="ui submit green tiny button btn-submit">{{$.locale.Tr "repo.diff.review.approve"}}</button> + </span> + {{else}} + <button type="submit" name="type" value="approve" class="ui submit green tiny button btn-submit">{{$.locale.Tr "repo.diff.review.approve"}}</button> + {{end}} <button type="submit" name="type" value="comment" class="ui submit tiny basic button btn-submit">{{$.locale.Tr "repo.diff.review.comment"}}</button> - <button type="submit" name="type" value="reject" {{if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID)}} disabled {{end}} class="ui submit red tiny button btn-submit">{{$.locale.Tr "repo.diff.review.reject"}}</button> + {{if $showSelfTooltip}} + <span class="gt-dib tooltip" data-content="{{$.locale.Tr "repo.diff.review.self_reject"}}"> + <button type="submit" name="type" value="reject" disabled class="ui submit red tiny button btn-submit">{{$.locale.Tr "repo.diff.review.reject"}}</button> + </span> + {{else}} + <button type="submit" name="type" value="reject" class="ui submit red tiny button btn-submit">{{$.locale.Tr "repo.diff.review.reject"}}</button> + {{end}} </form> </div> </div> |