Firewall: Hide rule actions when using NAT.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 14 Jan 2014 21:09:13 +0000 (22:09 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 14 Jan 2014 21:09:13 +0000 (22:09 +0100)
There is no need to choose a rule action when creating a NAT rule, so this
section can be hidden when "Use NAT" has been checked.

html/cgi-bin/firewall.cgi

index 51966700e4f07b30a2fcbb1e80381417cd58641f..2a9415a9ddbcda456ca7ea7fd211c03abab39f82 100644 (file)
@@ -136,14 +136,17 @@ print<<END;
                \$("#protocol").change(update_protocol);
                update_protocol();
 
                \$("#protocol").change(update_protocol);
                update_protocol();
 
-               // When nat not used, hide it
-               if (! \$("#USE_NAT").attr("checked")) {
+               // Show/Hide elements when NAT checkbox is checked.
+               if (\$("#USE_NAT").attr("checked")) {
+                       \$("#actions").hide();
+               } else {
                        \$(".NAT").hide();
                }
 
                // Show NAT area when "use nat" checkbox is clicked
                \$("#USE_NAT").change(function() {
                        \$(".NAT").toggle();
                        \$(".NAT").hide();
                }
 
                // Show NAT area when "use nat" checkbox is clicked
                \$("#USE_NAT").change(function() {
                        \$(".NAT").toggle();
+                       \$("#actions").toggle();
                });
 
                // Time constraints
                });
 
                // Time constraints