Blob Blame Raw
{% extends "repo_master.html" %}
{% from "_repo_renderdiff.html" import repo_renderdiff %}

{% block title -%}
    Diff from {{ commit1 }} to {{ commit2 }} - {{ repo.url_path }}
{% endblock %}

{% set tag = "home" %}

{% block header %}
<link type="text/css" rel="stylesheet" nonce="{{ g.nonce }}" href="{{
  url_for('static', filename='vendor/emojione/emojione.sprites.css') }}?version={{ g.version}}"/>
<link type="text/css" rel="stylesheet" nonce="{{ g.nonce }}" href="{{
  url_for('static', filename='vendor/selectize/selectize.bootstrap3.css') }}?version={{ g.version}}"/>
<link type="text/css" rel="stylesheet" nonce="{{ g.nonce }}" href="{{url_for('static', filename='vendor/jquery.atwho/jquery.atwho.css') }}?version={{ g.version}}"/>
{% endblock %}

{% block repo %}
<div class="row">
  <div class="col">
    {% block overviewtabs %}{{ super() }}{% endblock %}
  </div>
  <div class="col-10">
    <h4 class="font-weight-bold mb-4">
      <div class="d-flex align-items-center">
        <div>
          Commit Diff
        </div>
        <div class="ml-auto">
          <div class="btn btn-outline-secondary border-0 disabled opacity-100 font-weight-bold">
            {{diff.stats.files_changed}} file{{'s' if diff.stats.files_changed > 1 }} changed
          </div>
        </div>
        <div class="btn-group">
          <span class="font-weight-bold btn btn-sm btn-success disabled opacity-100">+{{diff.stats.insertions}}</span>
          <span class="font-weight-bold btn btn-sm btn-danger disabled opacity-100">-{{diff.stats.deletions}}</span>
        </div>
      </div>
      <div>
        <span class="badge-light border border-secondary badge">{{ commit1 }}</span>
        ..
        <span class="badge-light border border-secondary badge">{{ commit2 }}</span>
      </div>
    </h4>
    <div class="list-group mb-5">
    {% 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 %}
        {% set commit_link = url_for('ui_ns.view_commit',
                  repo=repo.name,
                  username=username,
                  namespace=repo.namespace,
                  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 %}
      {% if not loop.last and loop.index == 2 %}
        <div class="list-group-item text-center bg-light" id="show_hidden_commits">
          <a class="pointer">{{diff_commits|length - 2}} more commits...</a>
        </div>
      {% endif %}
      {% if loop.first or loop.last%}
        <div class="list-group-item">
      {% else %}
        <div class="list-group-item hidden commitline">
      {%endif%}
      <div class="row align-items-center">
        <div class="col">
        {% if commit_link %}
          <a class="notblue" href="{{commit_link}}">
        {% endif %}
          <strong>{{ commit.message.strip().split('\n')[0] }}</strong>
        {% if commit_link %}
          </a>
        {% endif %}
        <div>
                {{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}}
                  <span class="commitdate"
                  title="{{ commit.commit_time|format_ts }}"> &bull;
                {{ commit.commit_time|humanize }}</span>&nbsp;&nbsp;
            </div>
          </div>
          <div class="col-xs-auto pr-3 text-right">
              <div class="btn-group">
                <a href="{{ commit_link }}"
                  class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}}">
                  <code>{{ commit.hex|short }}</code>
                </a>
                <a class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}}" href="{{tree_link}}"><span class="fa fa-file-code-o fa-fw"></span></a>
              </div>
            </div>
      </div>
      </div>
      {% endfor %}
      </div>
      <div class="row" id="pr-wrapper">
        <div class="col-md-12">
        <div>

          {{repo_renderdiff(diff=diff,
                            diff_commits=diff_commits,
                            pull_request=None,
                            repo=repo,
                            username=username,
                            namespace=namespace)}}

        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}

{% block jscripts %}
{{ super() }}
<script type="text/javascript" nonce="{{ g.nonce }}">

$(document).ready(function () {
  $('#show_hidden_commits a').click(function(e){
    $(".commitline.hidden").show();
    $('#show_hidden_commits').hide();
  });
});

</script>

{% endblock %}