summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/client.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/web/client.js b/web/client.js
index 7f779f6..b864997 100644
--- a/web/client.js
+++ b/web/client.js
@@ -15,12 +15,16 @@ $(function() {
$("#commit").prop("disabled", status == "invalid");
}
+ function setError(msg, mode) { set("invalid", msg, mode); };
+
return {
- enableCommit: function() {
- set("changed", "You have uncommitted changes", "txn");
- },
- setError: function(msg, mode) { set("invalid", msg, mode); },
- reset: function() { set(null, ""); }
+ 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");
+ }
}
})();
@@ -528,11 +532,6 @@ $(function() {
if (!isTreeNode(data.meta))
return target.append(JSON.stringify(data));
- function validated(txnValid) {
- if (txnValid) statusBar.enableCommit();
- else statusBar.setError("Some values need checking", "txn");
- }
-
var div = $("<div>");
target.append(div);
@@ -569,7 +568,7 @@ $(function() {
data.set(name, widget.get()).done(function(txnValid) {
widget.setMessage("");
widget.setStatus(data.status(name));
- validated(txnValid);
+ statusBar.validationReady(txnValid);
}).fail(function(xhr) {
if (_.isString(xhr)) widget.setMessage(xhr);
@@ -591,7 +590,7 @@ $(function() {
else widget.setMessage(formatError("Error", xhr));
widget.setStatus("invalid");
- validated(false);
+ statusBar.validationReady(false);
});
}
@@ -601,7 +600,7 @@ $(function() {
change,
removable ? function() {
data.delete(name).done(function(txnValid) {
- validated(txnValid)
+ statusBar.validationReady(txnValid)
fetchAndRender(path);
});
} : null,
@@ -677,7 +676,7 @@ $(function() {
data.meta
);
button.prop("class", null);
- validated(txnValid);
+ statusBar.validationReady(txnValid);
});
}