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

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

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

{% block repo %}

  <section class="admin_list">
    <h3>Admins</h3>
    <ul>
      <li>
        <a href="{{ url_for('view_user', username=repo.user.user)}}">
          {{ repo.user.user | avatar(32) | safe }}
          {{ repo.user.fullname }} ({{ repo.user.user }})  -  creator
        </a>
      </li>
      {% for user in repo.users %}
      <li>
        <a href="{{ url_for('view_user', username=user.user)}}">
          {{ user.user | avatar(32) | safe }}
          {{ user.fullname }} ({{ user.user }})
        </a>
      </li>
      {% endfor %}
      {% for group in repo.groups %}
      <li>
        <a href="{{ url_for('view_group', group=group.group_name)}}">
          @{{ group.group_name }}
        </a>
      </li>
      {% endfor %}
    </ul>
  </section>

{% 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, branchname=branchname, 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, branchname=branchname, 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 {{ last_commits | length }} commits</h3>
    {% endif %}
    {% if diff_commits and authenticated %}
    <span id="request_pull" class="inline_it">
        <a href="{{ url_for('new_request_pull',
            username=username, repo=repo.name,
            branch_to='master', branch_from=branchname or 'master') }}">
          {% if repo_admin %}Request pull{% else %}Compare{% endif %}
        </a>
    </span>
    {% elif authenticated %}
    <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 %}
    {% if repo_admin and branchname and branchname != 'master' %}
    <form action="{{
        url_for('.delete_branch',
                username=username, repo=repo.name, branchname=branchname)
        }}" method="post" class="inline_it icon del_icon">
        {{ form.csrf_token }}
        <button
          onclick="return confirm('You sure you want to remove this branch?\nThis cannot be un-done!');"
          title="Remove branch {{ branchname }}">
          <span class="icon icon-trash blue"> Delete branch</span>
        </button>
    </form>
    {% endif %}
    <ul>
      {% for commit in last_commits %}
      <li>
        {{ commit.author | author2avatar(20) | safe }}
        <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">
    {% if safe %}
      {{ readme | noJS |safe }}
    {% else %}
      {{ readme | noJS }}
    {% endif %}
  </section>
  {% endif %}

  <section class="git_links">
    <table>
      <tr>
        <th>Git URLs</th>
        <td><a id="more_gits">more</a> | </td>
        <td>
          <a href="{{ url_for('ssh_hostkey') }}">
            SSH Hostkey/Fingerprint
          </a>
        </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 %}