add remove button on custom domain name
This commit is contained in:
parent
c28872288b
commit
bcb2657de3
|
@ -72,7 +72,10 @@
|
|||
name="alias-name"
|
||||
placeholder="Alias name">
|
||||
</div>
|
||||
<button class="btn btn-primary">Save</button>
|
||||
<button class="btn btn-primary" name="action" value="save">Save</button>
|
||||
{% if custom_domain.name %}
|
||||
<button class="btn btn-danger float-right" name="action" value="remove">Remove</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -154,12 +154,20 @@ def domain_detail(custom_domain_id):
|
|||
url_for("dashboard.domain_detail", custom_domain_id=custom_domain.id)
|
||||
)
|
||||
elif request.form.get("form-name") == "set-name":
|
||||
if request.form.get("action") == "save":
|
||||
custom_domain.name = request.form.get("alias-name").replace("\n", "")
|
||||
db.session.commit()
|
||||
flash(
|
||||
f"Default alias name for Domain {custom_domain.domain} has been set",
|
||||
"success",
|
||||
)
|
||||
else:
|
||||
custom_domain.name = None
|
||||
db.session.commit()
|
||||
flash(
|
||||
f"Default alias name for Domain {custom_domain.domain} has been removed",
|
||||
"info",
|
||||
)
|
||||
|
||||
return redirect(
|
||||
url_for("dashboard.domain_detail", custom_domain_id=custom_domain.id)
|
||||
|
|
Loading…
Reference in a new issue