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

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


{% block repo %}

{% if repo_obj and repo_obj.is_empty %}

  <section class="repo_info">
    <p>This repo is brand new!</p>

    <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 createt 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>

    </section>

{% else %}
  <section class="branch_list">
    <h3>Branches</h3>
    <ul>
      {% for branch in branches %}
      <li>
        <a href="{{ url_for('view_repo_branch',
                    username=username, repo=repo.name, branchname=branch) }}">
          {{ branch }}
        </a>
        (<a href="{{ url_for('view_commits', username=username,
                   repo=repo.name, branchname=branch) }}">commits</a>)

      </li>
      {% endfor %}
    </ul>
  </section>

  {% if total_page %}
  <table>
    <tr>
      <td>
      {% if page > 1%}
          <a href="{{ url_for('.%s' % origin, username=username,
                    repo=repo.name) }}?page={{page - 1}}">
            &lt; Previous
        </a>
      {% else %}
          &lt; Previous
      {% endif %}
      </td>
      <td>{{ page }} / {{ total_page }}</td>
      <td>
        {% if page < total_page %}
        <a href="{{ url_for('.%s' % origin, username=username,
                    repo=repo.name) }}?page={{page + 1}}">
            Next &gt;
        </a>
        {% else %}
        Next >
        {% endif %}
      </td>
    </tr>
  </table>
  {% endif %}

  {% if tree %}
    <section class="tree_list">
      <h3>Current tree</h3>
      <ul>
        {% for entry in tree %}
        <li class="{% if entry.filemode == 16384 %}folder{% else %}file{% endif %}">
            <a href="{{ url_for('view_file', username=username,
                      repo=repo.name, identifier=branchname, filename=entry.name) }}">
                {{ entry.name }}
                <span class="filehex" >{{ entry.hex|short }}</span>
            </a>
        </li>
        {% endfor %}
      </ul>
    </section>
  {% endif %}

  <section class="commit_list">
    {% if origin == 'view_commits' %}
    <h3>Commits list</h3>
    {% else %}
    <h3>Last 10 commits</h3>
    {% endif %}
    {% if diff_commits and authenticated %}
    <span id="request_pull">
        {% if branchname %}
        <a href="{{ url_for('new_request_pull',
            username=username, repo=repo.name,
            branch_to='master', branch_from=branchname) }}">Request pull</a>
        {% else %}
            <a href="{{ url_for('new_request_pull',
                username=username, repo=repo.name,
                branch_to='master', branch_from='master') }}">Request pull</a>
        {% endif %}
    </span>
    {% endif %}
    <ul>
      {% for commit in last_commits %}
      <li>
        <a href="{{ url_for('view_commit', username=username,
                repo=repo.name, commitid=commit.hex) }}">
            <span class="commitid">{{ commit.hex|short }}</span>
            {% if diff_commits and commit.oid.hex in diff_commits %}
            <span class="new_commit" title="Commit not in the main repo">*</span>
            {% endif %}
            {{ commit.message.split('\n')[0] }}
            <span class="commitdate" title="{{ commit.commit_time|format_ts }}">
              {{ commit.commit_time|humanize }}
            </span>
        </a>
      </li>
      {% endfor %}
    </ul>
  </section>

  {% if readme %}
  <section class="readme">
    {{ readme }}
  </section>
  {% endif %}

  <section class="git_links">
    <table>
      <tr>
        <th>Git URLs</th>
        <td><a id="more_gits">more</a></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td>Project</td>
        <td>:</td>
        <td>
          {{ config.get('GIT_URL_SSH') }}:{% if repo.parent %}forks/{% endif %}{{ repo.fullname }}.git
        </td>
        <td>
          {{ config.get('GIT_URL_GIT') }}/{% if repo.parent %}forks/{% endif %}{{ repo.fullname }}.git
        </td>
      </tr>
      <tr class="extra_gits">
        <td>Docs</td>
        <td>:</td>
        <td>
          {{ config.get('GIT_URL_SSH') }}:docs/{{ repo.fullname }}.git
        </td>
        <td>
          {{ config.get('GIT_URL_GIT') }}/docs/{{ repo.fullname }}.git
        </td>
      </tr>
      <tr class="extra_gits">
        <td>Tickets</td>
        <td>:</td>
        <td>
          {{ config.get('GIT_URL_SSH') }}:tickets/{{ repo.fullname }}.git
        </td>
        <td>
          {{ config.get('GIT_URL_GIT') }}/tickets/{{ repo.fullname }}.git
        </td>
      </tr>
      <tr class="extra_gits">
        <td>Requests</td>
        <td>:</td>
        <td>
          {{ config.get('GIT_URL_SSH') }}:requests/{{ repo.fullname }}.git
        </td>
        <td>
          {{ config.get('GIT_URL_GIT') }}/requests/{{ repo.fullname }}.git
        </td>
      </tr>
    </table>
  </section>
{% endif %}

{% 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>
{% endblock %}