~edwargix/git.sr.ht

cd8225a534ca6308903c9dfefa1b9b390de148d8 — Adnan Maolood 2 years ago cc626a3
gitsrht: Add missing templates
A gitsrht/templates/settings.html => gitsrht/templates/settings.html +20 -0
@@ 0,0 1,20 @@
{% extends "layout.html" %}

{% block body %}
<div class="header-tabbed">
  <div class="container">
    <h2>
      <a href="/{{ owner.canonical_name }}">{{ owner.canonical_name }}</a>/<wbr
     >{{ repo.name }}
    </h2>
    <ul class="nav nav-tabs">
    {% block tabs %}
    {% include "settingstabs.html" %}
    {% endblock %}
    </div>
  </div>
</div>
<div class="container">
  {% block content %}{% endblock %}
</div>
{% endblock %}

A gitsrht/templates/settings_access.html => gitsrht/templates/settings_access.html +99 -0
@@ 0,0 1,99 @@
{% extends "settings.html" %}

{% block content %}
<div class="row">
  <div class="col-md-12">
    {% if len(repo.access_grants) > 0 %}
    <table class="table">
      <thead>
        <tr>
          <th>user</th>
          <th>granted</th>
          <th>last used</th>
          <th>access</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        {% for grant in repo.access_grants %}
        <tr>
          <td>
            <a href="/~{{ grant.user.username }}">~{{grant.user.username}}</a>
          </td>
          <td>{{ grant.created | date }}</td>
          <td>{{ grant.updated | date }}</td>
          <td>{{ grant.mode.value }}</td>
          <td style="width: 6rem">
            <form
              method="POST"
              action="/~{{owner.username}}/{{
                repo.name
              }}/settings/access/revoke/{{ grant.id }}"
            >
              {{csrf_token()}}
              <button type="submit" class="btn btn-danger btn-fill">Revoke</button>
            </form>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% endif %}
  </div>
</div>
<div class="row">
  <div class="col-md-8">
    <h4>Grant Access</h4>
    <form method="POST">
      {{csrf_token()}}
      <div class="form-group">
        <label for="user">User</label>
        <input
          type="text"
          class="form-control {{valid.cls("user")}}"
          id="user"
          name="user"
          placeholder="~{{ current_user.username }}"
          value="{{user or ""}}"
        />
        {{valid.summary("user")}}
      </div>
      <fieldset class="form-group">
        <legend>Access</legend>
        <!-- This is in a weird spot cause it looks better over here -->
        <button type="submit" class="btn btn-primary pull-right">
          Grant access {{icon("caret-right")}}
        </button>
        <div class="form-check form-check-inline">
          <label
            class="form-check-label"
            title="Can view on the web and clone the repository"
          >
            <input
              class="form-check-input"
              type="radio"
              name="access"
              value="ro"
              {{ "checked" if not access or access.value == "ro" else "" }}
            > Read only
          </label>
        </div>
        <div class="form-check form-check-inline">
          <label
              class="form-check-label"
              title="Can push commits to the repository"
            >
            <input
              class="form-check-input"
              type="radio"
              name="access"
              value="rw"
              {{ "checked" if access and access.value == "rw" else "" }}
            > Read/write
          </label>
        </div>
      </fieldset>
    </form>
  </div>
</div>
{% endblock %}

A gitsrht/templates/settings_delete.html => gitsrht/templates/settings_delete.html +23 -0
@@ 0,0 1,23 @@
{% extends "settings.html" %}

{% block content %}
<div class="row">
  <div class="col-md-12">
    <p>
      This will permanently delete your repository,
      <strong>{{ owner.canonical_name }}/{{ repo.name }}</strong>.
      This cannot be undone.
    </p>
    <form method="POST">
      {{csrf_token()}}
      <button type="submit" class="btn btn-danger">
        Delete {{repo.name}} {{icon("caret-right")}}
      </button>
      <a
        href="/{{ owner.canonical_name }}/{{ repo.name }}"
        class="btn btn-default"
      >Nevermind</a>
    </form>
  </div>
</div>
{% endblock %}

A gitsrht/templates/settings_rename.html => gitsrht/templates/settings_rename.html +32 -0
@@ 0,0 1,32 @@
{% extends "settings.html" %}

{% block content %}
<div class="row">
  <div class="col-md-6">
    <h3>Rename Repository</h3>
    <form method="POST">
      {{csrf_token()}}
      <div class="form-group">
        <label for="name" style="display: block">
          New repository name:
        </label>
        <input
          type="text"
          class="form-control {{valid.cls('name')}}"
          id="name"
          name="name"
          value="{{name or repo.name}}" />
        {{valid.summary('name')}}
      </div>
      <p>
        This will change the canonical URL of your repository. A redirect from
        the old URL to the new one will be in place until you create another
        repository with the same name.
      </p>
      <button type="submit" class="btn btn-primary pull-right">
        Rename repository {{icon("caret-right")}}
      </button>
    </form>
  </div>
</div>
{% endblock %}

A gitsrht/templates/settingstabs.html => gitsrht/templates/settingstabs.html +30 -0
@@ 0,0 1,30 @@
{% macro link(path, title) %}
<a
  class="nav-link {% if request.path.endswith(path) %}active{% endif %}"
  href="/{{ owner.canonical_name }}/{{ repo.name }}/settings{{ path }}"
>{{ title }}</a>
{% endmacro %}

<li class="nav-item">
  <a
    class="nav-link"
    href="/{{ owner.canonical_name }}/{{ repo.name }}"
  >
    {{icon("caret-left")}} back
  </a>
</li>
{% if request.path.endswith("/rename") %}
<li class="nav-item">
  {{ link("/rename", "rename") }}
</li>
{% endif %}
<li class="nav-item">
  {{ link("/info", "info") }}
</li>
<li class="nav-item">
  {{ link("/access", "access") }}
</li>
{% block extratabs %}{% endblock %}
<li class="nav-item">
  {{ link("/delete", "delete") }}
</li>

A gitsrht/templates/user.html => gitsrht/templates/user.html +84 -0
@@ 0,0 1,84 @@
{% extends "base.html" %}

{% block content %}
<div class="container">
  <div class="row">
    <section class="col-md-4">
      <h2>
        ~{{ user.username }}
      </h2>
      {% if user.location %}
      <p>{{user.location}}</p>
      {% endif %}
      {% if user.url %}
      <p>
        <a
          href="{{user.url}}"
          target="_blank"
          rel="me noopener noreferrer nofollow"
        >{{user.url}}</a>
      </p>
      {% endif %}
      {% if user.bio %}
      {{user.bio | md}}
      {% endif %}
      {% if notice %}
      <div class="alert alert-success">
        {{ notice }}
      </div>
      {% endif %}
    </section>
    <section class="col-md-8">
      {% if len(repos) == 0 %}
      {% if search %}
      <form>
        <input
          name="search"
          type="text"
          placeholder="Search"
          class="form-control"
          value="{{ search if search else "" }}" />
      </form>
      <p>Nothing found.</p>
      {% else %}
      <p>This user has no repositories.</p>
      {% endif %}
      {% else %}
      <form>
        <input
          name="search"
          type="text"
          placeholder="Search"
          class="form-control{% if search_error %} is-invalid{% endif %}"
          value="{{ search if search else "" }}" />
        {% if search_error %}
          <div class="invalid-feedback">{{ search_error }}</div>
        {% endif %}
      </form>
      <div class="event-list">
        {% for repo in repos %}
        <div class="event">
          <h4>
            <a href="/~{{user.username}}/{{repo.name}}">
              ~{{user.username}}/{{repo.name}}
            </a>
            {% if repo.visibility.value != 'public' %}
            <small class="pull-right">
              {{ repo.visibility.value }}
            </small>
            {% endif %}
          </h4>
          {% if repo.description %}
          <p>{{ repo.description }}</p>
          {% endif %}
          <p>
          </p>
        </div>
        {% endfor %}
      </div>
      {% endif %}
      {{ pagination() }}
    </section>
  </div>
</div>
{% endblock %}