Implement dismissal of new project checklist

This commit is contained in:
Drew DeVault 2020-04-02 11:48:41 -04:00
parent 6456c0a7bf
commit cbc4326657
3 changed files with 31 additions and 6 deletions

View File

@ -48,6 +48,16 @@ def feed_GET(owner, project_name):
view="summary", owner=owner, project=project,
events=events, EventType=EventType, **pagination)
@projects.route("/<owner>/<project_name>/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():

View File

@ -2,14 +2,23 @@
{% import "event.html" as eventutil with context %}
{% block content %}
<div class="container">
{% if not project.checklist_complete %}
<div class="row">
<div class="col-md-12 event-list">
<div class="event">
<form
class="event"
method="POST"
action="{{url_for("projects.dismiss_checklist_POST",
owner=owner.canonical_name, project_name=project.name)}}"
>
{{csrf_token()}}
<h3>
New project checklist
<small style="font-size: 0.9rem;" class="pull-right">
<a class="text-muted" href="#">dismiss</a>
</small>
<button class="btn btn-link text-muted pull-right" type="submit">
<small style="font-size: 0.9rem;">
dismiss
</small>
</button>
</h3>
<ul class="checklist">
<li>
@ -86,15 +95,18 @@
{% if ncomplete == 3 %}
<div class="alert alert-info">
<p>
<a class="text-muted pull-right" href="#">dismiss</a>
<button class="btn btn-link text-muted pull-right" type="submit">
dismiss
</button>
You're all set! If you want to set up more things for your project,
click "add more" on the top right.
</p>
</div>
{% endif %}
</div>
</div>
</form>
</div>
{% endif %}
<div class="row">
<div class="col-md-12">
<div class="event-list project-events">

View File

@ -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])