From cbc43266571a49ebf980812b530fe30c82e59f63 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 2 Apr 2020 11:48:41 -0400 Subject: [PATCH] Implement dismissal of new project checklist --- hubsrht/blueprints/projects.py | 10 ++++++++++ hubsrht/templates/project-summary.html | 24 ++++++++++++++++++------ hubsrht/types/project.py | 3 +++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/hubsrht/blueprints/projects.py b/hubsrht/blueprints/projects.py index e1122a6..f22f76e 100644 --- a/hubsrht/blueprints/projects.py +++ b/hubsrht/blueprints/projects.py @@ -48,6 +48,16 @@ def feed_GET(owner, project_name): view="summary", owner=owner, project=project, events=events, EventType=EventType, **pagination) +@projects.route("///dismiss-checklist", methods=["POST"]) +@loginrequired +def dismiss_checklist_POST(owner, project_name): + owner, project = get_project(owner, project_name, ProjectAccess.write) + project.checklist_complete = True + db.session.commit() + return redirect(url_for("projects.summary_GET", + owner=current_user.canonical_name, + project_name=project.name)) + @projects.route("/projects/create") @loginrequired def create_GET(): diff --git a/hubsrht/templates/project-summary.html b/hubsrht/templates/project-summary.html index 32bcb96..cadeb93 100644 --- a/hubsrht/templates/project-summary.html +++ b/hubsrht/templates/project-summary.html @@ -2,14 +2,23 @@ {% import "event.html" as eventutil with context %} {% block content %}
+ {% if not project.checklist_complete %}
-
+
+ {{csrf_token()}}

New project checklist - - dismiss - +

  • @@ -86,15 +95,18 @@ {% if ncomplete == 3 %}

    - dismiss + You're all set! If you want to set up more things for your project, click "add more" on the top right.

    {% endif %}
-
+
+ {% endif %}
diff --git a/hubsrht/types/project.py b/hubsrht/types/project.py index 1cbab65..877f62e 100644 --- a/hubsrht/types/project.py +++ b/hubsrht/types/project.py @@ -17,6 +17,9 @@ class Project(Base): visibility = sa.Column(sau.ChoiceType(Visibility, impl=sa.String()), nullable=False, server_default="unlisted") + checklist_complete = sa.Column(sa.Boolean, + nullable=False, server_default='f') + summary_repo_id = sa.Column(sa.Integer, sa.ForeignKey("source_repo.id")) summary_repo = sa.orm.relationship("SourceRepo", foreign_keys=[summary_repo_id])