mirror of
https://git.sr.ht/~sircmpwn/man.sr.ht
synced 2024-09-09 11:33:01 +02:00
Miscellaenous UI improvements
This commit is contained in:
parent
77a1423ffa
commit
fc93a6f2e3
6 changed files with 41 additions and 11 deletions
|
@ -3,4 +3,3 @@ import mansrht.alembic
|
|||
import srht.alembic
|
||||
from srht.database import alembic
|
||||
alembic("man.sr.ht", mansrht.alembic)
|
||||
alembic("man.sr.ht", srht.alembic)
|
||||
|
|
|
@ -20,6 +20,7 @@ def select_repo(backend, wiki_name, **kwargs):
|
|||
existing = [
|
||||
wiki.repo.name
|
||||
for wiki in Wiki.query.filter(Wiki.owner_id == current_user.id).all()
|
||||
if wiki.repo
|
||||
]
|
||||
|
||||
# TODO: Add cancel button.
|
||||
|
|
|
@ -54,9 +54,10 @@ def content(wiki, path, is_root=False, **kwargs):
|
|||
backend = GitsrhtBackend(wiki.owner)
|
||||
clone_urls = get_clone_urls(
|
||||
backend.origin, wiki.owner, wiki.repo, backend.ssh_format)
|
||||
web_url=f"{backend.origin}/{wiki.owner.canonical_name}/{wiki.repo.name}"
|
||||
if not wiki.repo.commit_sha:
|
||||
return render_template(
|
||||
"new-wiki.html", clone_url=clone_urls[1], repo=wiki.repo)
|
||||
return render_template("new-wiki.html", wiki=wiki,
|
||||
clone_url=clone_urls[1], repo=wiki.repo, web_url=web_url)
|
||||
|
||||
head, tail = os.path.split(path) if path else (None, None)
|
||||
path = tuple(p for p in (head, tail) if p)
|
||||
|
@ -136,7 +137,7 @@ def content(wiki, path, is_root=False, **kwargs):
|
|||
return render_template("content.html",
|
||||
content=html, title=title, repo=wiki.repo, toc=toc,
|
||||
wiki=wiki, is_root=is_root, path=path, frontmatter=frontmatter,
|
||||
clone_urls=clone_urls, **kwargs)
|
||||
clone_urls=clone_urls, web_url=web_url, **kwargs)
|
||||
|
||||
@html.route("/")
|
||||
@html.route("/<path:path>")
|
||||
|
|
|
@ -57,7 +57,9 @@
|
|||
<h4>This commit</h4>
|
||||
<div class="clearfix"></div>
|
||||
<div class="card" style="padding: 0.25rem; border: none; border-radius: 0; margin-bottom: 0.5rem">
|
||||
<pre class="card-text">commit {{ repo.commit_sha }}
|
||||
<pre class="card-text">commit <a
|
||||
href="{{web_url}}/commit/{{repo.commit_sha}}"
|
||||
>{{ repo.commit_sha }}</a>
|
||||
Author: {{ repo.commit_author }} <{{ repo.commit_email }}>
|
||||
Date: {{ repo.commit_time }}
|
||||
|
||||
|
@ -67,7 +69,13 @@ Date: {{ repo.commit_time }}
|
|||
<dt>Clone this wiki</dt>
|
||||
<dd>
|
||||
{% for url in clone_urls|map(attribute="url") %}
|
||||
{% if "://" in url %}
|
||||
<a href={{ url }}>{{ url }}</a>
|
||||
<span class="text-muted pull-right">(read-only)</span>
|
||||
{% else %}
|
||||
<code>{{url}}</code>
|
||||
<span class="text-muted pull-right">(read/write)</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
@ -2,15 +2,31 @@
|
|||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-8">
|
||||
<h1>index</h1>
|
||||
<p>
|
||||
You've successfully created your wiki, but it does not have any content
|
||||
yet. Your repository is available at <code>{{ clone_url.url }}</code>.
|
||||
To populate the index page, clone the repository and add an
|
||||
<code>index.md</code> file. Commit it, push to the
|
||||
<code>{{ repo.ref }}</code> branch, and you'll see the changes here.
|
||||
Your wiki has been created, but does not have any content. To add
|
||||
content, push commits to the <strong>{{repo.ref}}</strong> branch of
|
||||
<a
|
||||
href="{{web_url}}"
|
||||
>{{wiki.owner.canonical_name}}/{{wiki.repo.name}}</a>:
|
||||
<code class="grey">{{clone_url.url}}</code>
|
||||
</p>
|
||||
{% if repo.ref != "master" %}
|
||||
<pre>git clone {{clone_url.url}} && cd {{repo.name}}
|
||||
git checkout --orphan {{repo.ref}}
|
||||
git rm -rf *
|
||||
echo "Hello world!" >index.md
|
||||
git add index.md
|
||||
git commit -m"Initial wiki commit"
|
||||
git push -u origin {{repo.ref}}</pre>
|
||||
{% else %}
|
||||
<pre>git clone {{clone_url.url}} && cd {{repo.name}}
|
||||
echo "Hello world!" >index.md
|
||||
git add index.md
|
||||
git commit -m"Initial wiki commit"
|
||||
git push -u origin {{repo.ref}}</pre>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -57,3 +57,8 @@ h5 {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
code.grey {
|
||||
background: $gray-200;
|
||||
padding: 0 0.25rem;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue