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

{% block title %}{{ select.capitalize() }} - {{ repo.name }}{% endblock %}
{% set tag = "home" %}

{% block header %}
<link href="{{ url_for('static', filename='fontawesome/font-awesome.min.css') }}"
  rel="stylesheet" />
{% endblock %}

{% block repo %}
  <div class="row">
    {% if repo_obj and repo_obj.is_empty %}
      <div class="col-md-8">
        <div class="alert {% if category == 'error' %}alert-warning{% else %}alert-info{%endif%}" role="alert">
          <p>This repo is brand new!</p>
            {% if authenticated and repo_admin %}
              <p>If you already have a git repo:</p>
              <pre>git remote add origin {{ config.get('GIT_URL_SSH') }}{% if repo.parent %}forks/{% endif %}{{ repo.fullname }}.git
git push -u origin master</pre>

              <p>If you have not created your git repo yet:</p>
              <pre>git clone {{ config.get('GIT_URL_SSH') }}{% if repo.parent %}forks/{% endif %}{{ repo.fullname }}.git
cd {{ repo.name }}
touch README.rst
git add README.rst
git commit -m "Add README file"
git push -u origin master</pre>
            {% else %}
              <p>The Project Creator has not pushed any code yet</p>
            {% endif %}
        </div>
      </div>
    {% else %}
      {% if origin == 'view_commits' %}
      <h3>Commits <span class="label label-default"> {{number_of_commits}}</span></h3>
      <div class="m-b-1">
        Displaying {{number_of_commits}} commits in
        <span class="pr-toplabel">{%
            if repo.is_fork %}<span class="oi" data-glyph="fork"></span> {%
            else %}<span class="oi" data-glyph="document"></span> {%
            endif %}{{ repo.fullname }}</span>
        <span class="pr-toplabel">
          <span class="oi" data-glyph="random"> </span>
          {{branchname}}
        </span>
      </div>

      {% if diff_commits|count > 0 %}
      <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 (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',
        username=username, repo=repo.name,
        branch_to=head, branch_from=branchname or 'master') }}">
      {% if repo_admin %}Request pull{% else %}Compare{% endif %}
            </a>
        </div>
        {#{% elif authenticated and repo.settings.get('pull_requests', True) %}
        <span id="request_pull" class="inline_it">
            <a href="{{ url_for('new_remote_request_pull',
        username=username, repo=repo.name) }}">
      Open a remote pull-request
            </a>
        </span>#}
        {% 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', username=username,
                        repo=repo.name, 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 %}
            <a href="{{ url_for('view_commit', username=username, repo=repo.name, commitid=commit.hex) }}"
                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>
                <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>
              </h5>
              {{ commit.author | author2avatar(20) | safe }} {{ commit.author.name }}
              <div class="pull-xs-right">
                <span class="label label-default">{{ commit.hex|short }}</span>
              </div>
            </a>
          {% endfor %}
        </div>
      {% endif %}

      {% if total_page %}
        <nav class="text-center">
          <ul class="pagination">
            <li {% if page <= 1%} class="disabled" {% endif %}>
              <a href="{{ url_for('.%s' % origin, username=username,
                          repo=repo.name, branchname=branchname, page=page-1)
                }}" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
                <span class="sr-only">Newer</span>
              </a>
            </li>
            <li class="active">page {{ page }} of {{total_page}}</li>
            <li {% if page >= total_page %}class="disabled"{%endif%}>
              <a href="{{ url_for('.%s' % origin, username=username,
                          repo=repo.name, branchname=branchname, page=page+1)
                }}" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
                <span class="sr-only">Older</span>
              </a>
            </li>
          </ul>
        </nav>
      {% endif %}
    {% endif %}

    {% if origin == 'view_repo' or origin == 'view_repo_branch' %}

      {% if readme %}
        <div class="col-md-8">
          <section class="readme">
            {% if safe %}
              {{ readme | noJS |safe }}
            {% else %}
              {{ readme | noJS }}
            {% endif %}
          </section>
        </div>
      {% endif %}

      {% if readme or (repo_obj and repo_obj.is_empty) %}
      <div class="col-md-4">
      {% else %}
      <div class="col-md-12">
      {% endif %}
        <div class="card">
          <div class="card-block">
            {%- if repo.url %}
              <h4>Project Website</h4>
              <p><a class="inline" href="{{ repo.url }}">{{ repo.url }}</a></p>
            {% endif %}
            <h4>Admins</h4>
            <p>
              <div>
                <a href="{{ url_for('view_user', username=repo.user.user)}}">
                  {{ repo.user.user | avatar(20) | safe }}
                  {{ repo.user.fullname }} ({{ repo.user.user }})  -  creator
                </a>
              </div>
              {% for user in repo.users %}
                <div>
                  <a href="{{ url_for('view_user', username=user.user)}}">
                    {{ user.user | avatar(20) | safe }}
                    {{ user.fullname }} ({{ user.user }})
                  </a>
                </div>
              {% endfor %}
              {% for group in repo.groups %}
                <div>
                  <a href="{{ url_for('view_group', group=group.group_name)}}">
                    @{{ group.group_name }}
                  </a>
                </div>
              {% endfor %}
            </p>
        </div>
      </div>

      <div class="card">
        <div class="card-header">
          <strong>GIT URLs</strong>
        </div>
        <div class="card-block">
            <div class="form-group">
              <div class="input-group">
                <div class="input-group-addon">SSH</span></div>
                <input class="form-control" type="text" value="{{
                  config.get('GIT_URL_SSH') }}{% if repo.parent %}forks/{% endif %}{{ repo.fullname }}.git" readonly>
              </div>
            </div>
            <div class="form-group">
              <div class="input-group">
                <div class="input-group-addon">GIT</span></div>
                <input class="form-control" type="text" value="{{
                  config.get('GIT_URL_GIT') }}{% if repo.parent %}forks/{% endif %}{{ repo.fullname }}.git" readonly>
              </div>
            </div>
            {% if authenticated and repo_admin %}
              <div class="collapse" id="moregiturls">
                {% if config['DOC_APP_URL'] and repo and repo.settings.get('project_documentation', True) %}
                <h4>Docs</h4>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-addon">SSH</span></div>
                    <input class="form-control" type="text" value="{{
                      config.get('GIT_URL_SSH') }}docs/{{ repo.fullname }}.git" readonly>
                  </div>
                </div>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-addon">GIT</span></div>
                    <input class="form-control" type="text" value="{{
                      config.get('GIT_URL_GIT') }}docs/{{ repo.fullname }}.git" readonly>
                  </div>
                </div>
                {%endif%}
                {% if config.get('ENABLE_TICKETS', True) %}
                <h4>Tickets</h4>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-addon">SSH</span></div>
                    <input class="form-control" type="text" value="{{
                      config.get('GIT_URL_SSH') }}tickets/{{ repo.fullname }}.git" readonly>
                  </div>
                </div>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-addon">GIT</span></div>
                    <input class="form-control" type="text" value="{{
                      config.get('GIT_URL_GIT') }}tickets/{{ repo.fullname }}.git" readonly>
                  </div>
                </div>
                {%endif%}
                <h4>Requests</h4>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-addon">SSH</span></div>
                    <input class="form-control" type="text" value="{{
                      config.get('GIT_URL_SSH') }}requests/{{ repo.fullname }}.git" readonly>
                  </div>
                </div>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-addon">GIT</span></div>
                    <input class="form-control" type="text" value="{{
                      config.get('GIT_URL_GIT') }}requests/{{ repo.fullname }}.git" readonly>
                  </div>
                </div>
              </div>
              <a class="btn btn-link" data-toggle="collapse" href="#moregiturls"
                aria-expanded="false" aria-controls="moregiturls">More</a>
            {% endif %}
        </div>
      </div>

      {% if repo_obj and not repo_obj.is_empty %}
      <div class="card">
        <div class="card-header">
          <strong>Recent Commits in <span class="pr-toplabel"><span class="oi" data-glyph="random"></span> {{branchname}}</span></strong>
        </div>
        <div class="card-block p-a-0">
          <div class="list-group list-group-flush">
            {% for commit in last_commits %}
              <a href="{{
                  url_for('view_commit', username=username,
                  repo=repo.name, commitid=commit.hex) }}" class="list-group-item">
                <div class="commitdate" title="{{ commit.commit_time|format_ts }}">
                  <small>
                    <strong>
                      {{ commit.author | author2avatar(20) | safe }}
                      {{ commit.author.name }}
                    </strong>
                    commited {{ commit.commit_time|humanize }}
                  </small>
                </div>
                <div><small>
                  {{ commit.message.split('\n')[0] }}
                  {% if diff_commits and commit.oid.hex in diff_commits %}
                    <span class="new_commit" title="Commit not in the main repo">*</span>
                  {% endif %}
                </small></div>
              </a>
            {% endfor %}
          </div>
        </div>
      </div>
      {% endif %}
    </div>

  {% endif %}
</div>

{% endblock %}

{% block jscripts %}
{{ super() }}
<script type="text/javascript">
$(document).ready(function() {
    $(".extra_gits").hide();
});


$(function() {
    $( "#more_gits" ).click(
      function() {
        var _xgits = $(".extra_gits");
        _xgits.toggle();
        console.log(_xgits[0]);
        console.log(_xgits.is(':visible'));
        if (_xgits.is(':visible')) {
            $( "#more_gits" ).html('less');
        } else {
            $( "#more_gits" ).html('more');
        }
      }
    );
});
</script>

{% if origin == 'view_commits' %}
<script type="text/javascript">
  $(function(){
    $('#diff_commits_link').click(function(){
      $('#diff_commits').toggle();
    });
  });
</script>
{% endif %}

{% endblock %}