mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
Reorganize templates
This commit is contained in:
parent
6300a914e4
commit
163ca0f629
|
@ -28,7 +28,7 @@ def lists_GET(owner, project_name):
|
|||
search_error = str(ex)
|
||||
|
||||
mailing_lists, pagination = paginate_query(mailing_lists)
|
||||
return render_template("project-mailing-lists.html", view="mailing lists",
|
||||
return render_template("mailing-lists.html", view="mailing lists",
|
||||
owner=owner, project=project,
|
||||
search=terms, search_error=search_error,
|
||||
mailing_lists=mailing_lists,
|
||||
|
@ -41,7 +41,7 @@ def new_GET(owner, project_name):
|
|||
# TODO: Pagination
|
||||
mls = lists.get_lists(owner)
|
||||
mls = sorted(mls, key=lambda r: r["updated"], reverse=True)
|
||||
return render_template("project-lists-new.html", view="new-resource",
|
||||
return render_template("mailing-list-new.html", view="new-resource",
|
||||
owner=owner, project=project, lists=mls)
|
||||
|
||||
@mailing_lists.route("/<owner>/<project_name>/lists/new", methods=["POST"])
|
||||
|
@ -56,7 +56,7 @@ def new_POST(owner, project_name):
|
|||
if not valid.ok:
|
||||
mls = lists.get_lists(owner)
|
||||
mls = sorted(mls, key=lambda r: r["updated"], reverse=True)
|
||||
return render_template("project-lists-new.html",
|
||||
return render_template("mailing-list-new.html",
|
||||
view="new-resource", owner=owner, project=project,
|
||||
lists=mls, **valid.kwargs)
|
||||
else:
|
||||
|
@ -71,7 +71,7 @@ def new_POST(owner, project_name):
|
|||
# TODO: Search properly
|
||||
mls = filter(lambda r: search.lower() in r["name"].lower(), mls)
|
||||
mls = sorted(mls, key=lambda r: r["updated"], reverse=True)
|
||||
return render_template("project-lists-new.html",
|
||||
return render_template("mailing-list-new.html",
|
||||
view="new-resource", owner=owner, project=project,
|
||||
lists=mls)
|
||||
mailing_list = lists.get_list(owner, list_name)
|
||||
|
@ -116,7 +116,7 @@ def manage_GET(owner, project_name):
|
|||
search_error = str(ex)
|
||||
|
||||
mailing_lists, pagination = paginate_query(mailing_lists)
|
||||
return render_template("project-mailing-lists-manage.html",
|
||||
return render_template("mailing-lists-manage.html",
|
||||
view="mailing lists", owner=owner, project=project,
|
||||
search=terms, search_error=search_error,
|
||||
mailing_lists=mailing_lists,
|
||||
|
|
|
@ -28,7 +28,7 @@ def sources_GET(owner, project_name):
|
|||
search_error = str(ex)
|
||||
|
||||
sources, pagination = paginate_query(sources)
|
||||
return render_template("project-sources.html", view="sources",
|
||||
return render_template("sources.html", view="sources",
|
||||
owner=owner, project=project, sources=sources,
|
||||
search=terms, search_error=search_error,
|
||||
**pagination)
|
||||
|
@ -38,7 +38,7 @@ def sources_GET(owner, project_name):
|
|||
def new_GET(owner, project_name):
|
||||
# TODO: Redirect appropriately if this instance only has git or hg support
|
||||
owner, project = get_project(owner, project_name, ProjectAccess.write)
|
||||
return render_template("project-sources-new.html", view="new-resource",
|
||||
return render_template("sources-new.html", view="new-resource",
|
||||
owner=owner, project=project)
|
||||
|
||||
@sources.route("/<owner>/<project_name>/git/new")
|
||||
|
@ -48,11 +48,16 @@ def git_new_GET(owner, project_name):
|
|||
# TODO: Pagination
|
||||
repos = git.get_repos(owner)
|
||||
repos = sorted(repos, key=lambda r: r["updated"], reverse=True)
|
||||
return render_template("project-sources-select.html",
|
||||
return render_template("sources-select.html",
|
||||
view="new-resource", vcs="git",
|
||||
owner=owner, project=project, repos=repos,
|
||||
existing=[]) # TODO: Fetch existing repos for this project
|
||||
|
||||
@sources.route("/<owner>/<project_name>/hg/new")
|
||||
@loginrequired
|
||||
def hg_new_GET(owner, project_name):
|
||||
pass # TODO
|
||||
|
||||
@sources.route("/<owner>/<project_name>/git/new", methods=["POST"])
|
||||
@loginrequired
|
||||
def git_new_POST(owner, project_name):
|
||||
|
@ -62,7 +67,7 @@ def git_new_POST(owner, project_name):
|
|||
git_repo = git.create_repo(owner, valid)
|
||||
if not valid.ok:
|
||||
repos = git.get_repos(owner)
|
||||
return render_template("project-sources-select.html",
|
||||
return render_template("sources-select.html",
|
||||
view="new-resource", vcs="git",
|
||||
owner=owner, project=project, repos=repos,
|
||||
existing=[], **valid.kwargs)
|
||||
|
@ -80,7 +85,7 @@ def git_new_POST(owner, project_name):
|
|||
repos = filter(lambda r: search.lower() in r["name"].lower(), repos)
|
||||
repos = sorted(repos, key=lambda r: r["updated"], reverse=True)
|
||||
# TODO: Fetch existing repos for this project
|
||||
return render_template("project-sources-select.html",
|
||||
return render_template("sources-select.html",
|
||||
view="new-resource", vcs="git",
|
||||
owner=owner, project=project, repos=repos,
|
||||
existing=[], search=search)
|
||||
|
@ -129,7 +134,7 @@ def manage_GET(owner, project_name):
|
|||
search_error = str(ex)
|
||||
|
||||
sources, pagination = paginate_query(sources)
|
||||
return render_template("project-sources-manage.html", view="sources",
|
||||
return render_template("sources-manage.html", view="sources",
|
||||
owner=owner, project=project, sources=sources,
|
||||
search=terms, search_error=search_error,
|
||||
**pagination)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "project-resource-new.html" %}
|
||||
{% extends "resource-new.html" %}
|
||||
{% block content %}
|
||||
<form method="POST">
|
||||
{{csrf_token()}}
|
|
@ -1,22 +1,25 @@
|
|||
{% extends "project-resource-new.html" %}
|
||||
{% extends "resource-new.html" %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<form class="col-lg-10" method="POST">
|
||||
{{csrf_token()}}
|
||||
<div class="col-lg-10" method="POST">
|
||||
<h3>Add source code repository</h3>
|
||||
<div class="event-list">
|
||||
<div class="event">
|
||||
<button type="submit" name="git" class="btn btn-primary pull-right">
|
||||
Add git repositories {{icon('caret-right')}}
|
||||
</button>
|
||||
<a
|
||||
class="btn btn-primary pull-right"
|
||||
href="{{url_for("sources.git_new_GET",
|
||||
owner=owner, project_name=project.name)}}"
|
||||
>Add git repositories {{icon('caret-right')}}</a>
|
||||
<h3 style="border: none; padding-bottom: 0">
|
||||
git
|
||||
</h3>
|
||||
</div>
|
||||
<div class="event">
|
||||
<button type="submit" name="hg" class="btn btn-primary pull-right">
|
||||
Add hg repositories {{icon('caret-right')}}
|
||||
</button>
|
||||
<a
|
||||
class="btn btn-primary pull-right"
|
||||
href="{{url_for("sources.hg_new_GET",
|
||||
owner=owner, project_name=project.name)}}"
|
||||
>Add hg repositories {{icon('caret-right')}}</a>
|
||||
<h3 style="border: none; padding-bottom: 0">
|
||||
Mercurial
|
||||
</h3>
|
||||
|
@ -39,6 +42,6 @@
|
|||
You may use any combination of version control systems in your project.
|
||||
If you're not sure, choose git.
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "project-resource-new.html" %}
|
||||
{% extends "resource-new.html" %}
|
||||
{% block content %}
|
||||
<form method="POST">
|
||||
{{csrf_token()}}
|
Loading…
Reference in New Issue