~edwargix/git.sr.ht

3e413e73bb278699f90b63310ab0cb879c494b32 — Drew DeVault 6 years ago a9d6125
Lay out summary page
3 files changed, 112 insertions(+), 4 deletions(-)

M gitsrht/blueprints/repo.py
A gitsrht/templates/repo.html
A gitsrht/templates/summary.html
M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +10 -4
@@ 1,11 1,17 @@
from flask import Blueprint
from flask import Blueprint, render_template, abort
from flask_login import current_user
from gitsrht.access import get_repo, has_access, UserAccess
from gitsrht.types import User, Repository

repo = Blueprint('repo', __name__)

# TODO: !! SECURITY !!

@repo.route("/<owner>/<name>")
def summary(owner, name):
    return "hi!"
@repo.route("/<owner>/<repo>")
def summary(owner, repo):
    owner, repo = get_repo(owner, repo)
    if not has_access(repo, UserAccess.read):
        abort(401)
    with open("/home/sircmpwn/sources/wlroots/README.md") as f:
        rm = f.read()
    return render_template("summary.html", owner=owner, repo=repo, rm=rm)

A gitsrht/templates/repo.html => gitsrht/templates/repo.html +32 -0
@@ 0,0 1,32 @@
{% extends "git.html" %}
{% block body %}
<div class="container-fluid">
  <div class="row">
    <div class="col-md-12 header-tabbed">
      <h2>
        <a href="{{ url_for("public.user_index",
          username=owner.username) }}"
        >{{owner.canonical_name}}</a>/{{repo.name}}
      </h2>
      <ul class="nav nav-tabs">
        <li class="nav-item">
          <a class="nav-link active" href="#">summary</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">refs</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">log</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">tree</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">settings</a>
        </li>
      </ul>
    </div>
  </div>
</div>
{% block content %}{% endblock %}
{% endblock %}

A gitsrht/templates/summary.html => gitsrht/templates/summary.html +70 -0
@@ 0,0 1,70 @@
{% extends "repo.html" %}
{% block content %}
<div class="container">
  <div class="row" style="margin-bottom: 1rem">
    <div class="col-md-6">
      <div class="event-list" style="margin-bottom: 0.5rem">
        <div class="event">
          <div>
            <a href="#">emersion</a>
            <a href="#">&lt;contact@emersion.fr&gt;</a>
            <span class="text-muted">committed</span>
            <a href="#">ac28d701c</a>
            <span class="text-muted">14 hours ago</span>
          </div>
          <pre
            style="padding-left: 0; padding-right: 0; background: transparent"
          >buffer: disconnect clients that commit an unknown buffer type</pre>
        </div>
        <div class="event">
          <div>
            <a href="#">emersion</a>
            <a href="#">&lt;contact@emersion.fr&gt;</a>
            <span class="text-muted">committed</span>
            <a href="#">ac28d701c</a>
            <span class="text-muted">14 hours ago</span>
          </div>
        </div>
        <div class="event">
          <div>
            <a href="#">emersion</a>
            <a href="#">&lt;contact@emersion.fr&gt;</a>
            <span class="text-muted">committed</span>
            <a href="#">ac28d701c</a>
            <span class="text-muted">14 hours ago</span>
          </div>
        </div>
      </div>
    </div>
    <div class="col-md-2">
      <h3>refs</h3>
      <dl>
        <dt>master</dt>
        <dd>
          <a href="#">log {{icon("caret-right")}}</a>
          <a href="#">browse {{icon("caret-right")}}</a>
        </dd>
        <dt>v1.0</dt>
        <dd>
          <a href="#">log {{icon("caret-right")}}</a>
          <a href="#">.tar.gz {{icon("caret-right")}}</a>
        </dd>
      </dl>
    </div>
    <div class="col-md-4">
      <h3>clone</h3>
      <dl>
        <dt>read-only</dt>
        <dd><a href="#">https://git.sr.ht/~sircmpwn/wlroots</a></dd>
        <dt>read/write</dt>
        <dd>git@git.sr.ht/~sircmpwn/wlroots</dd>
      </dl>
    </div>
  </div>
  <div class="row">
    <div class="col-md-10">
      {{ rm | extended_md }}
    </div>
  </div>
</div>
{% endblock %}