From 2aa95c7e38d4588a4e7d50eff84b32dbe4791002 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jun 24 2018 11:48:30 +0000 Subject: update pull request page updates the style of the pull request page Signed-off-by: Ryan Lerch --- diff --git a/pagure/default_config.py b/pagure/default_config.py index 8701134..e828816 100644 --- a/pagure/default_config.py +++ b/pagure/default_config.py @@ -341,11 +341,11 @@ EXCLUDE_GROUP_INDEX = [] TRIGGER_CI = ['pretty please pagure-ci rebuild'] FLAG_STATUSES_LABELS = { - 'success': 'label-success', - 'failure': 'label-danger', - 'error': 'label-danger', - 'pending': 'label-info', - 'canceled': 'label-warning', + 'success': 'badge-success', + 'failure': 'badge-danger', + 'error': 'badge-danger', + 'pending': 'badge-info', + 'canceled': 'badge-warning', } FLAG_SUCCESS = 'success' FLAG_FAILURE = 'failure' diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index 91638fe..f2a026c 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -181,10 +181,8 @@ white-space: nowrap; #preview { - min-height: 16rem; - background:#efefef; + min-height: 12rem; padding:1em; - border:1px solid #aaa; } .form-control#initial_comment @@ -598,10 +596,6 @@ th[data-sort] { cursor: pointer; } -.pr-changes-description -{ - font-size: 0.8em; -} .readme dd{ margin-left:2em; @@ -808,3 +802,17 @@ a.nav-link.btn{ .progress-bar{ height: inherit; } + +.text-semimuted{ + color:#555!important; +} + +.font-size-09{ + font-size:0.9em; +} + +.autogenerated-comment p{ + margin-bottom:0; +} + + diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index 86f08a7..2e35fe3 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -108,21 +108,74 @@ {% macro show_comment(comment, id, repo, username, issueid, form) %} -
-
- {{ comment.user.default_email | avatar(16) | safe }} - - {{ comment.user.user }} - - - {{ comment.date_created | humanize}} - +
+
+
+ {{ comment.user.default_email | avatar(24) | safe }} + + {{ comment.user.user }} + + + commented {{ comment.date_created | humanize}} + +
+
+
+
+ + {% if id != 0 and g.fas_user %} + {% if config.get('REACTIONS') %} + + {% endif %} + {% endif%} + + + {% if g.fas_user %} + + + + {% endif %} + {% if id != 0 and g.fas_user and (g.repo_committer or ( + comment.parent.status in [True, 'Open'] + and g.fas_user.username == comment.user.username)) %} + + + + {% endif %} + {% if id != 0 and g.fas_user and (g.repo_committer or ( + comment.parent.status in [True, 'Open'] + and g.fas_user.username == comment.user.username)) %} + + {% endif %} +
+
+
-
+
- {% if comment.edited_on %} - Edited {{ comment.edited_on | humanize }} by {{ comment.editor.username }} - {% endif %} -
-
- {% for r in comment.reactions | sort %} - - {% endfor %} -
+
+ {% endmacro %} diff --git a/pagure/templates/commit.html b/pagure/templates/commit.html index 4249650..875a62f 100644 --- a/pagure/templates/commit.html +++ b/pagure/templates/commit.html @@ -134,7 +134,7 @@ {{ flag.username }}
- + {{- flag.status -}} {%- if flag.percent %} ({{ flag.percent }}%) {%- endif -%} diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 2f74375..682fd85 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -1,5 +1,5 @@ {% extends "repo_master.html" %} -{% from "_formhelper.html" import show_comment, render_bootstrap_field %} +{% from "_formhelper.html" import show_comment, show_pr_initial_comment, render_bootstrap_field %} {% block title %} {%- if pull_request -%} @@ -26,127 +26,222 @@ {% endblock %} {% block repo %} -
-
{% if pull_request %} -

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

+
+ {% if pull_request.status == 'Open' %} + + #{{requestid}} + {% elif pull_request.status == 'Merged' %} + + #{{requestid}} + {% elif pull_request.status == 'Closed' %} + + #{{requestid}} + {% endif %} + + {{ pull_request.title | noJS(ignore="img") | safe}} + + {% if g.authenticated and (g.fas_user.username == pull_request.user.username + or g.repo_committer) and pull_request.status == 'Open'%} + + {% endif %} +
+
+ + {% if pull_request.status == 'Open' %} + + Opened {{ pull_request.date_created |humanize }} + + by {{ pull_request.user.user }}. + + Modified {{ pull_request.last_updated |humanize }} + + {% elif pull_request.status == 'Merged' %} + + Merged {{ pull_request.closed_at |humanize }} + + by + {{ pull_request.user.user }}. + + Opened {{ pull_request.date_created |humanize }} + + by {{ pull_request.user.user }}. + {% elif pull_request.status == 'Closed' %} + + Cancelled {{ pull_request.closed_at |humanize }} + + by + {{ pull_request.user.user }}. + + Opened {{ pull_request.date_created |humanize }} + + by {{ pull_request.user.user }}. + {% endif %} + +
+
+ + {% if pull_request.remote_git or pull_request.project_from.is_fork %} + + {% if pull_request.remote_git %} + + {{pull_request.remote_git}} + {% elif pull_request.project_from.is_fork %} + + {% if pull_request.project_from.namespace %} + {{pull_request.project_from.namespace}}/ + {% endif %} + {% if pull_request.project_from.is_fork -%} + {{ pull_request.project_from.user.user }}/ + {%- endif -%} + {{pull_request.project_from.name}} + {% endif %} + + {% endif %} + + + {{ pull_request.branch_from }} + +  into  + + + {{ pull_request.branch }} + + +
+ + +

+
+ {% if g.authenticated and (g.fas_user.username == pull_request.user.username + or g.repo_committer) and pull_request.status == 'Open'%} + {% if pull_request.status == 'Open' and g.authenticated and + (g.repo_committer or g.fas_user.username == pull_request.user.username) %} + {% if mergeform and pull_request.remote %} + + + {{ mergeform.csrf_token }} + + {% endif %} + +
+ {% endif %} + + {% if pull_request.status == 'Open' and g.authenticated and + (g.repo_committer or g.fas_user.username == pull_request.user.username) %} + {{ mergeform.csrf_token }} + + {% endif %} + {% if pull_request.status == 'Open' and g.authenticated and + (g.repo_committer or g.fas_user.username == pull_request.user.username) %}
{% endif %} + {% endif %} + {% if pull_request.status == 'Open' %} + +
+ {% endif %} + {% if pull_request.status == 'Closed' and g.authenticated and + (g.repo_committer or g.fas_user.username == pull_request.user.username) %} +
- {% endif %} -
- - {% if pull_request.status == 'Open' and g.authenticated and - (g.repo_committer or g.fas_user.username == pull_request.user.username) %} - {{ mergeform.csrf_token }} - - {% endif %} -
- {% if pull_request.status == 'Open' and g.authenticated and - (g.repo_committer or g.fas_user.username == pull_request.user.username) %} + {{ mergeform.csrf_token }} +
- {% endif %} - - {% endif %} -

- -
- Proposed {{ pull_request.date_created |humanize }} - by {{ pull_request.user.default_email | avatar(16) | safe - }} {{ pull_request.user.user }} -
-
- Modified {{ pull_request.last_updated |humanize }} -
- - 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 and pull_request.initial_comment %} -
-
-{{ pull_request.initial_comment | markdown | noJS | safe }} + {% endif %} +
-
-{%endif%} {% elif form and (g.repo_committer or remote_git) %}

Create pull request

{% else %}

Diff - (tree)

+ (tree) - {% if origin == 'compare_commits' %} -
{{ commit1 }} .. {{ commit2 }}
- {% endif %} + {% if origin == 'compare_commits' %} +
{{ commit1 }} .. {{ commit2 }}
+ {% endif %} +{% endif%} -{% endif %} + +
+
{% if form and (g.repo_committer or remote_git) %}
@@ -293,38 +388,62 @@ {% for commit in diff_commits %} {% if pull_request and pull_request.status and pull_request.project_from.is_fork %} - + {% set commit_link = url_for( + 'ui_ns.view_commit', + repo=pull_request.project_from.name, + username=pull_request.project_from.user.user, + namespace=repo.namespace, + commitid=commit.oid.hex)%} + {% set tree_link = url_for( + 'ui_ns.view_tree', username=pull_request.project_from.user.user, namespace=repo.namespace, + repo=repo.name, identifier=commit.hex) %} {% elif pull_request and pull_request.remote %} - + {% set commit_link = None %} {% else %} - + commitid=commit.oid.hex) %} + {% set tree_link = url_for( + 'ui_ns.view_tree', username=username, namespace=repo.namespace, + repo=repo.name, identifier=commit.hex) %} {% endif %} - -
- {{ commit.message.strip().split('\n')[0] }} -
- - {{ commit.commit_time|humanize }} - +
+
+
+ {% if commit_link %} + + {% endif %} + {{ commit.message.strip().split('\n')[0] }} + {% if commit_link %} + + {% endif %} +
+ {{commit.author|author2user_commits( + link=url_for('ui_ns.view_commits', + repo=repo.name, + branchname=branchname, + username=username, + namespace=repo.namespace, + author=commit.author.email), + cssclass="notblue")|safe}} + • + {{ commit.commit_time|humanize }}   +
-
- {{ commit.author | author2avatar(20) | safe }} {{ commit.author.name }} -
- {{ commit.hex|short }} -
- + +
+
{% else %}

No commits found

{% endfor %} @@ -387,10 +506,10 @@ {% macro lineschanged(added, removed) -%} {%if added%} - +{{linesadded}} + +{{linesadded}} {%endif%} {%if removed%} - -{{linesremoved}} + -{{linesremoved}} {%endif%} {%endmacro%} @@ -557,6 +676,7 @@
+ {{ show_pr_initial_comment(pull_request, repo, form, username) }}
{% if pull_request.comments %}
-
-
-
- {{ - comment.date_created | humanize }} -
- {{ comment.comment | markdown | noJS | safe }} -
+
+
+ {{ comment.user.default_email | avatar(24) | safe }} +
+ {{ comment.comment | markdown | noJS | safe }} +
+ {{ + comment.date_created | humanize }}
{% else %} @@ -609,55 +728,55 @@
{% if g.authenticated and mergeform and pull_request %} -
-
- -
- - {% if g.authenticated %} - - {{ mergeform.csrf_token }} +
+ {% if g.authenticated %} -
- - - Preview - - +
+
+
+ Add new comment +
+
+ {% if repo.quick_replies %} {% include "quick_reply.html" %} {% endif %} +
+
+
+ + {{ mergeform.csrf_token }} +
-
+
+ + - Markdown Syntax -
- -
- - {% else %} -

- - Login - to comment on this ticket. -

{% endif %} -
- -
-
+
{% if pull_request %}

Pull this pull-request locally v

@@ -670,89 +789,20 @@
{% if pull_request %} -
- -
+
{% endif %} {% if diff and pull_request%} -
-
-
Changes summary
-
+
+
+
+ Changes Summary + {{ diff|length if diff else 0}} +
+
{% macro changeschangedfile(filepath, added, removed, diffanchor) -%} -
-
- +{{added}} - -{{removed}} + +
+
+ +{{added}} + -{{removed}}
file changed
- {{filepath}} + {{filepath}}
+ {%- endmacro %} {% macro changesrenamedfile(oldfilepath, newfilepath, added, removed, diffanchor) -%} -
-
+{{added}} -{{removed}}
+ +
+
+{{added}} -{{removed}}
file renamed
+ {%- endmacro %} {% macro changesdeletedfile(filepath, added, removed, diffanchor) -%} -
-
-{{removed}}
+ +
+
-{{removed}}
file removed
- {{filepath}} + {{filepath}}
+ {%- endmacro %} {% macro changesaddedfile(filepath, added, removed, diffanchor) -%} -
-
+{{added}}
+ +
+
+{{added}}
file added
- {{filepath}} + {{filepath}}
+ {%- endmacro %}
{% set count = 0 %} {% for patch in diff %} {% set count = count+1 %} -
{% set linesadded = patch.line_stats[1] %} {% set linesremoved = patch.line_stats[2] %} {% if patch | hasattr('new_file_path') %} @@ -930,7 +1030,6 @@ {{changesrenamedfile(patch.delta.old_file.path, patch.delta.new_file.path, linesadded, linesremoved, count)}} {%- endif -%} {%- endif -%} -
{% endfor %}
@@ -1053,7 +1152,7 @@ function setup_reply_btns() { $(".reply").unbind(); $( ".reply" ).click( function() { - var _section = $(this).closest('.card-body'); + var _section = $(this).closest('.card'); var _comment = _section.find('.comment_body'); var _text = _comment.text().split("\n"); var _output = new Array(); @@ -1079,35 +1178,51 @@ function show_merge_status(){ function process_response(res) { $('#spinner').hide(); if (res.code == 'FFORWARD'){ + $('#merge_dropdown_btn').toggleClass("btn-outline-secondary btn-success"); + $('#merge_dropdown_btn').removeClass("disabled"); + $('#merge_dropdown_btn span.fa').toggleClass("fa-circle-o-notch fa-check"); + $('#merge_dropdown_btn span.fa').removeClass("fa-spin"); $('#merge_btn').addClass("btn-success"); - $('#merge-alert').addClass("alert-success"); + $('#merge-alert .alert').addClass("alert-success"); $('#merge-alert-message').append(res.message); - $('#merge-alert').show(); } else if (res.code == 'MERGE') { + $('#merge_dropdown_btn').toggleClass("btn-outline-secondary btn-warning"); + $('#merge_dropdown_btn').removeClass("disabled"); + $('#merge_dropdown_btn span.fa').toggleClass("fa-circle-o-notch fa-check"); + $('#merge_dropdown_btn span.fa').removeClass("fa-spin"); $('#merge_btn').addClass("btn-warning"); - $('#merge-alert').addClass("alert-warning"); + $('#merge-alert .alert').addClass("alert-warning"); $('#merge-alert-message').append(res.message); - $('#merge-alert').show(); } else if (res.code == 'CONFLICTS') { + $('#merge_dropdown_btn').toggleClass("btn-outline-secondary btn-danger"); + $('#merge_dropdown_btn').removeClass("disabled"); + $('#merge_dropdown_btn span.fa').toggleClass("fa-circle-o-notch fa-times"); + $('#merge_dropdown_btn span.fa').removeClass("fa-spin"); $('#merge_btn').hide(); - $('#merge-alert').addClass("alert-danger"); + $('#merge-alert .alert').addClass("alert-danger"); $('#merge-alert-message').append(res.message); - $('#merge-alert').show(); $('#merge-alert div.small').hide(); } else if (res.code == 'NO_CHANGE') { $('#merge_btn').hide(); - $('#merge-alert').addClass("alert-info"); + $('#merge_dropdown_btn').removeClass("disabled"); + $('#merge_dropdown_btn span.fa').toggleClass("fa-circle-o-notch fa-times"); + $('#merge_dropdown_btn span.fa').removeClass("fa-spin"); + $('#merge-alert .alert').addClass("alert-secondary"); $('#merge-alert-message').append(res.message); - $('#merge-alert').show(); $('#merge-alert div.small').hide(); } }; $('#spinner').show(); + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + $.ajax({ url: '{{ url_for("internal_ns.mergeable_request_pull") }}' , + beforeSend: function(){sleep(8000); return true;}, type: 'POST', data: { requestid: "{{ pull_request.uid }}", @@ -1557,7 +1672,6 @@ $(document).ready(function () { var _token = "{{ mergeform.csrf_token.current_token }}"; {% endif %} - if ($( "#previewinmarkdown" ).hasClass("inactive")){ var _text = _el.val(); var _url = "{{ url_for('ui_ns.markdown_preview') }}"; $.ajax({ @@ -1571,9 +1685,8 @@ $(document).ready(function () { success: function(res) { var preview = emojione.toImage(res); $( "#preview" ).html(preview); - $( "#previewinmarkdown" ).removeClass("inactive"); - $( "#previewinmarkdown" ).addClass("active"); - $( "#previewinmarkdown" ).text("Edit"); + $( "#previewinmarkdown" ).toggleClass("active"); + $( "#editinmarkdown" ).toggleClass("active"); _el.hide(); $( "#preview" ).show(); }, @@ -1582,13 +1695,23 @@ $(document).ready(function () { } }); return false; - } else if ($( "#previewinmarkdown" ).hasClass("active")){ - $( "#previewinmarkdown" ).addClass("inactive"); - $( "#previewinmarkdown" ).removeClass("active"); - $( "#previewinmarkdown" ).text("Preview"); - _el.show(); - $( "#preview" ).hide(); - } + } + ); + + $( "#editinmarkdown" ).click( + function(event, ui) { + {% if form %} + var _el = $( "#initial_comment" ); + var _token = "{{ form.csrf_token.current_token }}"; + {% else %} + var _el = $( "#comment" ); + var _token = "{{ mergeform.csrf_token.current_token }}"; + {% endif %} + + $( "#editinmarkdown" ).toggleClass("active"); + $( "#previewinmarkdown" ).toggleClass("active"); + _el.show(); + $( "#preview" ).hide(); } ); {% endif %} diff --git a/pagure/templates/quick_reply.html b/pagure/templates/quick_reply.html index a75f6a7..8a2140d 100644 --- a/pagure/templates/quick_reply.html +++ b/pagure/templates/quick_reply.html @@ -1,5 +1,5 @@ -
-