Blob Blame History Raw
{% extends "repo_master.html" %}

{% from "_render_repo.html" import pagination_link %}

{% block title %}{{ select.capitalize() }} - {{
    repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
{% set tag = "home" %}

{% block repo %}
  <div class="row m-b-1">
    {% if g.repo_obj and g.repo_obj.is_empty %}
    <div class="col-md-12">
      <div class="alert alert-info" role="alert">
        <p>This repo is brand new!</p>
        <p>There are no commits to this project yet</p>
      </div>
    </div>
    {% else %}
    <div class="col-sm-6">
    <h3>
      Commits <span class="label label-default"> {{number_of_commits}}</span>
    </h3>
    </div>

    <div class="col-sm-6">
      <div class="pull-xs-right">
      <div class="button-label button-label-default">
        {% if repo.is_fork %}
        <span class="oi" data-glyph="fork"></span>
        {{ repo.user.user }}/{{ repo.name }}
        {% else %}
        <span class="oi" data-glyph="document"></span> {{ repo.name }}
        {% endif %}

      </div>
      {% if branchname %}
        <div class="btn-group">
          <button type="button" class="btn btn-secondary btn-sm dropdown-toggle"
                  data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  <span class="oi" data-glyph="random"> </span> {{ branchname }}
          </button>
          <div class="dropdown-menu dropdown-menu-right">
            {% for branch in g.branches %}
                <a class="dropdown-item" href="{{ url_for(
                    'view_commits',
                    repo=repo.name,
                    username=username,
                    namespace=repo.namespace,
                    branchname=branch) }}">
                  {{ branch }}
                </a>
            {% endfor %}
          </div>
        </div>
      {% endif %}
    </div>
  </div>
  </div>

    {% if diff_commits|count > 0 and head %}
    <div class="alert alert-info" role="alert">
      This branch contains <a href="#" id="diff_commits_link">
      {{ diff_commits|count }} commits</a> not in
      {% if repo.is_fork %}
        the upstream project
        <span class="pr-toplabel">
          <span class="oi" data-glyph="document"></span>
          {{ repo.name }}
          </span>
      {% else %}
        the main branch
      {% endif %}
      <span class="pr-toplabel">
        <span class="oi" data-glyph="random"> </span>
        {{head}}
      </span>

      {% if diff_commits and authenticated and head and
        (repo.is_fork or repo.settings.get('pull_requests', True)) %}
          <div id="request_pull" class="pull-xs-right">
            <a class="btn btn-primary btn-sm"
              href="{{ url_for('new_request_pull',
                    repo=repo.name,
                    username=username,
                    namespace=repo.namespace,
                    branch_to=head, branch_from=branchname or 'master') }}">
              {% if g.repo_admin %}Request pull{% else %}Compare{% endif %}
            </a>
          </div>
      {% endif %}

      <div id="diff_commits" class="list-group m-t-1" style="display:none;">
        {% for diff_commit_full in diff_commits_full %}
           <a href="{{ url_for('view_commit',
                    repo=repo.name,
                    username=username,
                    namespace=repo.namespace,
                    commitid=diff_commit_full.hex)
              }}" class="list-group-item">
              <h5>
                <strong>{{ diff_commit_full.message.split('\n')[0] }}</strong>
                <div class="pull-xs-right">
                  <span class="commitdate"
                        title="{{ diff_commit_full.commit_time|format_ts }}">
                    {{ diff_commit_full.commit_time|humanize }}
                  </span>
                </div>
              </h5>
              {{ diff_commit_full.author | author2avatar(20) | safe }}
              {{ diff_commit_full.author.name }}
              <div class="pull-xs-right">
                <span class="label label-default">
                  {{ diff_commit_full.hex|short }}
                </span>
              </div>
            </a>
        {% endfor %}
      </div>
    </div>
    {% endif %}

      <div class="list-group m-t-1">
        {% for commit in last_commits %}
          <div class="list-group-item {%
                if diff_commits and commit.oid.hex in diff_commits %}p-l-3{%
                endif %}" style="position:relative;">
            {% if diff_commits and commit.oid.hex in diff_commits %}
              <div title="This commit is not in the main branch of this Repo"
                  style="position:absolute; left:0; top:0; padding:5px;
                         padding-top:20px; height:100%; background:#eee;
                         vertical-align:middle;">
                <span class="oi" data-glyph="arrow-thick-right"></span>
              </div>
            {% endif %}
            <h5>
              <a href="{{ url_for('view_commit',
                    repo=repo.name,
                    username=username,
                    namespace=repo.namespace,
                    commitid=commit.hex, branch=branchname) }}"
                  class="notblue">
                <strong>{{ commit.message.split('\n')[0] }}</strong>
                <div class="pull-xs-right">
                  <span class="commitdate"
                        title="{{ commit.commit_time|format_ts }}">
                    {{ commit.commit_time|humanize }}
                  </span>
                </div>
              </a>
            </h5>
              {{commit.author|author2user(cssclass="notblue")|safe}}
            <div class="pull-xs-right">
              <span class="label label-default">{{ commit.hex|short }}</span>
            </div>
          </div>
        {% endfor %}
      </div>

      {{ pagination_link('page', g.page, total_page) }}

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

{% block jscripts %}
{{ super() }}
<script type="text/javascript">
  $(function(){
    $('#diff_commits_link').click(function(){
      $('#diff_commits').toggle();
    });
  });
</script>
{% endblock %}