forked from GNUsocial/gnu-social
Fancier invitation form for whitelisted domains
Squashed commit of the following: commit 1c0766e8f9d9e962ec553e2fb35bd2f944ffb4b0 Author: Zach Copley <zach@status.net> Date: Mon May 9 17:00:51 2011 -0700 Make the invites from the fancier invite form save commit 9ea45b7cf38eda8dad1d82e87b3400413a532079 Author: Zach Copley <zach@status.net> Date: Fri May 6 16:14:40 2011 -0700 .js to let the user add (and remove) additional invitees from their domain commit b2a02339bd11d02c7cba24629dde359e22de32b6 Author: Zach Copley <zach@status.net> Date: Thu May 5 15:44:49 2011 -0700 Load special whitelist invite .js when loading the invite page commit 132fed7550b40cd1d46ee506fd83974a116bce32 Author: Zach Copley <zach@status.net> Date: Wed May 4 18:35:49 2011 -0700 Remove settings class from whitelist inviter form commit a38437351b505594aead5da86af9a5ed089666b6 Author: Zach Copley <zach@status.net> Date: Wed May 4 18:21:18 2011 -0700 Make a fancier form for whitelist domain invites commit 710d4f41edf412871a9c1fbf33af317226485325 Author: Zach Copley <zach@status.net> Date: Wed May 4 17:34:09 2011 -0700 Add some more events to the invitation page commit 2449e4e0c1bf11568968cfc3ea2d8e69db2d875e Author: Zach Copley <zach@status.net> Date: Wed May 4 17:12:36 2011 -0700 Refactor invite action a bit
This commit is contained in:
40
plugins/DomainWhitelist/js/whitelistinvite.js
Normal file
40
plugins/DomainWhitelist/js/whitelistinvite.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// XXX: Should I do crazy SN.X.Y.Z.A namespace instead?
|
||||
var SN_WHITELIST = SN_WHITELIST || {};
|
||||
|
||||
SN_WHITELIST.updateButtons = function() {
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
SN_WHITELIST.resetRow = function(row) {
|
||||
$("input", row).val('');
|
||||
// Make sure the default domain is the first selection
|
||||
$("select option:first", row).val();
|
||||
$("a.remove_row", row).show();
|
||||
};
|
||||
|
||||
SN_WHITELIST.addRow = function() {
|
||||
var row = $(this).closest("li");
|
||||
var newRow = row.clone();
|
||||
SN_WHITELIST.resetRow(newRow);
|
||||
$(newRow).insertAfter(row).show("blind", "slow", function() {
|
||||
SN_WHITELIST.updateButtons();
|
||||
});
|
||||
};
|
||||
|
||||
SN_WHITELIST.removeRow = function() {
|
||||
$(this).closest("li").hide("blind", "slow", function() {
|
||||
$(this).remove();
|
||||
SN_WHITELIST.updateButtons();
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.add_row').live('click', SN_WHITELIST.addRow);
|
||||
$('.remove_row').live('click', SN_WHITELIST.removeRow);
|
||||
});
|
||||
|
Reference in New Issue
Block a user