diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-12-14 09:25:22 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-14 09:25:41 -0500 |
commit | 9f6a9f24edf12d961c0318d95b02d969447e2d3d (patch) | |
tree | 4c583c54300a1ac4e69ed75fe76df595f09fed2d /src | |
parent | cd3f4b916c252980a257f5be1a0cf2688c078549 (diff) | |
download | pfsense-9f6a9f24edf12d961c0318d95b02d969447e2d3d.zip pfsense-9f6a9f24edf12d961c0318d95b02d969447e2d3d.tar.gz |
Fixed #5638
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/jquery/pfSenseHelpers.js | 15 | ||||
-rw-r--r-- | src/usr/local/www/services_unbound_host_edit.php | 31 |
2 files changed, 30 insertions, 16 deletions
diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js index db7c26c..f6e48e0 100644 --- a/src/usr/local/www/jquery/pfSenseHelpers.js +++ b/src/usr/local/www/jquery/pfSenseHelpers.js @@ -341,6 +341,21 @@ function add_row() { } }); } + + // Not that we are no longer cloning the event handlers, we need to remove and re-add after a new row + // has been added to the table + $('[id^=delete]').unbind(); + $('[id^=delete]').click(function(event) { + if($('.repeatable').length > 1) { + if((typeof retainhelp) == "undefined") + moveHelpText(event.target.id); + + delete_row(event.target.id); + } + else + alert('You may not delete the last row!'); + }); + } // These are action buttons, not submit buttons diff --git a/src/usr/local/www/services_unbound_host_edit.php b/src/usr/local/www/services_unbound_host_edit.php index 29ebc3c..7a4d696 100644 --- a/src/usr/local/www/services_unbound_host_edit.php +++ b/src/usr/local/www/services_unbound_host_edit.php @@ -282,12 +282,17 @@ $form->add($section); $section = new Form_Section('Additional names for this host'); +if(!$pconfig['aliases']['item']) { + $pconfig['aliases']['item'] = array('host' => ""); +} + if( $pconfig['aliases']['item']) { $counter = 0; $last = count($pconfig['aliases']['item']) - 1; foreach($pconfig['aliases']['item'] as $item) { $group = new Form_Group(null); + $group->addClass('repeatable'); $group->add(new Form_Input( 'aliashost' . $counter, @@ -310,28 +315,22 @@ if( $pconfig['aliases']['item']) { $item['description'] ))->setHelp($counter == $last ? 'Description':null); - $btn = new Form_Button( - 'btn' . $counter, - 'Delete', - 'services_unbound_host_edit.php?act=delopt' . '&id=' . $counter - ); + $group->add(new Form_Button( + 'deleterow' . $counter, + 'Delete' + ))->removeClass('btn-primary')->addClass('btn-warning'); - $btn->removeClass('btn-primary')->addClass('btn-danger btn-sm'); - $group->add($btn); $section->add($group); $counter++; } } -$btnaddopt = new Form_Button( - 'btnaddopt', - 'Add Host name', - 'services_unbound_host_edit.php?act=addopt' -); - -$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm'); - -$section->addInput($btnaddopt); +$form->addGlobal(new Form_Button( + 'addrow', + 'Add host name', + null, + 'fa-plus' +))->removeClass('btn-primary')->addClass('btn-success addbtn'); $form->add($section); print($form); |