Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flashed messages UI by category #193

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cryptoadvance/specter/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def wallet_send(wallet_alias):
b64psbt = request.form["rawpsbt"]
psbt = wallet.importpsbt(b64psbt)
except Exception as e:
flash("Could not import PSBT: %s" % e)
flash("Could not import PSBT: %s" % e, "error")
return redirect(url_for('wallet_importpsbt', wallet_alias=wallet_alias))
return render_template("wallet/send/sign/wallet_send_sign_psbt.jinja", psbt=psbt, label=label,
wallet_alias=wallet_alias, wallet=wallet,
Expand All @@ -677,7 +677,7 @@ def wallet_send(wallet_alias):
try:
wallet.delete_pending_psbt(ast.literal_eval(request.form["pending_psbt"])["tx"]["txid"])
except Exception as e:
flash("Could not delete Pending PSBT!")
flash("Could not delete Pending PSBT!", "error")
return render_template("wallet/send/new/wallet_send.jinja", psbt=psbt, label=label,
wallet_alias=wallet_alias, wallet=wallet,
specter=app.specter, rand=rand, error=err)
Expand Down Expand Up @@ -712,7 +712,7 @@ def wallet_sendpending(wallet_alias):
wallet.delete_pending_psbt(ast.literal_eval(request.form["pending_psbt"])["tx"]["txid"])
except Exception as e:
app.logger.error("Could not delete Pending PSBT: %s" % e)
flash("Could not delete Pending PSBT!")
flash("Could not delete Pending PSBT!", "error")
pending_psbts = wallet.pending_psbts
return render_template("wallet/send/pending/wallet_sendpending.jinja", pending_psbts=pending_psbts,
wallet_alias=wallet_alias, wallet=wallet,
Expand Down Expand Up @@ -869,5 +869,5 @@ def notify_upgrade():
version_info["current"], version_info["latest"], version_info["upgrade"] = get_version_info()
app.logger.info("Upgrade? {}".format(version_info["upgrade"]))
if version_info["upgrade"]:
flash("There is a new version available. Consider strongly to upgrade to the new version {} with \"pip3 install cryptoadvance.specter --upgrade\"".format(version_info["latest"]))
flash("There is a new version available. Consider strongly to upgrade to the new version {} with \"pip3 install cryptoadvance.specter --upgrade\"".format(version_info["latest"]), "info")
return version_info["current"]
6 changes: 3 additions & 3 deletions src/cryptoadvance/specter/templates/base.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<img id="menubtn" src="/static/img/menu.svg"/>

<div id="messages">
{% with messages = get_flashed_messages() %}
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
{% for message in messages | unique %}
<message-box type="error">{{ message }}</message-box>
{% for category, message in messages | unique %}
<message-box type="{{ category }}">{{ message }}</message-box>
{% endfor %}
{% endif %}
{% endwith %}
Expand Down