diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index e0eaad4..c2f5387 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -24,39 +24,44 @@ {% block repo %}
-
+
{% if pull_request %}

PR#{{requestid}} {{ pull_request.title | noJS(ignore="img") | safe }}{% if authenticated and (g.fas_user.username == pull_request.user.username or repo_admin) and pull_request.status == 'Open' - %} - ( + edit) {% - endif %}

- -
-
- {% if pull_request.status == 'Open' and repo_admin %} - -
- {{ mergeform.csrf_token }} - -
-
- {% endif %} + title="Update title">edit + {% if pull_request.status == 'Open' and authenticated and (repo_admin or g.fas_user.username == pull_request.user.username) %} - -
{{ mergeform.csrf_token }} - -
-
+ + {% endif %} + + {% endif %} + + +
+ Proposed {{ pull_request.date_created |humanize }} + by {{ pull_request.user.user | avatar(16) | safe }} {{ pull_request.user.user }} +
+ + From + {{ pull_request.project_from.fullname or pull_request.remote_git}} + {{ pull_request.branch_from }} + into + {{ pull_request.project.fullname }} + {{ pull_request.branch }} + +
+
{% if pull_request.status != 'Open' %} {{ pull_request.status }} by @@ -64,12 +69,12 @@ {% endif %} - + {# - + #}
{% elif form and (repo_admin or remote_git) %} @@ -113,40 +118,7 @@ {% endif %} {% endfor %} -
-
- - - - {{ render_bootstrap_field(form.title) }} - - - - - - - - - - - - - - - - - -
From git repo: - {% if remote_git -%} - {{ remote_git }} - {%- else -%} - {{ repo.fullname}} - {%- endif %} -
From branch:{{ branch_from }}
To git repo: - {% if repo.is_fork -%}{{ repo.parent.fullname }}{% - else %}{{ repo.fullname }}{% endif %} -
To branch:{{ branch_to }}

{{ form.csrf_token }} @@ -159,17 +131,260 @@ {% endif %} {% if pull_request %} -

+
+
-
+
+ {% if pull_request.flags %}
+ {% for flag in pull_request.flags %} + + + + + + + {% endfor %} + +
{{ flag.percent }}%{{ flag.username }}{{ flag.comment }} + {{ flag.date_created | humanize }} +
+
+
+ {% endif %} + +
+
+{% endif %} + + + +
+ +
+ + + + + + + {% for commit in diff_commits %} + + + {% if commit.message.strip().split('\n') | length > 1 %} + + {% else %} + + {% endif %} + + + {% else %} + + {% endfor %} + +
{{ commit.oid.hex|short }} + {% if pull_request and pull_request.status and pull_request.project_from.is_fork %} + + {% elif pull_request and pull_request.remote %} + + {% else %} + + {% endif %} + {{ commit.message.strip().split('\n')[0] }} +
+ {{ commit.message.strip().split('\n')[2:] | join('\n') }} +
+
+
more + {{ commit.commit_time|humanize }}
No commits found
+
+ +
+ {% if authenticated and pull_request %} +
+ {% endif %} + + {% if diff %} + {% for patch in diff %} +
+
+
+
+ {%- if patch | hasattr('new_file_path') -%} + {%- if patch.new_file_path == patch.old_file_path -%} + {{ patch.new_file_path }} + {%- else -%} + {{ patch.new_file_path }} (Renamed from "{{ patch.old_file_path }}") + {%- endif -%} + {%- elif patch | hasattr('delta') -%} + {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} + {{ patch.delta.new_file.path }} + {%- else -%} + {{ patch.delta.new_file.path }} (Renamed from "{{ patch.delta.old_file.path }}") + {%- endif -%} + {%- endif -%} + + {% if pull_request %} + View + {% elif patch |hasattr('delta') %} + title="View file as of {{ patch.delta.new_file.id|short }}">View + {% else %} + title="View file as of {{ patch.new_oid|short }}">View + {% endif %} +
+
+
##{{patch}}## + {% autoescape false %} + {{ patch | patch_to_diff | html_diff | format_loc( + filename=patch.new_file_path, + commit=patch.new_id or patch.new_oid, + prequest=pull_request, + index=loop.index)}} + {% endautoescape %} +
+
+
+ {% endfor %} + {% endif %} + + {% if authenticated and pull_request %} + {{ mergeform.csrf_token }} +
+ {% endif %} +
+ {% if pull_request %} +
+
+ {% if pull_request.discussion %} +
+ + {% for comment in pull_request.discussion %} + {% if not comment.commit_id %} + {{ show_comment(comment, comment.id, repo, username, + requestid, form, repo_admin) }} + {% endif %} + {% endfor %} + {{ mergeform.csrf_token }} +
+ {% endif %} +
+ + {% if authenticated and mergeform and pull_request %} +
+
+ +
+ + {% if authenticated %} +
+ {{ mergeform.csrf_token }} + +
+ + + Preview + + + +
+
+
+ +
+ + +
+
+ {% else %} +

Login to comment on this ticket.

+ {% endif %} +
+
+
+ {% endif %} +
+ {% endif %} +
+ +
+ + +
+ {% if pull_request %} +
+ +
+
+ + + + + {# - + #} ')); - if (res.code == 'CONFLICTS' || res.code == 'NO_CHANGE') { - $('#merge_btn').attr("disabled", "disabled"); + if (res.code == 'FFORWARD'){ + $('#merge_btn').addClass("btn-success"); + $('#merge-alert').addClass("alert-success"); + $('#merge-alert-message').append(res.message); + $('#merge-alert').show(); + } + else if (res.code == 'MERGE') { + $('#merge_btn').addClass("btn-warning"); + $('#merge-alert').addClass("alert-warning"); + $('#merge-alert-message').append(res.message); + $('#merge-alert').show(); + } + else if (res.code == 'CONFLICTS') { + $('#merge_btn').hide(); + $('#merge-alert').addClass("alert-danger"); + $('#merge-alert-message').append(res.message); + $('#merge-alert').show(); + } + else if (res.code == 'NO_CHANGE') { + $('#merge_btn').hide(); + $('#merge-alert').addClass("alert-info"); + $('#merge-alert-message').append(res.message); + $('#merge-alert').show(); } }, error: function(res) {
By @@ -208,9 +423,9 @@
Created - {{ pull_request.date_created |humanize }} + {{ pull_request.date_created |humanize }}
Assignee @@ -231,90 +446,7 @@ - - -
- {% if pull_request.flags %} -
-
- - - - - {% for flag in pull_request.flags %} - - - - - - - {% endfor %} - -
{{ flag.percent }}%{{ flag.username }}{{ flag.comment }} - {{ flag.date_created | humanize }} -
-
-
- {% endif %} - -
- -{% endif %} - - - - - -
+ {% endif %} {% if diff %}
@@ -370,142 +502,7 @@
{% endif %} - - - {% if authenticated and pull_request %} -
- {% endif %} - - {% if diff %} - {% for patch in diff %} -
-
-
-
- {%- if patch | hasattr('new_file_path') -%} - {%- if patch.new_file_path == patch.old_file_path -%} - {{ patch.new_file_path }} - {%- else -%} - {{ patch.new_file_path }} (Renamed from "{{ patch.old_file_path }}") - {%- endif -%} - {%- elif patch | hasattr('delta') -%} - {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} - {{ patch.delta.new_file.path }} - {%- else -%} - {{ patch.delta.new_file.path }} (Renamed from "{{ patch.delta.old_file.path }}") - {%- endif -%} - {%- endif -%} - - {% if pull_request %} - View - {% elif patch |hasattr('delta') %} - title="View file as of {{ patch.delta.new_file.id|short }}">View - {% else %} - title="View file as of {{ patch.new_oid|short }}">View - {% endif %} -
-
-
- {% autoescape false %} - {{ patch | patch_to_diff | html_diff | format_loc( - filename=patch.new_file_path, - commit=patch.new_id or patch.new_oid, - prequest=pull_request, - index=loop.index)}} - {% endautoescape %} -
-
-
- {% endfor %} - {% endif %} - - {% if authenticated and pull_request %} - {{ mergeform.csrf_token }} -
- {% endif %} -
- - - {% if pull_request %} -
- {% if pull_request.discussion %} -
- - {% for comment in pull_request.discussion %} - {% if not comment.commit_id %} - {{ show_comment(comment, comment.id, repo, username, - requestid, form, repo_admin) }} - {% endif %} - {% endfor %} - {{ mergeform.csrf_token }} -
- {% endif %} -
- {% endif %} - - {% if authenticated and mergeform and pull_request %} -
-
- -
- - {% if authenticated %} -
- {{ mergeform.csrf_token }} - -
- - - Preview - - - -
-
-
- -
- - -
-
- {% else %} -

Login to comment on this ticket.

- {% endif %} -
- -
- {% endif %} - - {% endblock %} @@ -603,23 +600,6 @@ function setup_reply_btns() { } }); - $( ".nav-item" ).click( - function() { - var header = $( this ).attr('data-id'); - if (header == 'nav-diff') { - $($(this).parent().children()[1]).removeClass('active'); - $(this).addClass('active'); - $('#commit_list').hide(); - $('#request_diff').show(); - } else { - $($(this).parent().children()[0]).removeClass('active'); - $(this).addClass('active'); - $('#request_diff').hide(); - $('#commit_list').show(); - } - } - ); - {% if pull_request %} {# These lines are only for existing pull-requests, not new ones #} @@ -761,11 +741,29 @@ function setup_reply_btns() { }, dataType: 'json', success: function(res) { - var _obj = $('#pr_flags').find('tbody'); - _obj.append($('
PR Status:'+res.short_code+'