From 4a04291c1651df62c9008548ebf9511ab5d8df04 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 11 May 2011 16:29:35 -0700 Subject: [PATCH] Make add/remove item buttons work the same way they do on the extended profile form --- plugins/DomainWhitelist/js/whitelistinvite.js | 8 ++++++-- plugins/DomainWhitelist/lib/whitelistinviteform.php | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/DomainWhitelist/js/whitelistinvite.js b/plugins/DomainWhitelist/js/whitelistinvite.js index 9a71936445..2038a93f33 100644 --- a/plugins/DomainWhitelist/js/whitelistinvite.js +++ b/plugins/DomainWhitelist/js/whitelistinvite.js @@ -2,12 +2,16 @@ var SN_WHITELIST = SN_WHITELIST || {}; SN_WHITELIST.updateButtons = function() { + $("ul > li > a.remove_row").show(); + $("ul > li > a.add_row").hide(); + var lis = $('ul > li > input[name^="username[]"]'); if (lis.length === 1) { $("ul > li > a.remove_row").hide(); } else { $("ul > li > a.remove_row:first").show(); } + $("ul > li > a.add_row:last").show(); }; SN_WHITELIST.resetRow = function(row) { @@ -27,7 +31,6 @@ SN_WHITELIST.addRow = function() { }; SN_WHITELIST.removeRow = function() { - var that = this; $("#confirm-dialog").dialog({ @@ -56,7 +59,6 @@ SN_WHITELIST.removeRow = function() { }; $(document).ready(function() { - $("#confirm-dialog").dialog({ autoOpen: false, modal: true @@ -64,4 +66,6 @@ $(document).ready(function() { $('.add_row').live('click', SN_WHITELIST.addRow); $('.remove_row').live('click', SN_WHITELIST.removeRow); + + SN_WHITELIST.updateButtons(); }); diff --git a/plugins/DomainWhitelist/lib/whitelistinviteform.php b/plugins/DomainWhitelist/lib/whitelistinviteform.php index 165d708b75..7ff730e6a8 100644 --- a/plugins/DomainWhitelist/lib/whitelistinviteform.php +++ b/plugins/DomainWhitelist/lib/whitelistinviteform.php @@ -142,6 +142,7 @@ class WhitelistInviteForm extends Form array( 'class' => 'remove_row', 'href' => 'javascript://', + 'style' => 'display: none;' ), '-' ); @@ -151,6 +152,7 @@ class WhitelistInviteForm extends Form array( 'class' => 'add_row', 'href' => 'javascript://', + 'style' => 'display: none;' ), _m('Add another item') );