diff --git a/hubsrht/blueprints/projects.py b/hubsrht/blueprints/projects.py index f22f76e..026f5b6 100644 --- a/hubsrht/blueprints/projects.py +++ b/hubsrht/blueprints/projects.py @@ -6,7 +6,7 @@ from hubsrht.types import Project, RepoType, Visibility from srht.database import db from srht.flask import paginate_query from srht.oauth import current_user, loginrequired -from srht.validation import Validation +from srht.validation import Validation, valid_url projects = Blueprint("projects", __name__) @@ -93,3 +93,32 @@ def create_POST(): return redirect(url_for("projects.summary_GET", owner=current_user.canonical_name, project_name=project.name)) + +@projects.route("///settings") +@loginrequired +def config_GET(owner, project_name): + owner, project = get_project(owner, project_name, ProjectAccess.write) + return render_template("project-config.html", view="add more", + owner=owner, project=project) + +@projects.route("///settings", methods=["POST"]) +@loginrequired +def config_POST(owner, project_name): + owner, project = get_project(owner, project_name, ProjectAccess.write) + + valid = Validation(request) + description = valid.require("description") + website = valid.optional("website") + valid.expect(not website or valid_url(website), + "Website must be a valid http or https URL") + if not valid.ok: + return render_template("project-config.html", view="add more", + owner=owner, project=project, **valid.kwargs) + + project.description = description + project.website = website + db.session.commit() + + return redirect(url_for("projects.summary_GET", + owner=current_user.canonical_name, + project_name=project.name)) diff --git a/hubsrht/templates/project-config.html b/hubsrht/templates/project-config.html new file mode 100644 index 0000000..41fd83d --- /dev/null +++ b/hubsrht/templates/project-config.html @@ -0,0 +1,210 @@ +{% extends "project-base.html" %} +{% block content %} +
+
+
+
+ {{csrf_token()}} +
+
+
+ + +
+
+ + + {{valid.summary("description")}} +
+
+ + + {{valid.summary("website")}} +
+
+
+
+ Project Visibility +
+ +
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+

Source code repositories

+

+ Git and Mercurial repositories help you share this project's source + code with your collaborators. +

+ +
+ +
+

Mailing lists

+

+ Mailing lists give users a place to ask questions about the project + or send patches to contribute to the code. +

+ +
+ +
+

Ticket trackers

+

+ Bug trackers give you a place to organize your tasks and record known + defects. +

+ +
+ +
+

Delete project

+

+ This will permanently delete your project, + {{project.name}}. This cannot be undone. +

+ +
+ +
+
+
+{% endblock %} diff --git a/hubsrht/templates/project-nav.html b/hubsrht/templates/project-nav.html index 22167ee..f44be7f 100644 --- a/hubsrht/templates/project-nav.html +++ b/hubsrht/templates/project-nav.html @@ -14,6 +14,15 @@ owner=owner.canonical_name, project_name=project.name), "summary")}} + {% if project.website %} + + {% endif %} {% if any(project.source_repos) %} {% endif %} {# TODO - @@ -48,7 +52,9 @@ {% if current_user and current_user.id == owner.id %}
  • {% endif %} diff --git a/hubsrht/templates/project-summary.html b/hubsrht/templates/project-summary.html index cadeb93..9c6175f 100644 --- a/hubsrht/templates/project-summary.html +++ b/hubsrht/templates/project-summary.html @@ -63,8 +63,8 @@ >Add mailing lists {{icon('arrow-right')}}
    - Mailing lists give users a means of asking questions about the - project or sending patches to contribute to the source code. + Mailing lists give users a place to ask questions about the + project or send patches to contribute to the code. {% endif %} @@ -99,7 +99,7 @@ dismiss You're all set! If you want to set up more things for your project, - click "add more" on the top right. + click "more +" on the top right.

    {% endif %} diff --git a/hubsrht/types/project.py b/hubsrht/types/project.py index 877f62e..fdaad52 100644 --- a/hubsrht/types/project.py +++ b/hubsrht/types/project.py @@ -14,6 +14,7 @@ class Project(Base): name = sa.Column(sa.Unicode(128), nullable=False) description = sa.Column(sa.Unicode(512), nullable=False) + website = sa.Column(sa.Unicode) visibility = sa.Column(sau.ChoiceType(Visibility, impl=sa.String()), nullable=False, server_default="unlisted")