New route for creating workspace user
This commit is contained in:
parent
a7678cad12
commit
b793d4a00a
@ -101,3 +101,15 @@ def new_member(workspace_id):
|
||||
workspace = Workspaces.get(g.current_user, workspace_id)
|
||||
form = NewMemberForm()
|
||||
return render_template("member_new.html", workspace=workspace, form=form)
|
||||
|
||||
|
||||
@bp.route("/workspaces/<workspace_id>/members/new", methods=["POST"])
|
||||
def create_member(workspace_id):
|
||||
workspace = Workspaces.get(g.current_user, workspace_id)
|
||||
form = NewMemberForm(http_request.form)
|
||||
|
||||
if form.validate():
|
||||
Workspaces.create_member(g.current_user, workspace, form.data)
|
||||
return redirect(url_for("workspaces.new_member", memberCreated=True))
|
||||
else:
|
||||
return render_template("member_new.html", workspace=workspace, form=form)
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form method="POST" action="" autocomplete="false">
|
||||
<form method="POST" action="{{ url_for('workspaces.create_member', workspace_id=workspace.id) }}" autocomplete="false">
|
||||
{{ form.csrf_token }}
|
||||
|
||||
<div class="panel">
|
||||
|
||||
@ -27,9 +28,7 @@
|
||||
|
||||
|
||||
<div class='action-group'>
|
||||
<a href='#' class='action-group__action usa-button usa-button-big'>
|
||||
Add User
|
||||
</a>
|
||||
<button class="usa-button usa-button-big usa-button-primary" tabindex="0">Add User</button>
|
||||
<a href='#' class='action-group__action icon-link'>
|
||||
{{ Icon('x') }}
|
||||
<span>Cancel</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user