Blame progit/templates/pull_request.html

Pierre-Yves Chibon 706f31
{% extends "repo_master.html" %}
Pierre-Yves Chibon 7732a9
{% from "_formhelper.html" import render_field_in_row %}
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon f67de7
{% block title %}Pull request #{{ requestid }} - {{ repo.name }}{% endblock %}
Pierre-Yves Chibon 006f93
{%block tag %}home{% endblock %}
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon 706f31
{% block repo %}
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon 006f93

Request pull

Pierre-Yves Chibon ea8735
  
Pierre-Yves Chibon 006f93
    {{ repo.name }}
Pierre-Yves Chibon 006f93
  
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon ea8735
  (
Pierre-Yves Chibon 006f93
               repo=repo.name, identifier=commitid) }}"
Pierre-Yves Chibon 006f93
    >tree)
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon 006f93
Pierre-Yves Chibon 87ba70
{% if pull_request %}
Johan Cwiklinski d22157
Johan Cwiklinski d22157
    

Title: {{ pull_request.title }}

Johan Cwiklinski d22157
    
    Pierre-Yves Chibon 87ba70
      {% if pull_request.status and repo_admin %}
    Johan Cwiklinski d22157
          
  • Pierre-Yves Chibon 7c99eb
            
    Pierre-Yves Chibon 7c99eb
                repo=repo.name, requestid=requestid) }}" method="POST">
    Pierre-Yves Chibon 7c99eb
              {{ mergeform.csrf_token }}
    Pierre-Yves Chibon 7c99eb
              <input class="button" type="submit" value="Merge">
    Pierre-Yves Chibon 7c99eb
            
    Pierre-Yves Chibon 7c99eb
          
    Pierre-Yves Chibon 7c99eb
          
  • Pierre-Yves Chibon 7c99eb
            
    Pierre-Yves Chibon 7c99eb
                repo=repo.name, requestid=requestid) }}" method="POST">
    Pierre-Yves Chibon 7c99eb
              {{ mergeform.csrf_token }}
    Pierre-Yves Chibon 62d7d5
              <input class="button" id="cancel_pr" type="submit" value="Close">
    Pierre-Yves Chibon 7c99eb
            
    Pierre-Yves Chibon 7c99eb
          
    Pierre-Yves Chibon 87ba70
      {% elif pull_request and pull_request.status == False %}
    Johan Cwiklinski d22157
        
  • Pierre-Yves Chibon 7c99eb
          Merged
    Johan Cwiklinski d22157
        
    Pierre-Yves Chibon 706f31
      {% endif %}
    Pierre-Yves Chibon 7c99eb
          
  • Pierre-Yves Chibon 7c99eb
            
    Pierre-Yves Chibon 7c99eb
                repo=repo.name, requestid=requestid) }}">Patch
    Pierre-Yves Chibon 7c99eb
          
    Johan Cwiklinski d22157
        
    Johan Cwiklinski d22157
    Pierre-Yves Chibon 7732a9
    {% endif %}
    Pierre-Yves Chibon 7732a9
    Pierre-Yves Chibon 7732a9
    {% if form %}
    Pierre-Yves Chibon 7732a9
    <section class="new_project"></section>
    Pierre-Yves Chibon 7732a9
      
    Pierre-Yves Chibon 62d7d5
        repo=repo.name, commitid=commitid, branch_from=branch_from,
    Pierre-Yves Chibon 62d7d5
        branch_to=branch_to) }}" method="post">
    Pierre-Yves Chibon 7732a9
        
    Pierre-Yves Chibon 7732a9
          {{ render_field_in_row(form.title) }}
    Pierre-Yves Chibon 071f09
          
    Pierre-Yves Chibon 071f09
            To branch
    Pierre-Yves Chibon 071f09
            
    Pierre-Yves Chibon 62d7d5
              <select id="branch_select" name="branch_to"></select>
    Pierre-Yves Chibon 62d7d5
                  <option>{{ branch_to }}</option>
    Pierre-Yves Chibon 071f09
                {% for branch in branches |reverse %}
    Pierre-Yves Chibon 62d7d5
                  {% if branch != branch_to %}
    Pierre-Yves Chibon 071f09
                  <option>{{ branch }}</option>
    Pierre-Yves Chibon 071f09
                  {% endif %}
    Pierre-Yves Chibon 071f09
                {% endfor %}
    Pierre-Yves Chibon 071f09
              
    Pierre-Yves Chibon 071f09
            
    Pierre-Yves Chibon 071f09
          
    Pierre-Yves Chibon 7732a9
        
    Pierre-Yves Chibon 7732a9
        

    Pierre-Yves Chibon 7732a9
          <input class="submit positive button" type="submit" value="Create">
    Pierre-Yves Chibon 7732a9
          {{ form.csrf_token }}
    Pierre-Yves Chibon 856159
          
    Pierre-Yves Chibon 856159
            <input type="button" value="Cancel">
    Pierre-Yves Chibon 856159
          
    Pierre-Yves Chibon 7732a9
        

    Pierre-Yves Chibon 7732a9
      
    Pierre-Yves Chibon 7732a9
    Pierre-Yves Chibon 7732a9
    {% endif %}
    Pierre-Yves Chibon 7732a9
    Pierre-Yves Chibon 7c99eb
    <section class="commit_list"></section>
    Pierre-Yves Chibon 7c99eb
      
      Pierre-Yves Chibon 7c99eb
          {% for commit in diff_commits %}
      Pierre-Yves Chibon 7c99eb
          
    • Pierre-Yves Chibon 7c99eb
          {% if pull_request and pull_request.status and pull_request.repo_from.is_fork %}
      Pierre-Yves Chibon 7c99eb
            
      Pierre-Yves Chibon 7c99eb
                        repo=pull_request.repo_from.name, commitid=commit.oid.hex)}}">
      Pierre-Yves Chibon 7c99eb
          {% else %}
      Pierre-Yves Chibon 7c99eb
            
      Pierre-Yves Chibon 7c99eb
                        repo=repo.name, commitid=commit.oid.hex)}}">
      Pierre-Yves Chibon 7c99eb
          {% endif %}
      Pierre-Yves Chibon 7c99eb
              {{ commit.oid.hex|short }}
      Pierre-Yves Chibon 7c99eb
              {{ commit.message.split('\n')[0] }}
      Pierre-Yves Chibon 7c99eb
            
      Pierre-Yves Chibon 7c99eb
          
      Pierre-Yves Chibon 87d2ff
          {% else %}
      Pierre-Yves Chibon 87d2ff
            

      No commits found

      Pierre-Yves Chibon 7c99eb
          {% endfor %}
      Pierre-Yves Chibon 7c99eb
        
      Pierre-Yves Chibon 7c99eb
      Pierre-Yves Chibon 7c99eb
      Pierre-Yves Chibon 62d7d5
      <section class="request_diff"></section>
      Pierre-Yves Chibon 62d7d5
      Johan Cwiklinski d22157
      Pierre-Yves Chibon 62d7d5
      {% if diff %}
      Pierre-Yves Chibon 3ca310
      {% for patch in diff %}
      Pierre-Yves Chibon 8ca3eb
      <section class="commit_diff"></section>
      Pierre-Yves Chibon 8ca3eb
      <header></header>
      Pierre-Yves Chibon 8ca3eb
          

      {{ patch.new_file_path }}

      Pierre-Yves Chibon 8ca3eb
          
        Pierre-Yves Chibon 8ca3eb
              
      • Pierre-Yves Chibon 3ca310
              {% if (patch.additions + patch.deletions) %}
        Pierre-Yves Chibon 3ca310
                
        Pierre-Yves Chibon 8ca3eb
                  {% if patch.additions > 0 %}+{{ patch.additions }}{% endif %}
        Pierre-Yves Chibon 8ca3eb
                  {% if patch.deletions > 0 %}-{{ patch.deletions }}{% endif %}
        Pierre-Yves Chibon 3ca310
                
        Pierre-Yves Chibon 3ca310
              {% endif %}
        Pierre-Yves Chibon 8ca3eb
              
        Pierre-Yves Chibon 8ca3eb
              
      • Pierre-Yves Chibon e234e6
                {% if pull_request %}
        Pierre-Yves Chibon 8ca3eb
                
        Pierre-Yves Chibon 8ca3eb
                    url_for(
        Pierre-Yves Chibon 7a61c1
                        'view_file',
        Pierre-Yves Chibon 7a61c1
                        username=pull_request.repo_from.user.username,
        Pierre-Yves Chibon 7a61c1
                        repo=pull_request.repo_from.name,
        Pierre-Yves Chibon 7a61c1
                        identifier=pull_request.branch_from,
        Pierre-Yves Chibon 8ca3eb
                        filename=patch.new_file_path) }}"
        Pierre-Yves Chibon e234e6
                {% else %}
        Pierre-Yves Chibon e234e6
                
        Pierre-Yves Chibon e234e6
                    url_for(
        Pierre-Yves Chibon e234e6
                        'view_file',
        Pierre-Yves Chibon e234e6
                        username=username,
        Pierre-Yves Chibon e234e6
                        repo=repo.name,
        Pierre-Yves Chibon e234e6
                        identifier=branch_from,
        Pierre-Yves Chibon e234e6
                        filename=patch.new_file_path) }}"
        Pierre-Yves Chibon e234e6
                {% endif %}
        Pierre-Yves Chibon 8ca3eb
                title="View file as of {{ patch.new_id|short }}">View
        Pierre-Yves Chibon 8ca3eb
              
        Pierre-Yves Chibon 8ca3eb
            
        Pierre-Yves Chibon 8ca3eb
        Pierre-Yves Chibon 62d7d5
        {% autoescape false %}
        Pierre-Yves Chibon 3ca310
            {{ patch | patch_to_diff | html_diff | format_loc(
        Pierre-Yves Chibon 6f8e9d
                    filename=patch.new_file_path,
        Pierre-Yves Chibon 6f8e9d
                    commit=patch.new_id,
        Pierre-Yves Chibon 6f8e9d
                    prequest=pull_request,
        Pierre-Yves Chibon 6f8e9d
                    index=loop.index)}}
        Pierre-Yves Chibon 62d7d5
        {% endautoescape %}
        Pierre-Yves Chibon 3ca310
        {% endfor %}
        Pierre-Yves Chibon 62d7d5
        {% endif %}
        Johan Cwiklinski d22157
        Johan Cwiklinski d22157
        Johan Cwiklinski d22157
        Pierre-Yves Chibon 62d7d5
        Pierre-Yves Chibon 267613
        {% endblock %}
        Pierre-Yves Chibon 267613
        Pierre-Yves Chibon 267613
        {% block jscripts %}
        Pierre-Yves Chibon 267613
        {{ super() }}
        Pierre-Yves Chibon 267613
        <script type="text/javascript"></script>
        Pierre-Yves Chibon 071f09
         $(function(){
        Pierre-Yves Chibon 071f09
          $( "#branch_select" ).change(
        Pierre-Yves Chibon 071f09
            function() {
        Pierre-Yves Chibon 071f09
              var sel = $('#branch_select');
        Pierre-Yves Chibon 62d7d5
              var final_url = "{{ url_for('.new_request_pull', username=username,
        Pierre-Yves Chibon 62d7d5
                repo=repo.name, commitid=commitid, branch_from=branch_from,
        Pierre-Yves Chibon 62d7d5
                branch_to='--') }}";
        Pierre-Yves Chibon 62d7d5
              final_url = final_url.replace('--', sel.val());
        Pierre-Yves Chibon bc7e3f
              window.location.href = final_url;
        Pierre-Yves Chibon 071f09
            }
        Pierre-Yves Chibon 071f09
          );
        Pierre-Yves Chibon 07f5d3
        {% if pull_request %}
        Pierre-Yves Chibon 07f5d3
        {# These lines are only for existing pull-requests, not new ones #}
        Johan Cwiklinski 86d9c4
          $('#cancel_pr').click(function(){
        Pierre-Yves Chibon 8ca3eb
            return window.confirm("Are you sure you want to close this requested pull?");
        Johan Cwiklinski 86d9c4
          });
        Pierre-Yves Chibon 071f09
         });
        Pierre-Yves Chibon 071f09
        Pierre-Yves Chibon 267613
          function comment() {
        Pierre-Yves Chibon 267613
            $( ".cancel" ).click(
        Pierre-Yves Chibon 267613
              function() {
        Pierre-Yves Chibon 267613
                $(this).parent().parent().parent().parent().remove();
        Pierre-Yves Chibon 267613
              }
        Pierre-Yves Chibon 267613
            );
        Pierre-Yves Chibon 267613
          };
        Pierre-Yves Chibon 267613
        Pierre-Yves Chibon 267613
         $(function(){
        Pierre-Yves Chibon 267613
          $( "tr" ).hover(
        Pierre-Yves Chibon 267613
            function() {
        Pierre-Yves Chibon 267613
              $( this ).find( "img" ).show().width(13);
        Pierre-Yves Chibon 267613
            }, function() {
        Pierre-Yves Chibon 267613
              $( this ).find( "img" ).hide();
        Pierre-Yves Chibon 267613
            }
        Pierre-Yves Chibon 267613
          );
        Pierre-Yves Chibon 267613
        Pierre-Yves Chibon 267613
          $( ".prc" ).click(
        Pierre-Yves Chibon 267613
            function() {
        Pierre-Yves Chibon 267613
              var row = $( this ).attr('data-row');
        Pierre-Yves Chibon 267613
              var commit = $( this ).attr('data-commit');
        Pierre-Yves Chibon 9718ee
              var filename = $( this ).attr('data-filename');
        Pierre-Yves Chibon 267613
              var url = "{{ url_for(
        Pierre-Yves Chibon 267613
                'pull_request_add_comment', username=username, repo=repo.name,
        Pierre-Yves Chibon 9718ee
                requestid=requestid, commit='', filename='', row='') }}".slice(0, -2);
        Pierre-Yves Chibon 9718ee
              url = url + commit + '/' + filename + '/' + row;
        Pierre-Yves Chibon 9738dc
              var rowid = $(this).prev().find('a').attr('id');
        Pierre-Yves Chibon c4550f
              var table = $( this ).parent().parent();
        Pierre-Yves Chibon 9738dc
              var nextid = rowid.replace('_' + row, '_' + (Number(row) + 1));
        Pierre-Yves Chibon 9738dc
              var next_row = table.find('#' + nextid).parent().parent();
        Pierre-Yves Chibon c4550f
              if (next_row.prev().find('.pr_comment_form').length == 0){
        Pierre-Yves Chibon 267613
                $.get( url , function( data ) {
        Pierre-Yves Chibon be1f52
                  next_row.before(
        Pierre-Yves Chibon be1f52
                    '' + data + '' );
        Pierre-Yves Chibon 267613
                  comment();
        Pierre-Yves Chibon 267613
                });
        Pierre-Yves Chibon 55a67c
              } else {
        Pierre-Yves Chibon 8ca3eb
                next_row.prev().find('.pr_comment_form').parent().remove();
        Pierre-Yves Chibon 267613
              }
        Pierre-Yves Chibon 267613
            }
        Pierre-Yves Chibon 267613
          );
        Pierre-Yves Chibon 07f5d3
        {% endif %}
        Pierre-Yves Chibon 267613
        Pierre-Yves Chibon 267613
         });
        Pierre-Yves Chibon 267613
        Pierre-Yves Chibon 006f93
        {% endblock %}