summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/jquery/pfSenseHelpers.js
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-10-01 12:03:42 -0400
committerStephen Beaver <sbeaver@netgate.com>2015-10-01 12:03:42 -0400
commit3ece711605c23bda1176e341d8f96417d3b82b5d (patch)
tree249cf0e1e5ebb618f5bb3394505dc6892d31200b /src/usr/local/www/jquery/pfSenseHelpers.js
parentad6b0ac058b2c348df3a2aa3a541b212417e4d67 (diff)
downloadpfsense-3ece711605c23bda1176e341d8f96417d3b82b5d.zip
pfsense-3ece711605c23bda1176e341d8f96417d3b82b5d.tar.gz
Preparation #5159 (Javascript refactoring)
javascript/pfSenseHelpers.js created and populated with common hide/show/disable/enable functions file included via foot.inc Those functions removed from firewall_nat_edit.php to test
Diffstat (limited to 'src/usr/local/www/jquery/pfSenseHelpers.js')
-rw-r--r--src/usr/local/www/jquery/pfSenseHelpers.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js
new file mode 100644
index 0000000..6fde31e
--- /dev/null
+++ b/src/usr/local/www/jquery/pfSenseHelpers.js
@@ -0,0 +1,50 @@
+// These helper functions are used on many/most UI pages to hide/show/disable/enable form elements where required
+
+// Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden
+function hideInput(id, hide) {
+ if(hide)
+ $('#' + id).parent().parent('div').addClass('hidden');
+ else
+ $('#' + id).parent().parent('div').removeClass('hidden');
+}
+
+// Hides the <div> in which the specified group input element lives so that the input,
+// its label and help text are hidden
+function hideGroupInput(id, hide) {
+ if(hide)
+ $('#' + id).parent('div').addClass('hidden');
+ else
+ $('#' + id).parent('div').removeClass('hidden');
+}
+
+// Hides the <div> in which the specified checkbox lives so that the checkbox, its label and help text are hidden
+function hideCheckbox(id, hide) {
+ if(hide)
+ $('#' + id).parent().parent().parent('div').addClass('hidden');
+ else
+ $('#' + id).parent().parent().parent('div').removeClass('hidden');
+}
+
+// Disables the specified input element
+function disableInput(id, disable) {
+ $('#' + id).prop("disabled", disable);
+}
+
+// Hides all elements of the specified class. This will usually be a section
+function hideClass(s_class, hide) {
+ if(hide)
+ $('.' + s_class).hide();
+ else
+ $('.' + s_class).show();
+}
+
+// Hides all elements of the specified class assigned to a group. This will usually be a group
+function hideGroupClass(s_class, hide) {
+ if(hide)
+ $('.' + s_class).parent().parent().parent().hide();
+ else
+ $('.' + s_class).parent().parent().parent().show();
+}
+
+
+
OpenPOWER on IntegriCloud