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