| |
@@ -99,9 +99,9 @@
|
| |
<i class="fa fa-arrow-circle-down fa-fw"></i> Open PR
|
| |
</a>
|
| |
<div class="dropdown-menu dropdown-menu-right" id="PR-dropdown">
|
| |
- <a class="dropdown-item ">
|
| |
- <small><img id="spinnergif"
|
| |
- src="{{ url_for('static', filename='images/spinner.gif') }}">
|
| |
+ <a class="dropdown-item" id="spinnergif">
|
| |
+ <small><img
|
| |
+ src="{{ url_for('static', filename='images/spinner.gif') }}" />
|
| |
</small>
|
| |
</a>
|
| |
{% if head %}
|
| |
@@ -404,91 +404,102 @@
|
| |
<script>
|
| |
|
| |
{% if g.authenticated and not g.repo_obj.is_empty %}
|
| |
+
|
| |
+ {% if g.repo_committer %}
|
| |
$(function() {
|
| |
$.ajax({
|
| |
url: '{{ url_for("internal_ns.get_pull_request_ready_branch") }}' ,
|
| |
type: 'POST',
|
| |
data: {
|
| |
- namespace: "{{ repo.namespace if repo.namespace }}",
|
| |
repo: "{{ repo.name }}",
|
| |
- repouser: "{{ g.fas_user.username }}",
|
| |
+ namespace: "{{ repo.namespace if repo.namespace }}",
|
| |
+ repouser: "",
|
| |
csrf_token: "{{ g.confirmationform.csrf_token.current_token }}",
|
| |
},
|
| |
dataType: 'json',
|
| |
error: function(res) {
|
| |
- $('#spinnergif').hide()
|
| |
- console.log(res);
|
| |
+ console.log(res);
|
| |
},
|
| |
success: function(res) {
|
| |
- $('#spinnergif').hide()
|
| |
- console.log("done");
|
| |
if (res.code == 'OK'){
|
| |
+ var first_item = true;
|
| |
for (branch in res.message.new_branch){
|
| |
- var url = "{{ url_for(
|
| |
+ if (first_item){
|
| |
+ $("#PR-dropdown").prepend("<div class='dropdown-divider'></div>")
|
| |
+ first_item = false;
|
| |
+ }
|
| |
+ var url = "{{ url_for(
|
| |
'ui_ns.new_request_pull',
|
| |
repo=repo.name,
|
| |
- username=g.fas_user.username,
|
| |
+ username=repo.user.user if repo.is_fork else None,
|
| |
namespace=repo.namespace,
|
| |
branch_to='',
|
| |
branch_from='') }}";
|
| |
url = url.slice(0, -2) + res.message.new_branch[branch]['target_branch'] + '..' + branch;
|
| |
- html = '<a class="dropdown-item" \
|
| |
- href="' + url + '">From <span class="badge badge-secondary" style="font-size:0.9em;">'
|
| |
- + '<i class="fa fa-code-fork fa-fw"> </span> '
|
| |
- +'{{ g.fas_user.username }}/{{ repo.name }}</span> '
|
| |
- +'<span class="badge badge-secondary" style="font-size:0.9em;">'
|
| |
- +'<span class="fa fa-random"> </span> '
|
| |
- + branch + '</span></a> ';
|
| |
+ html = '<a class="dropdown-item" href="' + url + '">'
|
| |
+ + '<span class="badge badge-light badge-pill border border-secondary font-size-1">'
|
| |
+ + ' <i class="fa fa-calendar-o fa-rotate-270 fa-fw"></i> '
|
| |
+ + '{{ repo.name }}'
|
| |
+ + '</span> '
|
| |
+ + '<span class="badge badge-secondary border border-secondary badge-pill font-size-1">'
|
| |
+ + '<span class="fa fa-random fa-fw"> </span> '
|
| |
+ + branch
|
| |
+ + '</span></a> ';
|
| |
$("#PR-dropdown").prepend(html);
|
| |
}
|
| |
}
|
| |
}
|
| |
});
|
| |
});
|
| |
+ {% endif %}
|
| |
|
| |
- {% if g.authenticated and g.repo_committer %}
|
| |
$(function() {
|
| |
$.ajax({
|
| |
url: '{{ url_for("internal_ns.get_pull_request_ready_branch") }}' ,
|
| |
type: 'POST',
|
| |
data: {
|
| |
- repo: "{{ repo.name }}",
|
| |
namespace: "{{ repo.namespace if repo.namespace }}",
|
| |
- repouser: "",
|
| |
+ repo: "{{ repo.name }}",
|
| |
+ repouser: "{{ g.fas_user.username }}",
|
| |
csrf_token: "{{ g.confirmationform.csrf_token.current_token }}",
|
| |
},
|
| |
dataType: 'json',
|
| |
error: function(res) {
|
| |
- console.log(res);
|
| |
+ $('#spinnergif').hide()
|
| |
+ console.log(res);
|
| |
},
|
| |
success: function(res) {
|
| |
+ $('#spinnergif').hide()
|
| |
console.log("done");
|
| |
if (res.code == 'OK'){
|
| |
+ var first_item = true;
|
| |
for (branch in res.message.new_branch){
|
| |
+ if (first_item){
|
| |
+ $("#PR-dropdown").prepend("<div class='dropdown-divider'></div>");
|
| |
+ first_item = false;
|
| |
+ }
|
| |
var url = "{{ url_for(
|
| |
'ui_ns.new_request_pull',
|
| |
repo=repo.name,
|
| |
- username=repo.user.user if repo.is_fork else None,
|
| |
+ username=g.fas_user.username,
|
| |
namespace=repo.namespace,
|
| |
branch_to='',
|
| |
branch_from='') }}";
|
| |
url = url.slice(0, -2) + res.message.new_branch[branch]['target_branch'] + '..' + branch;
|
| |
- html = '<a class="dropdown-item" href="' + url + '">'
|
| |
- + 'From <span class="badge badge-secondary" style="font-size:0.9em;">'
|
| |
- + ' <i class="fa fa-calendar-o fa-rotate-270 fa-fw"></i> '
|
| |
- + '{{ repo.name }}'
|
| |
- + '</span> '
|
| |
- + '<span class="badge badge-secondary" style="font-size:0.9em;">'
|
| |
- + '<span class="fa fa-random fa-fw"> </span> '
|
| |
- + branch
|
| |
- + '</span></a> ';
|
| |
+ html = '<a class="dropdown-item" \
|
| |
+ href="' + url + '"><span class="badge badge-light badge-pill border border-secondary font-size-1">'
|
| |
+ + '<i class="fa fa-code-fork fa-fw"></i>'
|
| |
+ +'{{ g.fas_user.username }}/{{ repo.name }}</span> '
|
| |
+ +'<span class="badge badge-secondary border border-secondary badge-pill font-size-1">'
|
| |
+ +'<i class="fa fa-random"></i> '
|
| |
+ + branch + '</span></a> ';
|
| |
$("#PR-dropdown").prepend(html);
|
| |
}
|
| |
}
|
| |
}
|
| |
});
|
| |
});
|
| |
- {% endif %}
|
| |
+
|
| |
{% endif %}
|
| |
</script>
|
| |
{% endblock %}
|
| |
Fixes the weird rendering of the labels in the
New PR dropdown when listing branches from Forks
Fixes #3376
This also styles up the labels to be the same as
in the PR page.