summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/usr/local/www/firewall_nat_edit.php22
-rwxr-xr-xsrc/usr/local/www/foot.inc1
-rw-r--r--src/usr/local/www/jquery/pfSenseHelpers.js50
3 files changed, 51 insertions, 22 deletions
diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php
index 9d7578b..9a32ebb 100644
--- a/src/usr/local/www/firewall_nat_edit.php
+++ b/src/usr/local/www/firewall_nat_edit.php
@@ -970,28 +970,6 @@ events.push(function(){
var showsource = 0;
var iface_old = '';
- // ---------- "Library" functions ---------------------------------------------------------------------------------
- // 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');
- }
-
- // 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();
- }
-
// ---------- jQuery functions, lovingly converted from the original javascript------------------------------------------
function ext_change() {
diff --git a/src/usr/local/www/foot.inc b/src/usr/local/www/foot.inc
index f5108dd..500474f 100755
--- a/src/usr/local/www/foot.inc
+++ b/src/usr/local/www/foot.inc
@@ -23,5 +23,6 @@
<script src="/jquery/jquery-ui-1.11.2.min.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
<script src="/jquery/pfSense.js"></script>
+ <script src="/jquery/pfSenseHelpers.js"></script>
</body>
</html> \ No newline at end of file
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