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, view="summary", owner=owner, project=project,
events=events, EventType=EventType, **pagination) 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") @projects.route("/projects/create")
@loginrequired @loginrequired
def create_GET(): def create_GET():

View File

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

View File

@ -17,6 +17,9 @@ class Project(Base):
visibility = sa.Column(sau.ChoiceType(Visibility, impl=sa.String()), visibility = sa.Column(sau.ChoiceType(Visibility, impl=sa.String()),
nullable=False, server_default="unlisted") 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_id = sa.Column(sa.Integer, sa.ForeignKey("source_repo.id"))
summary_repo = sa.orm.relationship("SourceRepo", summary_repo = sa.orm.relationship("SourceRepo",
foreign_keys=[summary_repo_id]) foreign_keys=[summary_repo_id])