summaryrefslogtreecommitdiffstats
path: root/web/statusbar.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/statusbar.js')
-rw-r--r--web/statusbar.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/web/statusbar.js b/web/statusbar.js
new file mode 100644
index 0000000..3488772
--- /dev/null
+++ b/web/statusbar.js
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2012-2014 Kaarle Ritvanen
+ * See LICENSE file for license details
+ */
+
+define(["jquery"], function($) {
+ function set(status, msg, mode) {
+ $("#status").prop("class", status);
+ $("#status p").text(msg);
+ $("#logout").prop("class", mode ? "hidden" : null);
+ $("#status div").prop("class", mode == "txn" ? null : "hidden");
+ $("#commit").prop("disabled", status == "invalid");
+ }
+
+ function setError(msg, mode) { set("invalid", msg, mode); }
+
+ return {
+ reset: function() { set(null, ""); },
+ setError: setError,
+ validationReady: function(txnValid) {
+ if (txnValid)
+ set("changed", "You have uncommitted changes", "txn");
+ else setError("Some values need checking", "txn");
+ }
+ };
+});