]> source.dussan.org Git - gitblit.git/commitdiff
Display an explanation in ticket page if the user can't propose commits
authorJames Moger <james.moger@gitblit.com>
Fri, 7 Mar 2014 19:59:02 +0000 (14:59 -0500)
committerJames Moger <james.moger@gitblit.com>
Fri, 7 Mar 2014 19:59:02 +0000 (14:59 -0500)
src/main/java/com/gitblit/wicket/GitBlitWebApp.properties
src/main/java/com/gitblit/wicket/pages/TicketPage.html
src/main/java/com/gitblit/wicket/pages/TicketPage.java

index 1a907babfe8677f9d36cbbc117fad42f1498c8b8..e52623e688be2706bd982cd85398794ae1bd96f3 100644 (file)
@@ -662,4 +662,10 @@ gb.mergeTo = merge to
 gb.labels = labels
 gb.reviewers = reviewers
 gb.voters = voters
-gb.mentions = mentions
\ No newline at end of file
+gb.mentions = mentions
+gb.canNotProposePatchset = can not propose a patchset
+gb.repositoryIsMirror = This repository is a read-only mirror.
+gb.repositoryIsFrozen = This repository is frozen.
+gb.repositoryDoesNotAcceptPatchsets = This repository does not accept patchsets.
+gb.serverDoesNotAcceptPatchsets = This server does not accept patchsets.
+gb.ticketIsClosed = This ticket is closed.
\ No newline at end of file
index 6fcf96c88a90efcb3ebaf555656602a51139f2aa..a2f105d3f75c441e3acae906d8c86a3202824a66 100644 (file)
@@ -298,6 +298,22 @@ pt push</pre>
 </wicket:fragment>\r
 \r
 \r
+<!-- CAN NOT PROPOSE FRAGMENT -->\r
+<wicket:fragment wicket:id="canNotProposeFragment">\r
+       <div class="featureWelcome">\r
+               <div class="row">\r
+                       <div class="icon span2 hidden-phone"><i class="fa fa-ban"></i></div>\r
+                       <div class="span9">             \r
+                               <h1><wicket:message key="gb.canNotProposePatchset"></wicket:message></h1>\r
+                               <div class="markdown">\r
+                                       <p><span wicket:id="reason"></span></p>\r
+                               </div>\r
+                       </div>\r
+               </div>\r
+       </div>\r
+</wicket:fragment>\r
+\r
+\r
 <!-- PATCHSET FRAGMENT -->\r
 <wicket:fragment wicket:id="patchsetFragment">\r
        <div class="row" style="padding: 0px 0px 20px;">\r
index 4be9e69f3cde025e5dfa5f3b126df1d2950112be..7b492dc270326ed767e7646f2cdc6a77e13db949 100644 (file)
@@ -744,8 +744,22 @@ public class TicketPage extends TicketBasePage {
                                changeIdFrag.add(new Label("gitWorkflowSteps", getProposeWorkflow("propose_git.md", repoUrl, ticket.number)).setEscapeModelStrings(false));\r
                                add(changeIdFrag);\r
                        } else {\r
-                               // ticket is resolved OR repository is rejecting new patchsets\r
-                               add(new Label("patchset").setVisible(false));\r
+                               // explain why you can't propose a patchset\r
+                               Fragment fragment = new Fragment("patchset", "canNotProposeFragment", this);\r
+                               String reason = "";\r
+                               if (ticket.isClosed()) {\r
+                                       reason = getString("gb.ticketIsClosed");\r
+                               } else if (repository.isMirror) {\r
+                                       reason = getString("gb.repositoryIsMirror");\r
+                               } else if (repository.isFrozen) {\r
+                                       reason = getString("gb.repositoryIsFrozen");\r
+                               } else if (!repository.acceptNewPatchsets) {\r
+                                       reason = getString("gb.repositoryDoesNotAcceptPatchsets");\r
+                               } else {\r
+                                       reason = getString("gb.serverDoesNotAcceptPatchsets");\r
+                               }\r
+                               fragment.add(new Label("reason", reason));\r
+                               add(fragment);\r
                        }\r
                } else {\r
                        // show current patchset\r