#4084 RFE - Add Take button to pull request template
Closed: Fixed 5 years ago by pingou. Opened 5 years ago by wattersmt.

I would like to add a button to assign PRs to myself in pagure however I am having an issue getting the javascript to work correctly using the repo_pull_request.html template.

Here is a diff of the changes I've made so far.

--- repo_pull_request.html.orig 2018-11-29 11:05:35.383051006 -0500
+++ repo_pull_request.html.new  2018-11-28 11:25:29.175634791 -0500
@@ -484,7 +484,14 @@
             {% if pull_request.assignee.username %}
               <div class="mt-1">{{pull_request.assignee.username| avatar(size=24) | safe}} {{ pull_request.assignee.username }}</div>
             {% else %}
-              <span class="text-muted">None</span>
+              <div class="text-muted">
+                  <span class="text-muted">None</span>
+                    {% if g.authenticated and (g.repo_user or g.fas_user.username == pull_request.user.user or open_access) and pull_request.status|lower == 'open'
+                      and (not pull_request.assignee or pull_request.assignee.username != g.fas_user.username)
+                      and not repo.settings.get('pull_request_tracker_read_only', False) %}
+                      &mdash; <a href="javascript:void(0)" id="take-btn" title="assign this pull_request to you"> Take </a>
+                    {% endif %}
+                  </div>
             {% endif %}
           </div>
         </fieldset>

After making these changes I see the link in pagure but clicking on it does nothing. Attached is a screenshot for reference.

Screenshot_from_2018-11-29_11-25-14.png


Metadata Update from @pingou:
- Issue tagged with: RFE

5 years ago

You'll also need the piece of javascript code that execute the action (calls the API endpoint to assign the PR to yourself)

Metadata Update from @pingou:
- Issue set to the milestone: 5.4

5 years ago

Metadata Update from @pingou:
- Issue assigned to pingou

5 years ago

Login to comment on this ticket.

Metadata
Attachments 1
Related Pull Requests
  • #4302 Merged 5 years ago