diff --git a/swh/web/add_forge_now/urls.py b/swh/web/add_forge_now/urls.py new file mode 100644 --- /dev/null +++ b/swh/web/add_forge_now/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import url + +from swh.web.add_forge_now import views + +urlpatterns = [ + url(r"^add/$", views.submit_request, name="forge-add"), +] diff --git a/swh/web/add_forge_now/views.py b/swh/web/add_forge_now/views.py new file mode 100644 --- /dev/null +++ b/swh/web/add_forge_now/views.py @@ -0,0 +1,34 @@ +from django import forms +from django.shortcuts import render + +from swh.web.add_forge_now.models import Request as AddForgeRequest + +FORGE_TYPES = [ + ("cgit", "cgit"), + ("gitlab", "gitlab"), + ("heptapod", "heptapod"), + ("gitea", "gitea"), +] + + +class RequestForm(forms.Form): + forge_type = forms.ChoiceField(choices=FORGE_TYPES) + forge_type.widget.attrs.update({"class": "form-control"}) + forge_url = forms.CharField(label="Forge contact name", max_length=200) + forge_url.widget.attrs.update({"class": "form-control"}) + forge_contact_email = forms.EmailField(label="Forge contact email", max_length=100) + forge_contact_email.widget.attrs.update({"class": "form-control"}) + forge_contact_name = forms.CharField(label="Forge contact name", max_length=100) + forge_contact_name.widget.attrs.update({"class": "form-control"}) + forge_contact_comment = forms.CharField(label="Comment", widget=forms.Textarea) + forge_contact_comment.widget.attrs.update({"class": "form-control", "rows": "3"}) + + +def submit_request(request): + request_form = RequestForm() + existing = AddForgeRequest.objects.all() + return render( + request, + "add_forge_now/submit-request.html", + {"request_form": request_form, "existing": existing}, + ) diff --git a/swh/web/templates/add_forge_now/submit-request.html b/swh/web/templates/add_forge_now/submit-request.html new file mode 100644 --- /dev/null +++ b/swh/web/templates/add_forge_now/submit-request.html @@ -0,0 +1,128 @@ +{% extends "../layout.html" %} + +{% comment %} +Copyright (C) 2021 The Software Heritage developers +See the AUTHORS file at the top-level directory of this distribution +License: GNU Affero General Public License version 3, or any later version +See top-level LICENSE file for more information +{% endcomment %} + +{% load render_bundle from webpack_loader %} +{% load static %} + +{% block title %}{{ heading }} – Software Heritage archive{% endblock %} + +{% block header %} +{% endblock %} + +{% block navbar-content %} +
Date | +Type | +URL | +Status | +
---|---|---|---|
{{ each.submission_date }} | +{{ each.forge_type }} | +{{ each.forge_url }} | +{{ each.status }} | +
Save code now
+Add forge now
+ +