[PATCH 4 of 6] pullrequest overview: add delete button to own pull requests

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Mar 3 16:40:31 EST 2015


# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1425417979 -3600
#      Tue Mar 03 22:26:19 2015 +0100
# Node ID f2607e13f8d763c6bdea3ce4da13cd33e7797120
# Parent  acea7f4e8c6bfefb8526ebe5b1b1ad7914c7ee5d
pullrequest overview: add delete button to own pull requests

In anticipation of the re-use of the pullrequest overview to display 'my
pullrequests', add a delete button to all pullrequests owned by the
currently logged-in user.
An explicit width is added to the column because the column is otherwise
unnecessarily large.

diff --git a/kallithea/templates/pullrequests/pullrequest_data.html b/kallithea/templates/pullrequests/pullrequest_data.html
--- a/kallithea/templates/pullrequests/pullrequest_data.html
+++ b/kallithea/templates/pullrequests/pullrequest_data.html
@@ -21,12 +21,26 @@
     </thead>
 % for pr in pullrequests:
     <tr class="${'pr-closed' if pr.is_closed() else ''}">
-      <td>
+      <td width="60px">
+        ## review status
         %if pr.last_review_status:
           <i class="icon-circle changeset-status-${pr.last_review_status}" title="${_("Someone voted: %s") % pr.last_review_status}"></i>
         %else:
           <i class="icon-circle changeset-status-not_reviewed" title="${_("Nobody voted")}"></i>
         %endif
+
+        ## delete button
+        %if pr.author.user_id == c.authuser.user_id:
+          ${h.form(url('pullrequest_delete', repo_name=pr.other_repo.repo_name, pull_request_id=pr.pull_request_id),method='delete', style="display:inline-block")}
+          <button class="action_button"
+                  id="remove_${pr.pull_request_id}"
+                  name="remove_${pr.pull_request_id}"
+                  title="${_('Delete Pull Request')}"
+                  onclick="return confirm('${_('Confirm to delete this pull request')}');">
+            <i class="icon-minus-circled"></i>
+          </button>
+          ${h.end_form()}
+        %endif
       </td>
       <td>
         <a href="${pr.url()}">


More information about the kallithea-general mailing list